@ -476,6 +476,9 @@ static rocksdb::Env* FLAGS_env = rocksdb::Env::Default();
DEFINE_int64 ( stats_interval , 0 , " Stats are reported every N operations when "
DEFINE_int64 ( stats_interval , 0 , " Stats are reported every N operations when "
" this is greater than zero. When 0 the interval grows over time. " ) ;
" this is greater than zero. When 0 the interval grows over time. " ) ;
DEFINE_int64 ( stats_interval_seconds , 0 , " Report stats every N seconds. This "
" overrides stats_interval when both are > 0. " ) ;
DEFINE_int32 ( stats_per_interval , 0 , " Reports additional stats per interval when "
DEFINE_int32 ( stats_per_interval , 0 , " Reports additional stats per interval when "
" this is greater than 0. " ) ;
" this is greater than 0. " ) ;
@ -992,6 +995,18 @@ class Stats {
fprintf ( stderr , " ... finished % " PRIu64 " ops%30s \r " , done_ , " " ) ;
fprintf ( stderr , " ... finished % " PRIu64 " ops%30s \r " , done_ , " " ) ;
} else {
} else {
double now = FLAGS_env - > NowMicros ( ) ;
double now = FLAGS_env - > NowMicros ( ) ;
int64_t usecs_since_last = now - last_report_finish_ ;
// Determine whether to print status where interval is either
// each N operations or each N seconds.
if ( FLAGS_stats_interval_seconds & &
usecs_since_last < ( FLAGS_stats_interval_seconds * 1000000 ) ) {
// Don't check again for this many operations
next_report_ + = FLAGS_stats_interval ;
} else {
fprintf ( stderr ,
fprintf ( stderr ,
" %s ... thread %d: (% " PRIu64 " ,% " PRIu64 " ) ops and "
" %s ... thread %d: (% " PRIu64 " ,% " PRIu64 " ) ops and "
" (%.1f,%.1f) ops/second in (%.6f,%.6f) seconds \n " ,
" (%.1f,%.1f) ops/second in (%.6f,%.6f) seconds \n " ,
@ -999,7 +1014,7 @@ class Stats {
id_ ,
id_ ,
done_ - last_report_done_ , done_ ,
done_ - last_report_done_ , done_ ,
( done_ - last_report_done_ ) /
( done_ - last_report_done_ ) /
( ( now - last_report_finish_ ) / 1000000.0 ) ,
( usecs_since_last / 1000000.0 ) ,
done_ / ( ( now - start_ ) / 1000000.0 ) ,
done_ / ( ( now - start_ ) / 1000000.0 ) ,
( now - last_report_finish_ ) / 1000000.0 ,
( now - last_report_finish_ ) / 1000000.0 ,
( now - start_ ) / 1000000.0 ) ;
( now - start_ ) / 1000000.0 ) ;
@ -1023,6 +1038,7 @@ class Stats {
last_report_finish_ = now ;
last_report_finish_ = now ;
last_report_done_ = done_ ;
last_report_done_ = done_ ;
}
}
}
if ( id_ = = 0 & & FLAGS_thread_status_per_interval ) {
if ( id_ = = 0 & & FLAGS_thread_status_per_interval ) {
PrintThreadStatus ( ) ;
PrintThreadStatus ( ) ;
}
}
@ -3389,6 +3405,12 @@ int main(int argc, char** argv) {
FLAGS_db = default_db_path ;
FLAGS_db = default_db_path ;
}
}
if ( FLAGS_stats_interval_seconds > 0 ) {
// When both are set then FLAGS_stats_interval determines the frequency
// at which the timer is checked for FLAGS_stats_interval_seconds
FLAGS_stats_interval = 1000 ;
}
rocksdb : : Benchmark benchmark ;
rocksdb : : Benchmark benchmark ;
benchmark . Run ( ) ;
benchmark . Run ( ) ;
return 0 ;
return 0 ;