add compilebench

From: curtw@google.com
Signed-off-by: Martin J. Bligh <mbligh@google.com>



git-svn-id: http://test.kernel.org/svn/autotest/trunk@2593 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/tests/compilebench/compilebench-0.6.tar.gz b/client/tests/compilebench/compilebench-0.6.tar.gz
new file mode 100644
index 0000000..ed7c549
--- /dev/null
+++ b/client/tests/compilebench/compilebench-0.6.tar.gz
Binary files differ
diff --git a/client/tests/compilebench/compilebench.py b/client/tests/compilebench/compilebench.py
new file mode 100755
index 0000000..7fb3e8a
--- /dev/null
+++ b/client/tests/compilebench/compilebench.py
@@ -0,0 +1,75 @@
+import os
+import re
+from autotest_lib.client.bin import test, utils
+
+test_name = 'compilebench'
+
+class compilebench(test.test):
+    version = 1
+
+    def setup(self, tarball = 'compilebench-0.6.tar.gz'):
+        self.tarball = utils.unmap_url(self.bindir, tarball, self.tmpdir)
+        utils.extract_tarball_to_dir(self.tarball, self.srcdir)
+
+
+    def run_once(self, dir=None, num_kernel_trees=10, num_random_runs=30):
+        if not dir:
+            dir = self.tmpdir
+
+        cmd = "%s -D %s -s %s -i %d -r %d" % (
+                         os.path.join(self.srcdir, test_name),
+                         dir,
+                         self.srcdir,
+                         num_kernel_trees,
+                         num_random_runs)
+
+        print "Executing: %s" % cmd
+        output = utils.system_output(cmd)
+
+        self.__format_results(output)
+
+
+    def __format_results(self, output):
+        keylist = {}
+
+        THROUGHPUT = "MB_s"
+        TIME       = "secs"
+
+        run_type_list = (
+            ('intial create', THROUGHPUT, 6, 'initial_create'),
+            ('create', THROUGHPUT, 5, 'new_create'),
+            ('patch', THROUGHPUT, 5, 'patch'),
+            ('compile', THROUGHPUT, 5, 'compile'),
+            ('clean', THROUGHPUT, 5, 'clean'),
+            ('read tree', THROUGHPUT, 6, 'read_tree'),
+            ('read compiled tree', THROUGHPUT, 7, 'read_compiled_tree'),
+            ('delete tree', TIME, 6, 'delete_tree'),
+            ('delete compiled tree', TIME, 6, 'delete_compiled_tree'),
+            ('stat tree', TIME, 6, 'stat_tree'),
+            ('stat compiled tree', TIME, 7, 'stat_compiled_tree'),
+        )
+
+# intial create total runs 10 avg 149.82 MB/s (user 0.63s sys 0.85s)
+# create total runs 5 avg 27.50 MB/s (user 0.62s sys 0.83s)
+# patch total runs 4 avg 15.01 MB/s (user 0.33s sys 0.63s)
+# compile total runs 7 avg 41.47 MB/s (user 0.14s sys 0.75s)
+# clean total runs 4 avg 697.77 MB/s (user 0.02s sys 0.08s)
+# read tree total runs 2 avg 23.68 MB/s (user 0.85s sys 1.59s)
+# read compiled tree total runs 1 avg 25.27 MB/s (user 0.98s sys 2.84s)
+# delete tree total runs 2 avg 1.48 seconds (user 0.35s sys 0.45s)
+# no runs for delete compiled tree
+# stat tree total runs 4 avg 1.46 seconds (user 0.35s sys 0.26s)
+# stat compiled tree total runs 1 avg 1.49 seconds (user 0.37s sys 0.29s)
+
+        for line in output.splitlines():
+            for pattern, result_type, position, tag in run_type_list:
+                if re.search('^%s' % pattern, line):
+                    l = line.split()
+                    value = l[position]
+
+                    s = "%s_%s" % (tag, result_type)
+
+                    keylist[s] = value
+                    break
+
+        self.write_perf_keyval(keylist)
diff --git a/client/tests/compilebench/control b/client/tests/compilebench/control
new file mode 100644
index 0000000..813c3b4
--- /dev/null
+++ b/client/tests/compilebench/control
@@ -0,0 +1,13 @@
+AUTHOR = "Curt Wohlgemuth <curtw@google.com>"
+NAME = "compilebench"
+TEST_CATEGORY = "Functional"
+TEST_CLASS = "General"
+TEST_TYPE = "client"
+TIME = "SHORT"
+DOC="""
+Compilebench is a filesystem performance test.  It simulates some of the disk
+IO common in creating, compiling, patching, stating and reading kernel trees.
+It indirectly measures how well filesystems can maintain directory locality as
+the disk fills up and directories age.
+"""
+job.run_test("compilebench")