2

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.

The script which starts the monitoring script must be a Bash-script because its should be started with the same script as the Benchmark. How do I do that?

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
John Carr
  • 307
  • 1
  • 12

1 Answers1

1
import os, sys

if "benchmark" not in os.popen('tasklist').read():
    sys.exit()

Checks if a process "benchmark" is in the tasklist and if not closes the python script. Easiest answer I think.

GittingGud
  • 315
  • 2
  • 16