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?
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"