MCPcopy Create free account
hub / github.com/ElementsProject/elements / main

Function main

src/leveldb/benchmarks/db_bench_tree_db.cc:478–522  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

476} // namespace leveldb
477
478int main(int argc, char** argv) {
479 std::string default_db_path;
480 for (int i = 1; i < argc; i++) {
481 double d;
482 int n;
483 char junk;
484 if (leveldb::Slice(argv[i]).starts_with("--benchmarks=")) {
485 FLAGS_benchmarks = argv[i] + strlen("--benchmarks=");
486 } else if (sscanf(argv[i], "--compression_ratio=%lf%c", &d, &junk) == 1) {
487 FLAGS_compression_ratio = d;
488 } else if (sscanf(argv[i], "--histogram=%d%c", &n, &junk) == 1 &&
489 (n == 0 || n == 1)) {
490 FLAGS_histogram = n;
491 } else if (sscanf(argv[i], "--num=%d%c", &n, &junk) == 1) {
492 FLAGS_num = n;
493 } else if (sscanf(argv[i], "--reads=%d%c", &n, &junk) == 1) {
494 FLAGS_reads = n;
495 } else if (sscanf(argv[i], "--value_size=%d%c", &n, &junk) == 1) {
496 FLAGS_value_size = n;
497 } else if (sscanf(argv[i], "--cache_size=%d%c", &n, &junk) == 1) {
498 FLAGS_cache_size = n;
499 } else if (sscanf(argv[i], "--page_size=%d%c", &n, &junk) == 1) {
500 FLAGS_page_size = n;
501 } else if (sscanf(argv[i], "--compression=%d%c", &n, &junk) == 1 &&
502 (n == 0 || n == 1)) {
503 FLAGS_compression = (n == 1) ? true : false;
504 } else if (strncmp(argv[i], "--db=", 5) == 0) {
505 FLAGS_db = argv[i] + 5;
506 } else {
507 fprintf(stderr, "Invalid flag '%s'\n", argv[i]);
508 exit(1);
509 }
510 }
511
512 // Choose a location for the test database if none given with --db=<path>
513 if (FLAGS_db == nullptr) {
514 leveldb::Env::Default()->GetTestDirectory(&default_db_path);
515 default_db_path += "/dbbench";
516 FLAGS_db = default_db_path.c_str();
517 }
518
519 leveldb::Benchmark benchmark;
520 benchmark.Run();
521 return 0;
522}

Callers

nothing calls this directly

Calls 3

SliceClass · 0.50
GetTestDirectoryMethod · 0.45
RunMethod · 0.45

Tested by

no test coverage detected