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

Unified Diff: components/tracing/experiment/perf_cmp.py

Issue 2711313005: [NOT FOR REVIEW] Tracing performance assessment for task profiler. (Closed)
Patch Set: TracedValue test Created 3 years, 10 months 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 | « components/tracing/experiment/old.args.gn ('k') | components/tracing/experiment/tot.args.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/tracing/experiment/perf_cmp.py
diff --git a/components/tracing/experiment/perf_cmp.py b/components/tracing/experiment/perf_cmp.py
new file mode 100755
index 0000000000000000000000000000000000000000..91d846427c3998cdefecd9eae90992a34c753cbb
--- /dev/null
+++ b/components/tracing/experiment/perf_cmp.py
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+# Copyright (c) 2017 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+
+def read_perf(filename):
+ perf = {}
+ with open(filename, 'r') as f:
+ for line in f.readlines():
+ if not '*RESULT' in line:
+ continue
+ cat = line.split('TraceEventPerfTest.')[1].split('=')[0]
+ val = int(line.split('= ')[1].split(' ms')[0])
+ perf[cat] = val
+ return perf
+
+
+# Excludes 5% interval at the range's ends.
+def noisy_mean(arr):
+ length = len(arr)
+ margin = length / 20
+ arr_sorted = sorted(arr)
+ mean = 0
+ for i in range(margin, length - margin):
+ mean += arr_sorted[i]
+ mean /= length - 2 * margin
+ return mean
+
+
+def main():
+ n_samples = 50
+ perf_keys = list(read_perf('data/tot_1.log').keys())
+ perf_tot = {}
+ perf_old = {}
+ for cat in perf_keys:
+ perf_tot[cat] = []
+ perf_old[cat] = []
+
+ for i in range(1, n_samples + 1):
+ tot = read_perf('data/tot_{0}.log'.format(i))
+ old = read_perf('data/old_{0}.log'.format(i))
+ for cat in perf_keys:
+ perf_tot[cat].append(tot[cat])
+ perf_old[cat].append(old[cat])
+
+ for cat in perf_keys:
+ perf_tot[cat].sort()
+ perf_old[cat].sort()
+
+ print cat
+ print perf_tot[cat]
+ print 'median(tot)=', perf_tot[cat][n_samples / 2]
+ print 'mean(tot)=', noisy_mean(perf_tot[cat])
+ print
+
+ print perf_old[cat]
+ print 'median(old)=', perf_old[cat][n_samples / 2]
+ print 'mean(old)=', noisy_mean(perf_old[cat])
+ print
+ print
+
+
+if __name__ == '__main__':
+ main()
« no previous file with comments | « components/tracing/experiment/old.args.gn ('k') | components/tracing/experiment/tot.args.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698