From d71e5a5beb94d73e8fd3acd36faa33adbb5d1fd8 Mon Sep 17 00:00:00 2001 From: Mark Callaghan Date: Wed, 23 Mar 2022 09:33:41 -0700 Subject: [PATCH] Add number of running flushes & compactions to --stats_per_interval output (#9726) Summary: This is for https://github.com/facebook/rocksdb/issues/9709 and add two lines to the end of DB Stats for num-running-compactions and num-running-flushes. For example ... ** DB Stats ** Uptime(secs): 6.0 total, 1.0 interval Cumulative writes: 915K writes, 915K keys, 915K commit groups, 1.0 writes per commit group, ingest: 0.11 GB, 18.95 MB/s Cumulative WAL: 915K writes, 0 syncs, 915000.00 writes per sync, written: 0.11 GB, 18.95 MB/s Cumulative stall: 00:00:0.000 H:M:S, 0.0 percent Interval writes: 133K writes, 133K keys, 133K commit groups, 1.0 writes per commit group, ingest: 16.62 MB, 16.53 MB/s Interval WAL: 133K writes, 0 syncs, 133000.00 writes per sync, written: 0.02 GB, 16.53 MB/s Interval stall: 00:00:0.000 H:M:S, 0.0 percent num-running-compactions: 0 num-running-flushes: 0 Pull Request resolved: https://github.com/facebook/rocksdb/pull/9726 Reviewed By: jay-zhuang Differential Revision: D35066759 Pulled By: mdcallag fbshipit-source-id: c161fadd3c15c5aa715a820dab6bfedb46dc099b --- tools/db_bench_tool.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/db_bench_tool.cc b/tools/db_bench_tool.cc index 1aac45698..10d05b025 100644 --- a/tools/db_bench_tool.cc +++ b/tools/db_bench_tool.cc @@ -2211,7 +2211,13 @@ class Stats { } } else if (db) { if (db->GetProperty("rocksdb.stats", &stats)) { - fprintf(stderr, "%s\n", stats.c_str()); + fprintf(stderr, "%s", stats.c_str()); + } + if (db->GetProperty("rocksdb.num-running-compactions", &stats)) { + fprintf(stderr, "num-running-compactions: %s\n", stats.c_str()); + } + if (db->GetProperty("rocksdb.num-running-flushes", &stats)) { + fprintf(stderr, "num-running-flushes: %s\n\n", stats.c_str()); } if (FLAGS_show_table_properties) { for (int level = 0; level < FLAGS_num_levels; ++level) {