Home | History | Annotate | Download | only in mpstat
      1 """
      2 Sets up a subprocess to run mpstat on a specified interval, default 1 second
      3 """
      4 import time, os, subprocess
      5 from autotest_lib.client.bin import profiler
      6 
      7 
      8 class mpstat(profiler.profiler):
      9     version = 1
     10 
     11 
     12     def initialize(self, interval = 1):
     13         self.interval = interval
     14 
     15 
     16     def start(self, test):
     17         cmd = "mpstat -P ALL %d" % self.interval
     18         logfile = open(os.path.join(test.profdir, "mpstat"), 'w')
     19         p = subprocess.Popen(cmd, shell=True, stdout=logfile,
     20                                         stderr=subprocess.STDOUT)
     21         self.pid = p.pid
     22 
     23 
     24     def stop(self, test):
     25         os.kill(self.pid, 15)
     26 
     27 
     28     def report(self, test):
     29         return None
     30