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
This commit is contained in:
Mark Callaghan 2022-03-24 13:39:01 -07:00 committed by Facebook GitHub Bot
parent cad809978a
commit 409635cb2a

View File

@ -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);
}