0

I want to monitor the power that my system needs when i run a Benchmark. When the Benchmark ends the monitoring process should be killed . The monitor script is written in python. How do i do that?

  • your_monitoring_command & m_pid=$!; wait <benchmark_pid>; kill $m_pid – jordanm Apr 26 at 22:44
1

One way would be to use a script to kick off the python power monitoring and the benchmark; when the benchmark process is complete, the script kills off the python process:

#!/bin/sh

# start Python power monitor; sample code!
python -c 'import time; time.sleep(20)' &
m=$!

# start the Benchmark
./benchmark.sh

# Benchmark is done; kill the monitor
kill "$m"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.