#!/bin/sh
# - message_threads
# - worker_threads
# - runtime
# - sleeptime_us
# - cputime_us

. $LKP_SRC/lib/reproduce-log.sh

cd $BENCHMARK_ROOT/schbench || die "no $BENCHMARK_ROOT/schbench"

: ${worker_threads:=16}
: ${runtime:=300}
: ${sleeptime_us:=30000}
: ${cputime_us:=30000}

# to avoid "core dumped", set message_threads to default 2 if message_threads
# is 0 because message_threads is used as denominator in schbench command.
# please note that 2 is a default value from schbench command, as below:
# schbench usage:
#     -m (--message-threads): number of message threads (def: 2)
#     ...

[ $message_threads -eq 0 ] && message_threads=2

# the source code print the output to stderr, here redirection stderr to stdout
log_cmd ./schbench -m $message_threads -t $worker_threads -r $runtime -s $sleeptime_us -c $cputime_us 2>&1
