I'm trying to do the following (on a Raspberry Pi 3 with Raspbian OS):
sysbench
)iostat
and mpstat
) after some delay, say 5s, as a warm-up intervalSo I made the following base script:
#!/bin/bash
for x in 16000 32000 64000 128000
do
echo "max-prime = $x"
(sysbench --test=cpu --cpu-max-prime=$x --num-threads=4 run >> results.out) & (sleep 5s && mpstat >> mpstat.out & iostat >> iostat.out)
done
I tried some more variations of the 5th line above but sysbench
was not being executed properly (I think because of sleep
?). The output written in results.out
is only this, repeated 4 times because of the loop:
sysbench 0.4.12: multi-threaded system evaluation benchmark
Running the test with following options:
Number of threads: 4
Doing CPU performance benchmark
Threads started!
How do I execute sysbench
and run the monitoring tools after 5 seconds, without compromising sysbench
?
You'll have an easier time of it if you put the commands on separate lines.
for x in 16000 32000 64000 128000
do
echo "num of threads = $x"
sysbench --test=cpu --cpu-max-prime=$x --num-threads=4 run >> results.out &
sleep 5s
mpstat >> mpstat.out
iostat >> iostat.out
done
You'll want to wait until the benchmark finishes before going to the next loop. I recommend putting either wait
or kill %%
at the end of the loop to either wait for or stop it.