diff --git a/tools/db_bench_tool.cc b/tools/db_bench_tool.cc index dd5587e75..e4f07f290 100644 --- a/tools/db_bench_tool.cc +++ b/tools/db_bench_tool.cc @@ -1410,6 +1410,7 @@ DEFINE_int32(skip_list_lookahead, 0, "Used with skip_list memtablerep; try " "position"); DEFINE_bool(report_file_operations, false, "if report number of file " "operations"); +DEFINE_bool(report_open_timing, false, "if report open timing"); DEFINE_int32(readahead_size, 0, "Iterator readahead size"); DEFINE_bool(read_with_latest_user_timestamp, true, @@ -4401,6 +4402,7 @@ class Benchmark { void OpenDb(Options options, const std::string& db_name, DBWithColumnFamilies* db) { + uint64_t open_start = FLAGS_report_open_timing ? FLAGS_env->NowNanos() : 0; Status s; // Open with column families if necessary. if (FLAGS_num_column_families > 1) { @@ -4541,6 +4543,11 @@ class Benchmark { } else { s = DB::Open(options, db_name, &db->db); } + if (FLAGS_report_open_timing) { + std::cout << "OpenDb: " + << (FLAGS_env->NowNanos() - open_start) / 1000000.0 + << " milliseconds\n"; + } if (!s.ok()) { fprintf(stderr, "open error: %s\n", s.ToString().c_str()); exit(1);