Moved to_seconds, extract_all_time_results to autotest_utils.py for reuse
    
Signed-off-by: Ryan Stutsman <stutsman@google.com>
    
Patch comes as a request from mbligh.  This simply moves to_seconds and
the time results extraction to autotest_utils.py and adds a small bit of
documentation.




git-svn-id: http://test.kernel.org/svn/autotest/trunk@582 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/tests/kernbench/kernbench.py b/client/tests/kernbench/kernbench.py
index 543d6c6..746163d 100755
--- a/client/tests/kernbench/kernbench.py
+++ b/client/tests/kernbench/kernbench.py
@@ -2,14 +2,6 @@
 from autotest_utils import *
 import re
 
-
-def to_seconds(time_string):
-	elts = time_string.split(':')
-	if len(elts) == 1:
-		return time_string
-	return str(int(elts[0]) * 60 + float(elts[1]))
-
-
 class kernbench(test.test):
 	version = 1
 
@@ -72,8 +64,6 @@
 
 	def __format_results(self, results):
 		out = open('keyval', 'w')
-		pattern = re.compile(r"(.*?)user (.*?)system (.*?)elapsed")
-		for result in pattern.findall(results):
-			result = tuple([to_seconds(elt) for elt in result])
+		for result in extract_all_time_results(results):
 			print >> out, "user=%s\nsystem=%s\nelapsed=%s\n" % result
 		out.close()