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

Side by Side Diff: tracing/tracing/metrics/cpu_process_metric_test.html

Issue 2293533002: Refactor NumericBuilder to HistogramBinBoundaries. (Closed) Base URL: https://github.com/catapult-project/catapult.git@master
Patch Set: rebase Created 4 years, 3 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 2016 The Chromium Authors. All rights reserved. 3 Copyright 2016 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 7
8 <link rel="import" href="/tracing/core/test_utils.html"> 8 <link rel="import" href="/tracing/core/test_utils.html">
9 <link rel="import" href="/tracing/extras/importer/trace_event_importer.html"> 9 <link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
10 <link rel="import" href="/tracing/metrics/cpu_process_metric.html"> 10 <link rel="import" href="/tracing/metrics/cpu_process_metric.html">
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 'pid': 52, 'ts': '2226221225693.658', tid: 53, 49 'pid': 52, 'ts': '2226221225693.658', tid: 53,
50 'tid': undefined, 'ph': 'O', 'local': true, 'id': '0x1000' 50 'tid': undefined, 'ph': 'O', 'local': true, 'id': '0x1000'
51 } 51 }
52 ]; 52 ];
53 tr.metrics.sh.cpuProcessMetric(values, makeModel(events)); 53 tr.metrics.sh.cpuProcessMetric(values, makeModel(events));
54 assert.lengthOf(values.getValuesWithName('cpu:percent:chrome'), 7); 54 assert.lengthOf(values.getValuesWithName('cpu:percent:chrome'), 7);
55 assert.lengthOf(values.getValuesWithName('cpu:percent:crudd'), 7); 55 assert.lengthOf(values.getValuesWithName('cpu:percent:crudd'), 7);
56 var chromeValue = values.getValuesWithName('cpu:percent:chrome')[0]; 56 var chromeValue = values.getValuesWithName('cpu:percent:chrome')[0];
57 var chromeStatistics = chromeValue.numeric.running; 57 var chromeStatistics = chromeValue.numeric.running;
58 assert.strictEqual(chromeStatistics.count, 1); 58 assert.strictEqual(chromeStatistics.count, 1);
59 assert.strictEqual(chromeStatistics.mean, 1.1); 59 assert.closeTo(chromeStatistics.mean, 0.011, 1e-5);
60 assert.strictEqual(chromeStatistics.max, 1.1); 60 assert.closeTo(chromeStatistics.max, 0.011, 1e-5);
61 assert.instanceOf(chromeValue.diagnostics.get('paths'), tr.v.d.Generic); 61 assert.instanceOf(chromeValue.diagnostics.get('paths'), tr.v.d.Generic);
62 assert.lengthOf(chromeValue.diagnostics.get('paths').value, 1); 62 assert.lengthOf(chromeValue.diagnostics.get('paths').value, 1);
63 assert.strictEqual(chromeValue.diagnostics.get('paths').value[0], 63 assert.strictEqual(chromeValue.diagnostics.get('paths').value[0],
64 '/opt/chrome/chrome'); 64 '/opt/chrome/chrome');
65 }); 65 });
66 66
67 test('cpuProcessMetric_multipleSnapshots', function() { 67 test('cpuProcessMetric_multipleSnapshots', function() {
68 var values = new tr.v.ValueSet(); 68 var values = new tr.v.ValueSet();
69 var events = [ 69 var events = [
70 { 70 {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 'tid': undefined, 'ph': 'O', 'local': true, 'id': '0x1000' 102 'tid': undefined, 'ph': 'O', 'local': true, 'id': '0x1000'
103 } 103 }
104 ]; 104 ];
105 tr.metrics.sh.cpuProcessMetric(values, makeModel(events)); 105 tr.metrics.sh.cpuProcessMetric(values, makeModel(events));
106 assert.lengthOf(values.getValuesWithName('cpu:percent:chrome'), 7); 106 assert.lengthOf(values.getValuesWithName('cpu:percent:chrome'), 7);
107 assert.lengthOf(values.getValuesWithName('cpu:percent:crudd'), 7); 107 assert.lengthOf(values.getValuesWithName('cpu:percent:crudd'), 7);
108 assert.lengthOf(values.getValuesWithName('cpu:percent:mnp_logger'), 7); 108 assert.lengthOf(values.getValuesWithName('cpu:percent:mnp_logger'), 7);
109 var chromeValue = values.getValuesWithName('cpu:percent:chrome')[0]; 109 var chromeValue = values.getValuesWithName('cpu:percent:chrome')[0];
110 var chromeStatistics = chromeValue.numeric.running; 110 var chromeStatistics = chromeValue.numeric.running;
111 assert.strictEqual(chromeStatistics.count, 2); 111 assert.strictEqual(chromeStatistics.count, 2);
112 assert.strictEqual(chromeStatistics.mean, 0.75); 112 assert.closeTo(chromeStatistics.mean, 0.0075, 1e-5);
113 assert.strictEqual(chromeStatistics.max, 0.8); 113 assert.strictEqual(chromeStatistics.max, 0.008);
114 assert.instanceOf(chromeValue.diagnostics.get('paths'), tr.v.d.Generic); 114 assert.instanceOf(chromeValue.diagnostics.get('paths'), tr.v.d.Generic);
115 assert.lengthOf(chromeValue.diagnostics.get('paths').value, 2); 115 assert.lengthOf(chromeValue.diagnostics.get('paths').value, 2);
116 assert.strictEqual(chromeValue.diagnostics.get('paths').value[0], 116 assert.strictEqual(chromeValue.diagnostics.get('paths').value[0],
117 '/opt/chrome/chrome'); 117 '/opt/chrome/chrome');
118 118
119 }); 119 });
120 }); 120 });
121 </script> 121 </script>
OLDNEW
« no previous file with comments | « tracing/tracing/metrics/cpu_process_metric.html ('k') | tracing/tracing/metrics/metric_registry_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698