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

Side by Side 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, 9 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright (c) 2017 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6
7 def read_perf(filename):
8 perf = {}
9 with open(filename, 'r') as f:
10 for line in f.readlines():
11 if not '*RESULT' in line:
12 continue
13 cat = line.split('TraceEventPerfTest.')[1].split('=')[0]
14 val = int(line.split('= ')[1].split(' ms')[0])
15 perf[cat] = val
16 return perf
17
18
19 # Excludes 5% interval at the range's ends.
20 def noisy_mean(arr):
21 length = len(arr)
22 margin = length / 20
23 arr_sorted = sorted(arr)
24 mean = 0
25 for i in range(margin, length - margin):
26 mean += arr_sorted[i]
27 mean /= length - 2 * margin
28 return mean
29
30
31 def main():
32 n_samples = 50
33 perf_keys = list(read_perf('data/tot_1.log').keys())
34 perf_tot = {}
35 perf_old = {}
36 for cat in perf_keys:
37 perf_tot[cat] = []
38 perf_old[cat] = []
39
40 for i in range(1, n_samples + 1):
41 tot = read_perf('data/tot_{0}.log'.format(i))
42 old = read_perf('data/old_{0}.log'.format(i))
43 for cat in perf_keys:
44 perf_tot[cat].append(tot[cat])
45 perf_old[cat].append(old[cat])
46
47 for cat in perf_keys:
48 perf_tot[cat].sort()
49 perf_old[cat].sort()
50
51 print cat
52 print perf_tot[cat]
53 print 'median(tot)=', perf_tot[cat][n_samples / 2]
54 print 'mean(tot)=', noisy_mean(perf_tot[cat])
55 print
56
57 print perf_old[cat]
58 print 'median(old)=', perf_old[cat][n_samples / 2]
59 print 'mean(old)=', noisy_mean(perf_old[cat])
60 print
61 print
62
63
64 if __name__ == '__main__':
65 main()
OLDNEW
« 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