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

Side by Side Diff: tracing/tracing/model/ir_coverage_test.html

Issue 2162963002: [polymer] Merge of master into polymer10-migration (Closed) Base URL: git@github.com:catapult-project/catapult.git@polymer10-migration
Patch Set: Merge polymer10-migration int polymer10-merge Created 4 years, 5 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 | « tracing/tracing/model/ir_coverage.html ('k') | tracing/tracing/model/kernel.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <!-- 2 <!--
3 Copyright (c) 2015 The Chromium Authors. All rights reserved. 3 Copyright (c) 2015 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/model/ir_coverage.html"> 9 <link rel="import" href="/tracing/model/ir_coverage.html">
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 ir.associatedEvents.push(as1); 51 ir.associatedEvents.push(as1);
52 ir.associatedEvents.push(s0); 52 ir.associatedEvents.push(s0);
53 ir.associatedEvents.push(s2); 53 ir.associatedEvents.push(s2);
54 ir.associatedEvents.push(f0); 54 ir.associatedEvents.push(f0);
55 model.userModel.expectations.push(ir); 55 model.userModel.expectations.push(ir);
56 }); 56 });
57 } 57 }
58 58
59 test('computeCoverage', function() { 59 test('computeCoverage', function() {
60 var model = createModel(); 60 var model = createModel();
61 model.iterateAllEvents(function(event) { 61 for (var event of model.getDescendantEvents()) {
62 if (event.title === 's0' || event.title === 's2') { 62 if (event.title === 's0' || event.title === 's2') {
63 event.cpuSelfTime = 0.4; 63 event.cpuSelfTime = 0.4;
64 } else if (event.title === 's1') { 64 } else if (event.title === 's1') {
65 event.cpuSelfTime = 0.8; 65 event.cpuSelfTime = 0.8;
66 } 66 }
67 }); 67 }
68 68
69 var coverage = tr.model.getIRCoverageFromModel(model); 69 var coverage = tr.model.getIRCoverageFromModel(model);
70 assert.equal(3, coverage.associatedEventsCount); 70 assert.equal(3, coverage.associatedEventsCount);
71 assert.equal(1, coverage.unassociatedEventsCount); 71 assert.equal(1, coverage.unassociatedEventsCount);
72 assert.closeTo(0.75, coverage.coveredEventsCountRatio, 1e-3); 72 assert.closeTo(0.75, coverage.coveredEventsCountRatio, 1e-3);
73 assert.closeTo(0.8, coverage.associatedEventsCpuTimeMs, 1e-3); 73 assert.closeTo(0.8, coverage.associatedEventsCpuTimeMs, 1e-3);
74 assert.closeTo(0.8, coverage.unassociatedEventsCpuTimeMs, 1e-3); 74 assert.closeTo(0.8, coverage.unassociatedEventsCpuTimeMs, 1e-3);
75 assert.closeTo(0.5, coverage.coveredEventsCpuTimeRatio, 1e-3); 75 assert.closeTo(0.5, coverage.coveredEventsCpuTimeRatio, 1e-3);
76 }); 76 });
77 77
78 test('zeroCPU', function() { 78 test('zeroCPU', function() {
79 var model = createModel(); 79 var model = createModel();
80 var coverage = tr.model.getIRCoverageFromModel(model); 80 var coverage = tr.model.getIRCoverageFromModel(model);
81 assert.equal(3, coverage.associatedEventsCount); 81 assert.equal(3, coverage.associatedEventsCount);
82 assert.equal(1, coverage.unassociatedEventsCount); 82 assert.equal(1, coverage.unassociatedEventsCount);
83 assert.closeTo(0.75, coverage.coveredEventsCountRatio, 1e-3); 83 assert.closeTo(0.75, coverage.coveredEventsCountRatio, 1e-3);
84 assert.closeTo(0.0, coverage.associatedEventsCpuTimeMs, 1e-3); 84 assert.closeTo(0.0, coverage.associatedEventsCpuTimeMs, 1e-3);
85 assert.closeTo(0.0, coverage.unassociatedEventsCpuTimeMs, 1e-3); 85 assert.closeTo(0.0, coverage.unassociatedEventsCpuTimeMs, 1e-3);
86 assert.equal(undefined, coverage.coveredEventsCpuTimeRatio, 1e-3); 86 assert.equal(undefined, coverage.coveredEventsCpuTimeRatio, 1e-3);
87 }); 87 });
88 }); 88 });
89 </script> 89 </script>
90 90
OLDNEW
« no previous file with comments | « tracing/tracing/model/ir_coverage.html ('k') | tracing/tracing/model/kernel.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698