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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « client/tests/tracing_microbenchmark/tracers.py ('k') | client/tools/boottool » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 import os
2 import re
3 from autotest_lib.client.bin import test
4 from autotest_lib.client.bin import utils
5
6 import tracers
7 import base_tracer
8
9 class tracing_microbenchmark(test.test):
10 version = 1
11 preserve_srcdir = True
12
13 def setup(self):
14 os.chdir(self.srcdir)
15 utils.system('make CROSS_COMPILE=""')
16
17 def initialize(self, tracer='ftrace', calls=100000, **kwargs):
18 self.job.require_gcc()
19 tracer_class = getattr(tracers, tracer)
20 if not issubclass(tracer_class, base_tracer.Tracer):
21 raise TypeError
22 self.tracer = tracer_class()
23
24 getuid_microbench = os.path.join(self.srcdir, 'getuid_microbench')
25 self.cmd = '%s %d' % (getuid_microbench, calls)
26
27 def warmup(self, buffer_size_kb=8000, **kwargs):
28 self.tracer.warmup(buffer_size_kb)
29
30 def cleanup(self):
31 self.tracer.cleanup()
32
33 def run_once(self, **kwargs):
34 self.results = {}
35
36 self.tracer.start_tracing()
37 self.cmd_result = utils.run(self.cmd)
38 self.tracer.stop_tracing()
39
40 self.tracer.gather_stats(self.results)
41 self.tracer.reset_tracing()
42
43 def postprocess_iteration(self):
44 result_re = re.compile(r'(?P<calls>\d+) calls '
45 r'in (?P<time>\d+\.\d+) s '
46 '\((?P<ns_per_call>\d+\.\d+) ns/call\)')
47 match = result_re.match(self.cmd_result.stdout)
48 self.results.update(match.groupdict())
49
50 self.write_perf_keyval(self.results)
OLDNEW
« 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