Permalink
Browse files

import from priv repos

  • Loading branch information...
1 parent 3501230 commit 0c0c7b4e392af0b6505ab81b00d16025dc34b03b @nyaxt committed Aug 15, 2011
Showing with 21,321 additions and 0 deletions.
  1. +29 −0 .hgignore
  2. +28 −0 3rdp_bench/Makefile
  3. +117 −0 3rdp_bench/bdb_bench.cpp
  4. +417 −0 3rdp_bench/haildb_bench.cpp
  5. +85 −0 3rdp_bench/kc_bench.cpp
  6. +98 −0 3rdp_bench/leveldb_bench.cpp
  7. +77 −0 3rdp_bench/luxio_bench.cpp
  8. +17 −0 Doxyfile
  9. +15 −0 README.dtrace
  10. +37 −0 TODO
  11. +135 −0 bench.h
  12. +134 −0 bench_tmpl.h
  13. +124 −0 benchresult.bengal
  14. +1,309 −0 benchresult.lion
  15. +22 −0 benchutil/_aliases.rb
  16. +278 −0 benchutil/query.rb
  17. +218 −0 benchutil/run.rb
  18. +14 −0 examples/Makefile
  19. +142 −0 examples/cxx_demo.cpp
  20. +35 −0 gcmemo.txt
  21. +11 −0 graphdump/Makefile
  22. +57 −0 gtest.py
  23. +35 −0 mysql/INSTALL
  24. +1,392 −0 mysql/ha_myptnk.cpp
  25. +94 −0 mysql/ha_myptnk.h
  26. +7 −0 mysql/mysqlc
  27. +6 −0 mysql/mysqld_clean
  28. +12 −0 mysql/mysqld_debugrun
  29. +7 −0 mysql/mysqld_vars
  30. +56 −0 mysql/wscript
  31. +585 −0 ptnk.cpp
  32. +13 −0 ptnk.d
  33. +389 −0 ptnk.h
  34. +8 −0 ptnk.stp
  35. +72 −0 ptnk/bitvector.h
  36. +3,459 −0 ptnk/btree.cpp
  37. +141 −0 ptnk/btree.h
  38. +901 −0 ptnk/btree_int.h
  39. +88 −0 ptnk/buffer.cpp
  40. +462 −0 ptnk/buffer.h
  41. +137 −0 ptnk/common.h
  42. +103 −0 ptnk/compmap.cpp
  43. +108 −0 ptnk/compmap.h
  44. +514 −0 ptnk/db.cpp
  45. +176 −0 ptnk/db.h
  46. +65 −0 ptnk/exceptions.h
  47. +85 −0 ptnk/hash.cpp
  48. +14 −0 ptnk/hash.h
  49. +392 −0 ptnk/overview.cpp
  50. +86 −0 ptnk/overview.h
  51. +69 −0 ptnk/page.cpp
  52. +352 −0 ptnk/page.h
  53. +121 −0 ptnk/pageio.cpp
  54. +133 −0 ptnk/pageio.h
  55. +387 −0 ptnk/pageiomem.cpp
  56. +139 −0 ptnk/pageiomem.h
  57. +419 −0 ptnk/partitionedpageio.cpp
  58. +160 −0 ptnk/partitionedpageio.h
  59. +27 −0 ptnk/query.h
  60. +123 −0 ptnk/streak.h
  61. +54 −0 ptnk/toc.h
  62. +1,054 −0 ptnk/tpio.cpp
  63. +423 −0 ptnk/tpio.h
  64. +77 −0 ptnk/types.h
  65. +97 −0 ptnk_bench.cpp
  66. +28 −0 ptnk_bindump.cpp
  67. +27 −0 ptnk_compact.cpp
  68. +47 −0 ptnk_dump.cpp
  69. +57 −0 ptnk_dumpstreak.cpp
  70. +47 −0 ptnk_findroot.cpp
  71. +84 −0 ptnk_mtbench.cpp
  72. +10 −0 ptnk_probes.d
  73. +4,168 −0 ptnk_test.cpp
  74. BIN waf
  75. +258 −0 wscript
  76. +154 −0 xcode/ptnk.xcodeproj/project.pbxproj
