|
@ -21,9 +21,53 @@ int main( |
|
|
[[maybe_unused]] char** argv |
|
|
[[maybe_unused]] char** argv |
|
|
) |
|
|
) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CMD::commander cmd_args(argc, argv); |
|
|
|
|
|
|
|
|
|
|
|
std::string database_str = "/data/"; |
|
|
|
|
|
|
|
|
|
|
|
if(cmd_args.isFlagSet("-database")) |
|
|
|
|
|
{ |
|
|
|
|
|
database_str = cmd_args.getFlagValue("-database"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
std::string utest_str = "/tmp/"; |
|
|
|
|
|
|
|
|
|
|
|
if(cmd_args.isFlagSet("-utest")) |
|
|
|
|
|
{ |
|
|
|
|
|
utest_str = cmd_args.getFlagValue("-utest"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
size_t database_size = 4096; |
|
|
|
|
|
|
|
|
|
|
|
if(cmd_args.isFlagSet("-page-count")) |
|
|
|
|
|
{ |
|
|
|
|
|
try{ |
|
|
|
|
|
database_size = std::stoll(cmd_args.getFlagValue("-page-count")); |
|
|
|
|
|
} catch (...) { |
|
|
|
|
|
std::cerr << "Invalid page-count value" << std::endl; |
|
|
|
|
|
return 1; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
size_t utest_size = 4096; |
|
|
|
|
|
|
|
|
|
|
|
if(cmd_args.isFlagSet("-utest-count")) |
|
|
|
|
|
{ |
|
|
|
|
|
try{ |
|
|
|
|
|
utest_size = std::stoll(cmd_args.getFlagValue("-utest-count")); |
|
|
|
|
|
} catch (...) { |
|
|
|
|
|
std::cerr << "Invalid utest-count value" << std::endl; |
|
|
|
|
|
return 1; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
#ifdef UNITTEST
|
|
|
#ifdef UNITTEST
|
|
|
{ |
|
|
{ |
|
|
database db(database::create("/tmp/", 4096)); |
|
|
|
|
|
|
|
|
database db(database::create(n">utest_str, utest_size*2)); |
|
|
|
|
|
|
|
|
db_page v; |
|
|
db_page v; |
|
|
v.fill(1); |
|
|
v.fill(1); |
|
@ -32,14 +76,13 @@ int main( |
|
|
|
|
|
|
|
|
auto begin = std::chrono::high_resolution_clock::now(); |
|
|
auto begin = std::chrono::high_resolution_clock::now(); |
|
|
|
|
|
|
|
|
size_t tot = 2048; |
|
|
|
|
|
for(size_t idx=0;idx<tot;idx++) |
|
|
|
|
|
|
|
|
for(size_t idx=0;idx<utest_size;idx++) |
|
|
{ |
|
|
{ |
|
|
tar.y.internal = idx; |
|
|
tar.y.internal = idx; |
|
|
db.write(tar, v); |
|
|
db.write(tar, v); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
auto durr = std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now() - begin)/tot; |
|
|
|
|
|
|
|
|
auto durr = std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now() - begin)/utest_size; |
|
|
|
|
|
|
|
|
std::cerr << "durr/elem = " << durr.count() << "ns/op" << std::endl; |
|
|
std::cerr << "durr/elem = " << durr.count() << "ns/op" << std::endl; |
|
|
|
|
|
|
|
@ -71,7 +114,7 @@ int main( |
|
|
db.write(tar, v); |
|
|
db.write(tar, v); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
database reop(database::open(sa">"/tmp/")); |
|
|
|
|
|
|
|
|
database reop(database::open(n">utest_str)); |
|
|
|
|
|
|
|
|
{ |
|
|
{ |
|
|
a = reop.read(tar); |
|
|
a = reop.read(tar); |
|
@ -101,27 +144,6 @@ int main( |
|
|
} |
|
|
} |
|
|
#endif
|
|
|
#endif
|
|
|
|
|
|
|
|
|
CMD::commander cmd_args(argc, argv); |
|
|
|
|
|
|
|
|
|
|
|
std::string database_str = "/data/"; |
|
|
|
|
|
|
|
|
|
|
|
if(cmd_args.isFlagSet("-database")) |
|
|
|
|
|
{ |
|
|
|
|
|
database_str = cmd_args.getFlagValue("-database"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
size_t database_size = 4096; |
|
|
|
|
|
|
|
|
|
|
|
if(cmd_args.isFlagSet("-page-count")) |
|
|
|
|
|
{ |
|
|
|
|
|
try{ |
|
|
|
|
|
database_size = std::stoll(cmd_args.getFlagValue("-page-count")); |
|
|
|
|
|
} catch (...) { |
|
|
|
|
|
std::cerr << "Invalid page-count value" << std::endl; |
|
|
|
|
|
return 1; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(cmd_args.isFlagSet("-create")) |
|
|
if(cmd_args.isFlagSet("-create")) |
|
|
{ |
|
|
{ |
|
@ -192,7 +214,7 @@ int main( |
|
|
run_db.write(recv.identifier, recv.page); |
|
|
run_db.write(recv.identifier, recv.page); |
|
|
reply.identifier = recv.identifier; |
|
|
reply.identifier = recv.identifier; |
|
|
} catch (...) { |
|
|
} catch (...) { |
|
|
|
|
|
|
|
|
|
|
|
std::cerr << "cluster overfull"<< std::endl; |
|
|
} |
|
|
} |
|
|
reply_size = sizeof(reply.rep_id) + sizeof(reply.identifier); |
|
|
reply_size = sizeof(reply.rep_id) + sizeof(reply.identifier); |
|
|
} |
|
|
} |
|
|