Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Unified Diff: client/tests/tracing_microbenchmark/tracing_microbenchmark.py

Issue 4823005: Merge remote branch 'cros/upstream' into tempbranch (Closed) Base URL: http://git.chromium.org/git/autotest.git@master
Patch Set: patch Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « client/tests/tracing_microbenchmark/tracers.py ('k') | client/tools/boottool » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/tests/tracing_microbenchmark/tracing_microbenchmark.py
diff --git a/client/tests/tracing_microbenchmark/tracing_microbenchmark.py b/client/tests/tracing_microbenchmark/tracing_microbenchmark.py
new file mode 100644
index 0000000000000000000000000000000000000000..2d7af6d8252d60e696e0069cac70fd2bb78ef0a7
--- /dev/null
+++ b/client/tests/tracing_microbenchmark/tracing_microbenchmark.py
@@ -0,0 +1,50 @@
+import os
+import re
+from autotest_lib.client.bin import test
+from autotest_lib.client.bin import utils
+
+import tracers
+import base_tracer
+
+class tracing_microbenchmark(test.test):
+ version = 1
+ preserve_srcdir = True
+
+ def setup(self):
+ os.chdir(self.srcdir)
+ utils.system('make CROSS_COMPILE=""')
+
+ def initialize(self, tracer='ftrace', calls=100000, **kwargs):
+ self.job.require_gcc()
+ tracer_class = getattr(tracers, tracer)
+ if not issubclass(tracer_class, base_tracer.Tracer):
+ raise TypeError
+ self.tracer = tracer_class()
+
+ getuid_microbench = os.path.join(self.srcdir, 'getuid_microbench')
+ self.cmd = '%s %d' % (getuid_microbench, calls)
+
+ def warmup(self, buffer_size_kb=8000, **kwargs):
+ self.tracer.warmup(buffer_size_kb)
+
+ def cleanup(self):
+ self.tracer.cleanup()
+
+ def run_once(self, **kwargs):
+ self.results = {}
+
+ self.tracer.start_tracing()
+ self.cmd_result = utils.run(self.cmd)
+ self.tracer.stop_tracing()
+
+ self.tracer.gather_stats(self.results)
+ self.tracer.reset_tracing()
+
+ def postprocess_iteration(self):
+ result_re = re.compile(r'(?P<calls>\d+) calls '
+ r'in (?P<time>\d+\.\d+) s '
+ '\((?P<ns_per_call>\d+\.\d+) ns/call\)')
+ match = result_re.match(self.cmd_result.stdout)
+ self.results.update(match.groupdict())
+
+ self.write_perf_keyval(self.results)
« no previous file with comments | « client/tests/tracing_microbenchmark/tracers.py ('k') | client/tools/boottool » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698