Introduce postprocess_iteration, a way to do the perf keyvals once
per iteration, rather than all at the end. This results in cleaner,
less buggy code, that doesn't tend to grab the keyval for the profiled
run by mistake
Signed-off-by: Martin Bligh <mbligh@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@2734 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/tests/iozone/iozone.py b/client/tests/iozone/iozone.py
index 1d1f7b0..faba8e3 100644
--- a/client/tests/iozone/iozone.py
+++ b/client/tests/iozone/iozone.py
@@ -35,24 +35,22 @@
args = '-a'
cmd = os.path.join(self.srcdir, 'src', 'current', 'iozone')
- output = utils.system_output('%s %s' % (cmd, args))
-
- auto_mode = ("-a" in args)
- self.__format_results(output, auto_mode)
+ self.results = utils.system_output('%s %s' % (cmd, args))
+ self.auto_mode = ("-a" in args)
def __get_section_name(self, desc):
return desc.strip().replace(' ', '_')
- def __format_results(self, results, auto_mode):
+ def postprocess_iteration(self):
keylist = {}
- if auto_mode:
+ if self.auto_mode:
labels = ('write', 'rewrite', 'read', 'reread', 'randread',
'randwrite', 'bkwdread', 'recordrewrite',
'strideread', 'fwrite', 'frewrite', 'fread', 'freread')
- for line in results.splitlines():
+ for line in self.results.splitlines():
fields = line.split()
if len(fields) != 15:
continue
@@ -75,7 +73,7 @@
section = None
w_count = 0
- for line in results.splitlines():
+ for line in self.results.splitlines():
line = line.strip()
# Check for the beginning of a new result section