From 159928dfa5464a64afbc7137010880962418d477 Mon Sep 17 00:00:00 2001 From: Igor Canadi Date: Wed, 19 Mar 2014 09:58:41 -0700 Subject: [PATCH] Added flag progress_reports in db_stress --- tools/db_crashtest.py | 1 + tools/db_crashtest2.py | 1 + tools/db_stress.cc | 27 ++++++++++++++++----------- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/tools/db_crashtest.py b/tools/db_crashtest.py index 2979a0508..644124d28 100644 --- a/tools/db_crashtest.py +++ b/tools/db_crashtest.py @@ -85,6 +85,7 @@ def main(argv): --open_files=500000 --verify_checksum=1 --sync=0 + --progress_reports=0 --disable_wal=0 --disable_data_sync=1 --target_file_size_base=2097152 diff --git a/tools/db_crashtest2.py b/tools/db_crashtest2.py index 68cc42cf3..3d44d0be4 100644 --- a/tools/db_crashtest2.py +++ b/tools/db_crashtest2.py @@ -99,6 +99,7 @@ def main(argv): --open_files=500000 --verify_checksum=1 --sync=0 + --progress_reports=0 --disable_wal=0 --disable_data_sync=1 --target_file_size_base=2097152 diff --git a/tools/db_stress.cc b/tools/db_stress.cc index f66f272b8..76841e6d1 100644 --- a/tools/db_stress.cc +++ b/tools/db_stress.cc @@ -97,7 +97,10 @@ DEFINE_bool(histogram, false, "Print histogram of operation timings"); DEFINE_bool(destroy_db_initially, true, "Destroys the database dir before start if this is true"); -DEFINE_bool (verbose, false, "Verbose"); +DEFINE_bool(verbose, false, "Verbose"); + +DEFINE_bool(progress_reports, true, + "If true, db_stress will report number of finished operations"); DEFINE_int32(write_buffer_size, rocksdb::Options().write_buffer_size, "Number of bytes to buffer in memtable before compacting"); @@ -444,16 +447,18 @@ class Stats { last_op_finish_ = now; } - done_++; - if (done_ >= next_report_) { - if (next_report_ < 1000) next_report_ += 100; - else if (next_report_ < 5000) next_report_ += 500; - else if (next_report_ < 10000) next_report_ += 1000; - else if (next_report_ < 50000) next_report_ += 5000; - else if (next_report_ < 100000) next_report_ += 10000; - else if (next_report_ < 500000) next_report_ += 50000; - else next_report_ += 100000; - fprintf(stdout, "... finished %ld ops%30s\r", done_, ""); + if (FLAGS_progress_reports) { + done_++; + if (done_ >= next_report_) { + if (next_report_ < 1000) next_report_ += 100; + else if (next_report_ < 5000) next_report_ += 500; + else if (next_report_ < 10000) next_report_ += 1000; + else if (next_report_ < 50000) next_report_ += 5000; + else if (next_report_ < 100000) next_report_ += 10000; + else if (next_report_ < 500000) next_report_ += 50000; + else next_report_ += 100000; + fprintf(stdout, "... finished %ld ops%30s\r", done_, ""); + } } }