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

Side by Side Diff: tracing/tracing/base/unittest/test_case.html

Issue 2771723003: [tracing] Move math utilities from base into their own subdirectory (attempt 2) (Closed)
Patch Set: rebase 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
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <!-- 2 <!--
3 Copyright (c) 2014 The Chromium Authors. All rights reserved. 3 Copyright (c) 2014 The Chromium Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style license that can be 4 Use of this source code is governed by a BSD-style license that can be
5 found in the LICENSE file. 5 found in the LICENSE file.
6 --> 6 -->
7 <link rel="import" href="/tracing/base/guid.html"> 7 <link rel="import" href="/tracing/base/guid.html">
8 <link rel="import" href="/tracing/base/unittest/constants.html"> 8 <link rel="import" href="/tracing/base/unittest/constants.html">
9 <script> 9 <script>
10 'use strict'; 10 'use strict';
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 for (var i = 0; i < iterations; ++i) { 109 for (var i = 0; i < iterations; ++i) {
110 var start = window.performance.now(); 110 var start = window.performance.now();
111 this.runOneIteration(); 111 this.runOneIteration();
112 var duration = window.performance.now() - start; 112 var duration = window.performance.now() - start;
113 durations.push(duration); 113 durations.push(duration);
114 } 114 }
115 115
116 var durationStrings = durations.map(function(d) { 116 var durationStrings = durations.map(function(d) {
117 return d.toFixed(2) + 'ms'; 117 return d.toFixed(2) + 'ms';
118 }); 118 });
119 var average = tr.b.Statistics.mean(durations); 119 var average = tr.b.math.Statistics.mean(durations);
120 var min = tr.b.Statistics.min(durations); 120 var min = tr.b.math.Statistics.min(durations);
121 121
122 var summaryString = ' ['; 122 var summaryString = ' [';
123 summaryString += 'min ' + min.toFixed(2) + 'ms, '; 123 summaryString += 'min ' + min.toFixed(2) + 'ms, ';
124 summaryString += 'avg ' + average.toFixed(2) + 'ms'; 124 summaryString += 'avg ' + average.toFixed(2) + 'ms';
125 summaryString += ']'; 125 summaryString += ']';
126 126
127 return durationStrings.join(', ') + summaryString; 127 return durationStrings.join(', ') + summaryString;
128 }, 128 },
129 129
130 runOneIteration: function() { 130 runOneIteration: function() {
131 this.testFn_(); 131 this.testFn_();
132 } 132 }
133 }; 133 };
134 134
135 return { 135 return {
136 TestCase, 136 TestCase,
137 PerfTestCase, 137 PerfTestCase,
138 }; 138 };
139 }); 139 });
140 </script> 140 </script>
OLDNEW
« no previous file with comments | « tracing/tracing/base/statistics_test.html ('k') | tracing/tracing/base/unittest/test_suite.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698