mirror of https://github.com/facebook/rocksdb.git
Report cpu usage using time command
Summary: Run the time command before regression tests, parse the output, and add the numbers to the report. Closes https://github.com/facebook/rocksdb/pull/2101 Differential Revision: D4862781 Pulled By: maysamyabandeh fbshipit-source-id: 4a81caa5d14187d67093aad154c8f0ad56aba901
This commit is contained in:
parent
20778f2f92
commit
97ec8a1349
|
@ -96,13 +96,15 @@
|
||||||
TITLE_FORMAT="%40s,%25s,%30s,%7s,%9s,%8s,"
|
TITLE_FORMAT="%40s,%25s,%30s,%7s,%9s,%8s,"
|
||||||
TITLE_FORMAT+="%10s,%13s,%14s,%11s,%12s,"
|
TITLE_FORMAT+="%10s,%13s,%14s,%11s,%12s,"
|
||||||
TITLE_FORMAT+="%7s,%11s,"
|
TITLE_FORMAT+="%7s,%11s,"
|
||||||
TITLE_FORMAT+="%9s,%10s,%10s,%10s,%10s,%10s,%5s"
|
TITLE_FORMAT+="%9s,%10s,%10s,%10s,%10s,%10s,%5s,"
|
||||||
|
TITLE_FORMAT+="%5s,%5s,%5s" # time
|
||||||
TITLE_FORMAT+="\n"
|
TITLE_FORMAT+="\n"
|
||||||
|
|
||||||
DATA_FORMAT="%40s,%25s,%30s,%7s,%9s,%8s,"
|
DATA_FORMAT="%40s,%25s,%30s,%7s,%9s,%8s,"
|
||||||
DATA_FORMAT+="%10s,%13.0f,%14s,%11s,%12s,"
|
DATA_FORMAT+="%10s,%13.0f,%14s,%11s,%12s,"
|
||||||
DATA_FORMAT+="%7s,%11s,"
|
DATA_FORMAT+="%7s,%11s,"
|
||||||
DATA_FORMAT+="%9.0f,%10.0f,%10.0f,%10.0f,%10.0f,%10.0f,%5.0f"
|
DATA_FORMAT+="%9.0f,%10.0f,%10.0f,%10.0f,%10.0f,%10.0f,%5.0f,"
|
||||||
|
DATA_FORMAT+="%5.0f,%5.0f,%5.0f" # time
|
||||||
DATA_FORMAT+="\n"
|
DATA_FORMAT+="\n"
|
||||||
|
|
||||||
MAIN_PATTERN="$1""[[:blank:]]+:.*[[:blank:]]+([0-9\.]+)[[:blank:]]+ops/sec"
|
MAIN_PATTERN="$1""[[:blank:]]+:.*[[:blank:]]+([0-9\.]+)[[:blank:]]+ops/sec"
|
||||||
|
@ -211,7 +213,8 @@ function run_db_bench {
|
||||||
db_bench_error=0
|
db_bench_error=0
|
||||||
options_file_arg=$(setup_options_file)
|
options_file_arg=$(setup_options_file)
|
||||||
echo "$options_file_arg"
|
echo "$options_file_arg"
|
||||||
db_bench_cmd="$DB_BENCH_DIR/db_bench \
|
# use `which time` to avoid using bash's internal time command
|
||||||
|
db_bench_cmd="(`which time` -p $DB_BENCH_DIR/db_bench \
|
||||||
--benchmarks=$1 --db=$DB_PATH --wal_dir=$WAL_PATH \
|
--benchmarks=$1 --db=$DB_PATH --wal_dir=$WAL_PATH \
|
||||||
--use_existing_db=$USE_EXISTING_DB \
|
--use_existing_db=$USE_EXISTING_DB \
|
||||||
--disable_auto_compactions \
|
--disable_auto_compactions \
|
||||||
|
@ -233,11 +236,11 @@ function run_db_bench {
|
||||||
--max_background_flushes=$MAX_BACKGROUND_FLUSHES \
|
--max_background_flushes=$MAX_BACKGROUND_FLUSHES \
|
||||||
--num_multi_db=$NUM_MULTI_DB \
|
--num_multi_db=$NUM_MULTI_DB \
|
||||||
--max_background_compactions=$MAX_BACKGROUND_COMPACTIONS \
|
--max_background_compactions=$MAX_BACKGROUND_COMPACTIONS \
|
||||||
--seed=$SEED 2>&1"
|
--seed=$SEED) 2>&1"
|
||||||
ps_cmd="ps aux"
|
ps_cmd="ps aux"
|
||||||
if ! [ -z "$REMOTE_USER_AT_HOST" ]; then
|
if ! [ -z "$REMOTE_USER_AT_HOST" ]; then
|
||||||
echo "Running benchmark remotely on $REMOTE_USER_AT_HOST"
|
echo "Running benchmark remotely on $REMOTE_USER_AT_HOST"
|
||||||
db_bench_cmd="$SSH $REMOTE_USER_AT_HOST $db_bench_cmd"
|
db_bench_cmd="$SSH $REMOTE_USER_AT_HOST \"$db_bench_cmd\""
|
||||||
ps_cmd="$SSH $REMOTE_USER_AT_HOST $ps_cmd"
|
ps_cmd="$SSH $REMOTE_USER_AT_HOST $ps_cmd"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -306,6 +309,11 @@ function update_report {
|
||||||
perc[3]=${BASH_REMATCH[4]} # p99.9
|
perc[3]=${BASH_REMATCH[4]} # p99.9
|
||||||
perc[4]=${BASH_REMATCH[5]} # p99.99
|
perc[4]=${BASH_REMATCH[5]} # p99.99
|
||||||
|
|
||||||
|
# Parse the output of the time command
|
||||||
|
real_sec=`tail -3 $2 | grep real | awk '{print $2}'`
|
||||||
|
user_sec=`tail -3 $2 | grep user | awk '{print $2}'`
|
||||||
|
sys_sec=`tail -3 $2 | grep sys | awk '{print $2}'`
|
||||||
|
|
||||||
(printf "$DATA_FORMAT" \
|
(printf "$DATA_FORMAT" \
|
||||||
$COMMIT_ID $1 $REMOTE_USER_AT_HOST $NUM_MULTI_DB $NUM_KEYS $KEY_SIZE $VALUE_SIZE \
|
$COMMIT_ID $1 $REMOTE_USER_AT_HOST $NUM_MULTI_DB $NUM_KEYS $KEY_SIZE $VALUE_SIZE \
|
||||||
$(multiply $COMPRESSION_RATIO 100) \
|
$(multiply $COMPRESSION_RATIO 100) \
|
||||||
|
@ -318,6 +326,9 @@ function update_report {
|
||||||
$(multiply ${perc[3]} 1000) \
|
$(multiply ${perc[3]} 1000) \
|
||||||
$(multiply ${perc[4]} 1000) \
|
$(multiply ${perc[4]} 1000) \
|
||||||
$DEBUG \
|
$DEBUG \
|
||||||
|
$real_sec \
|
||||||
|
$user_sec \
|
||||||
|
$sys_sec \
|
||||||
>> $SUMMARY_FILE)
|
>> $SUMMARY_FILE)
|
||||||
exit_on_error $?
|
exit_on_error $?
|
||||||
}
|
}
|
||||||
|
@ -416,6 +427,7 @@ function setup_test_directory {
|
||||||
"value-size" "compress-rate" "ops-per-thread" "num-threads" "cache-size" \
|
"value-size" "compress-rate" "ops-per-thread" "num-threads" "cache-size" \
|
||||||
"flushes" "compactions" \
|
"flushes" "compactions" \
|
||||||
"ops-per-s" "p50" "p75" "p99" "p99.9" "p99.99" "debug" \
|
"ops-per-s" "p50" "p75" "p99" "p99.9" "p99.99" "debug" \
|
||||||
|
"real-sec" "user-sec" "sys-sec" \
|
||||||
>> $SUMMARY_FILE)
|
>> $SUMMARY_FILE)
|
||||||
exit_on_error $?
|
exit_on_error $?
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue