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

Function main

src/leveldb/benchmarks/db_bench_sqlite3.cc:665–714  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

663} // namespace leveldb
664
665int main(int argc, char** argv) {
666 std::string default_db_path;
667 for (int i = 1; i < argc; i++) {
668 double d;
669 int n;
670 char junk;
671 if (leveldb::Slice(argv[i]).starts_with("--benchmarks=")) {
672 FLAGS_benchmarks = argv[i] + strlen("--benchmarks=");
673 } else if (sscanf(argv[i], "--histogram=%d%c", &n, &junk) == 1 &&
674 (n == 0 || n == 1)) {
675 FLAGS_histogram = n;
676 } else if (sscanf(argv[i], "--compression_ratio=%lf%c", &d, &junk) == 1) {
677 FLAGS_compression_ratio = d;
678 } else if (sscanf(argv[i], "--use_existing_db=%d%c", &n, &junk) == 1 &&
679 (n == 0 || n == 1)) {
680 FLAGS_use_existing_db = n;
681 } else if (sscanf(argv[i], "--num=%d%c", &n, &junk) == 1) {
682 FLAGS_num = n;
683 } else if (sscanf(argv[i], "--reads=%d%c", &n, &junk) == 1) {
684 FLAGS_reads = n;
685 } else if (sscanf(argv[i], "--value_size=%d%c", &n, &junk) == 1) {
686 FLAGS_value_size = n;
687 } else if (leveldb::Slice(argv[i]) == leveldb::Slice("--no_transaction")) {
688 FLAGS_transaction = false;
689 } else if (sscanf(argv[i], "--page_size=%d%c", &n, &junk) == 1) {
690 FLAGS_page_size = n;
691 } else if (sscanf(argv[i], "--num_pages=%d%c", &n, &junk) == 1) {
692 FLAGS_num_pages = n;
693 } else if (sscanf(argv[i], "--WAL_enabled=%d%c", &n, &junk) == 1 &&
694 (n == 0 || n == 1)) {
695 FLAGS_WAL_enabled = n;
696 } else if (strncmp(argv[i], "--db=", 5) == 0) {
697 FLAGS_db = argv[i] + 5;
698 } else {
699 fprintf(stderr, "Invalid flag '%s'\n", argv[i]);
700 exit(1);
701 }
702 }
703
704 // Choose a location for the test database if none given with --db=<path>
705 if (FLAGS_db == nullptr) {
706 leveldb::Env::Default()->GetTestDirectory(&default_db_path);
707 default_db_path += "/dbbench";
708 FLAGS_db = default_db_path.c_str();
709 }
710
711 leveldb::Benchmark benchmark;
712 benchmark.Run();
713 return 0;
714}

Callers

nothing calls this directly

Calls 3

SliceClass · 0.50
GetTestDirectoryMethod · 0.45
RunMethod · 0.45

Tested by

no test coverage detected