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

Unified Diff: tools/process_perf_combined.py

Issue 8439032: Add option to command tester for running a test multiple times. Use that (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: xxx Created 9 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
Index: tools/process_perf_combined.py
===================================================================
--- tools/process_perf_combined.py (revision 0)
+++ tools/process_perf_combined.py (revision 0)
@@ -0,0 +1,45 @@
+#!/usr/bin/python
+# Copyright (c) 2011 The Native Client Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import re
+import sys
+
+# Combine chromium-style perf log output from multiple runs.
+# Input is text *containing* the chrome buildbot perf format (may contain more)
+# but the output is only the merged perf data (throws away the rest).
+
+ACCUMULATED_TIMES = dict()
Nick Bray 2011/11/07 23:39:09 {} preferred to dict(), but really - I'd rather se
jvoung - send to chromium... 2011/11/09 00:50:54 oops, done.
+
+RESULT_MATCHER = re.compile(r'^RESULT (.*): (.*)= (.*) (.*)$')
+
+def list_to_string(l):
Nick Bray 2011/11/07 23:39:09 CammelCase
jvoung - send to chromium... 2011/11/09 00:50:54 Done.
+ return '[%s]' % (','.join(l))
+
Nick Bray 2011/11/07 23:39:09 Two lines between functions
jvoung - send to chromium... 2011/11/09 00:50:54 Done.
+def Main():
+ usage = 'usage: %prog < stdin\n'
+ if len(sys.argv) != 1:
+ sys.stderr.write(usage)
+ sys.stderr.write('Instead, argv was %s\n' % str(sys.argv))
+ return 1
+ for line in sys.stdin.readlines():
+ match = RESULT_MATCHER.match(line)
+ if match:
+ graph, trace, value, unit = match.groups()
+ key = (graph, trace)
+ value_list, old_unit = ACCUMULATED_TIMES.get(key, ([], None))
+ if old_unit is not None:
+ assert(unit == old_unit)
+ if type(value) == list:
+ value_list += value
+ else:
+ value_list += [value]
+ ACCUMULATED_TIMES[key] = (value_list, unit)
+ for ((graph, trace), (values, unit)) in ACCUMULATED_TIMES.iteritems():
+ sys.stdout.write('RESULT %s: %s= %s %s\n' %
+ (graph, trace, list_to_string(values), unit))
+ return 0
+
+if __name__ == '__main__':
+ sys.exit(Main())
Property changes on: tools/process_perf_combined.py
___________________________________________________________________
Added: svn:eol-style
+ LF
« tools/command_tester.py ('K') | « tools/command_tester.py ('k') | tools/test_lib.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698