View
@@ -0,0 +1,29 @@
+syntax: regexp
+ptnk_test$
+dSYM
+^graphdump/.*\.gv$
+^graphdump/.*\.png$
+.DS_Store
+^xcode/build
+^xcode/ptnk.xcodeproj/kouhei
+core$
+^ptnk_bench$
+\.o$
+^3rdp_bench/\w+bench$
+^bench\w*.png$
+^result.plot$
+^gmon.out$
+^_testtmp/
+^ptnk_bindump$
+^ptnk_dumpstreak$
+^ptnk_findroot$
+^ptnk_mtbench$
+^mysql/\.waf
+^mysql/build/
+^\.waf
+^build/
+\.lock-wafbuild$
+\.pyc$
+^doxy/
+^mysql/mysqld.log$
+^benchresult
View
@@ -0,0 +1,28 @@
+CXX=g++
+HGNUM=$(shell hg id -n)
+CXXFLAGS=-I/opt/local/include -I../build -Wall -DHGNUM="\"$(HGNUM)\"" -ggdb -O4
+LDFLAGS=-L/opt/local/lib -L/usr/local/lib -lpthread -lgtest -lrt
+
+TARGETS=kc_bench bdb_bench haildb_bench luxio_bench
+
+all: $(TARGETS)
+
+.PHONY: clean all
+
+bdb_bench: bdb_bench.cpp ../bench.h ../bench_tmpl.h
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -ldb -ldb_cxx -o $@ $<
+
+kc_bench: kc_bench.cpp ../bench.h ../bench_tmpl.h
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -lkyotocabinet -o $@ $<
+
+haildb_bench: haildb_bench.cpp ../bench.h ../bench_tmpl.h
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -lhaildb -o $@ $<
+
+luxio_bench: luxio_bench.cpp ../bench.h ../bench_tmpl.h
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -lluxio -o $@ $<
+
+leveldb_bench: leveldb_bench.cpp ../bench.h ../bench_tmpl.h
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $< -lleveldb
+
+clean:
+ rm $(TARGETS)
View
@@ -0,0 +1,117 @@
+#include "../bench_tmpl.h"
+#include <db_cxx.h>
+#include <libgen.h>
+
+void
+run_bench()
+{
+ if(do_sync)
+ {
+ std::cerr << "sync option ignored in bdb_bench" << std::endl;
+ exit(1);
+ }
+
+ uint32_t dbopt = DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN | DB_CREATE | DB_LOG_DSYNC;
+
+ Bench b((boost::format("%1% %2%") % PROGNAME % comment).str());
+ {
+ DbEnv* envp = NULL;
+ Db* dbp = NULL;
+
+ envp = new DbEnv(0);
+ char strdir[4096]; ::strcpy(strdir, dbfile);
+ envp->open(dirname(strdir), dbopt, 00644);
+
+ dbp = new Db(envp, 0);
+ char strbase[4096]; ::strcpy(strbase, dbfile);
+ dbp->open(NULL, basename(strbase), NULL, DB_BTREE, dbopt, 00644);
+
+ b.cp("db init");
+ int ik = 0;
+
+ if(NUM_PREW > 0)
+ {
+ DbTxn *txn = NULL;
+ envp->txn_begin(NULL, &txn, 0);
+ for(int i = 0; i < NUM_PREW; ++ i)
+ {
+ int k = keys[ik++];
+
+ char buf[9];
+ sprintf(buf, "%08u", k);
+
+ Dbt key, value;
+ key.set_data(buf);
+ key.set_size(::strlen(buf));
+ value.set_data(&k);
+ value.set_size(sizeof(int));
+
+ dbp->put(txn, &key, &value, 0);
+ }
+ txn->commit(0);
+
+ // don't include preloading time
+ fprintf(stderr, "prewrite %d keys done\n", ik);
+ b.start(); b.cp("db init");
+ }
+
+ for(int itx = 0; itx < NUM_TX; ++ itx)
+ {
+ DbTxn *txn = NULL;
+ envp->txn_begin(NULL, &txn, 0);
+
+ for(int iw = 0; iw < NUM_W_PER_TX; ++ iw)
+ {
+ int k = keys[ik++];
+
+ char buf[9];
+ sprintf(buf, "%08u", k);
+
+ Dbt key, value;
+ key.set_data(buf);
+ key.set_size(::strlen(buf));
+ value.set_data(&k);
+ value.set_size(sizeof(int));
+
+ dbp->put(txn, &key, &value, 0);
+ }
+
+ for(int ir = 0; ir < NUM_R_PER_TX; ++ ir)
+ {
+ int k = keys[rand() % ik];
+
+ char buf[9];
+ sprintf(buf, "%08u", k);
+
+ Dbt key, value;
+ value.set_data(buf);
+ value.set_size(::strlen(buf));
+ dbp->get(txn, &key, &value, 0);
+ }
+
+ try
+ {
+ txn->commit(0);
+ txn = NULL;
+ }
+ catch(...)
+ {
+ std::cerr << "txn commit failed!" << std::endl;
+ exit(1);
+ }
+ }
+ b.cp("tx done");
+
+ if(NUM_W_PER_TX == 0)
+ {
+ // avoid measuring clean up time
+ b.end();b.dump();
+ exit(0);
+ }
+
+ dbp->close(0);
+ envp->close(0);
+ }
+ b.end();
+ b.dump();
+}
Oops, something went wrong.

0 comments on commit 0c0c7b4

Please sign in to comment.