From 409635cb2a0f607b9c3687f4b3657edede0160ec Mon Sep 17 00:00:00 2001 From: Mark Callaghan Date: Thu, 24 Mar 2022 13:39:01 -0700 Subject: [PATCH] Add --slow_usecs option to determine when long op message is printed (#9732) Summary: This adds the --slow_usecs option with a default value of 1M. Operations that take this much time have a message printed when --histogram=1, --stats_interval=0 and --stats_interval_seconds=0. The current code hardwired this to 20,000 usecs and for some stress tests that reduced throughput by 20% or more. This is for https://github.com/facebook/rocksdb/issues/9620 Pull Request resolved: https://github.com/facebook/rocksdb/pull/9732 Test Plan: ./db_bench --benchmarks=fillrandom,readrandom --compression_type=lz4 --slow_usecs=100 --histogram=1 ./db_bench --benchmarks=fillrandom,readrandom --compression_type=lz4 --slow_usecs=100000 --histogram=1 Reviewed By: jay-zhuang Differential Revision: D35121522 Pulled By: mdcallag fbshipit-source-id: daf27f937efd748980545d6395db332712fc078b --- tools/db_bench_tool.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/db_bench_tool.cc b/tools/db_bench_tool.cc index 91d32e372..eee9c8ba2 100644 --- a/tools/db_bench_tool.cc +++ b/tools/db_bench_tool.cc @@ -1240,6 +1240,10 @@ DEFINE_int64(stats_interval_seconds, 0, "Report stats every N seconds. This " DEFINE_int32(stats_per_interval, 0, "Reports additional stats per interval when" " this is greater than 0."); +DEFINE_uint64(slow_usecs, 1000000, + "A message is printed for operations that " + "take at least this many microseconds."); + DEFINE_int64(report_interval_seconds, 0, "If greater than zero, it will write simple stats in CSV format " "to --report_file every N seconds"); @@ -2145,7 +2149,7 @@ class Stats { } hist_[op_type]->Add(micros); - if (micros > 20000 && !FLAGS_stats_interval) { + if (micros >= FLAGS_slow_usecs && !FLAGS_stats_interval) { fprintf(stderr, "long op: %" PRIu64 " micros%30s\r", micros, ""); fflush(stderr); }