Source code for autotest.client.profilers.mpstat.mpstat

"""
Sets up a subprocess to run mpstat on a specified interval, default 1 second
"""
import os
import subprocess

from autotest.client import profiler


[docs]class mpstat(profiler.profiler): version = 1
[docs] def initialize(self, interval=1, **dargs): self.interval = interval
[docs] def start(self, test): cmd = "mpstat -P ALL %d" % self.interval logfile = open(os.path.join(test.profdir, "mpstat"), 'w') p = subprocess.Popen(cmd, shell=True, stdout=logfile, stderr=subprocess.STDOUT) self.pid = p.pid
[docs] def stop(self, test): os.kill(self.pid, 15)
[docs] def report(self, test): return None