Add iostat as a profiler
Signed-off-by: Martin J. Bligh <mbligh@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@480 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/profilers/iostat/control b/client/profilers/iostat/control
new file mode 100644
index 0000000..70e5fdc
--- /dev/null
+++ b/client/profilers/iostat/control
@@ -0,0 +1,3 @@
+job.profilers.add('iostat', 2)
+job.run_test('sleeptest', 5)
+job.profilers.delete('iostat')
diff --git a/client/profilers/iostat/iostat.py b/client/profilers/iostat/iostat.py
new file mode 100755
index 0000000..8e0d650
--- /dev/null
+++ b/client/profilers/iostat/iostat.py
@@ -0,0 +1,26 @@
+# sets up a subprocess to cat a file on a specified interval
+# really, really ought to autoswitch on a list of files or individual file
+import profiler,time,os,subprocess
+
+class iostat(profiler.profiler):
+ version = 1
+
+ def initialize(self, interval = 1):
+ self.interval = interval
+
+
+ def start(self, test):
+ cmd = "/usr/bin/iostat %d" % self.interval
+ logfile = open(os.path.join(test.profdir, "iostat"), 'w')
+ p = subprocess.Popen(cmd, shell=True, stdout=logfile, \
+ stderr=subprocess.STDOUT)
+ self.pid = p.pid
+
+
+ def stop(self, test):
+ os.kill(self.pid, 15)
+
+
+ def report(self, test):
+ return None
+