diff --git a/tools/benchmark.sh b/tools/benchmark.sh index a9e093776..105d6f83e 100755 --- a/tools/benchmark.sh +++ b/tools/benchmark.sh @@ -390,7 +390,7 @@ params_univ_compact="$const_params \ --level0_slowdown_writes_trigger=16 \ --level0_stop_writes_trigger=20" -tsv_header="ops_sec\tmb_sec\tlsm_sz\tblob_sz\tc_wgb\tw_amp\tc_mbps\tc_wsecs\tc_csecs\tb_rgb\tb_wgb\tusec_op\tp50\tp99\tp99.9\tp99.99\tpmax\tuptime\tstall%\tNstall\tu_cpu\ts_cpu\trss\ttest\tdate\tversion\tjob_id" +tsv_header="ops_sec\tmb_sec\tlsm_sz\tblob_sz\tc_wgb\tw_amp\tc_mbps\tc_wsecs\tc_csecs\tb_rgb\tb_wgb\tusec_op\tp50\tp99\tp99.9\tp99.99\tpmax\tuptime\tstall%\tNstall\tu_cpu\ts_cpu\trss\ttest\tdate\tversion\tjob_id\tgithash" function get_cmd() { output=$1 @@ -493,11 +493,15 @@ function summarize_result { test_name=$2 bench_name=$3 + # In recent versions these can be found directly via db_bench --version, --build_info but + # grepping from the log lets this work on older versions. + version="$( grep "RocksDB version:" "$DB_DIR"/LOG | head -1 | awk '{ printf "%s", $5 }' )" + git_hash="$( grep "Git sha" "$DB_DIR"/LOG | head -1 | awk '{ printf "%s", substr($5, 1, 10) }' )" + # Note that this function assumes that the benchmark executes long enough so # that "Compaction Stats" is written to stdout at least once. If it won't # happen then empty output from grep when searching for "Sum" will cause # syntax errors. - version=$( grep ^RocksDB: $test_out | awk '{ print $3 }' ) date=$( grep ^Date: $test_out | awk '{ print $6 "-" $3 "-" $4 "T" $5 }' ) my_date=$( month_to_num $date ) uptime=$( grep ^Uptime\(secs $test_out | tail -1 | awk '{ printf "%.0f", $2 }' ) @@ -595,10 +599,11 @@ function summarize_result { echo -e "# date - Date/time of test" >> $report echo -e "# version - RocksDB version" >> $report echo -e "# job_id - User-provided job ID" >> $report + echo -e "# githash - git hash at which db_bench was compiled" echo -e $tsv_header >> $report fi - echo -e "$ops_sec\t$mb_sec\t$lsm_size\t$blob_size\t$sum_wgb\t$wamp\t$cmb_ps\t$c_wsecs\t$c_csecs\t$b_rgb\t$b_wgb\t$usecs_op\t$p50\t$p99\t$p999\t$p9999\t$pmax\t$uptime\t$stall_pct\t$nstall\t$u_cpu\t$s_cpu\t$rss\t$test_name\t$my_date\t$version\t$job_id" \ + echo -e "$ops_sec\t$mb_sec\t$lsm_size\t$blob_size\t$sum_wgb\t$wamp\t$cmb_ps\t$c_wsecs\t$c_csecs\t$b_rgb\t$b_wgb\t$usecs_op\t$p50\t$p99\t$p999\t$p9999\t$pmax\t$uptime\t$stall_pct\t$nstall\t$u_cpu\t$s_cpu\t$rss\t$test_name\t$my_date\t$version\t$job_id\t$git_hash" \ >> $report }