Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
76 changed files
with
21,321 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.