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

Side by Side Diff: tracing/tracing/importer/user_model_builder.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) 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/base/base.html"> 8 <link rel="import" href="/tracing/base/base.html">
9 <link rel="import" href="/tracing/base/range_utils.html"> 9 <link rel="import" href="/tracing/base/math/range_utils.html">
10 <link rel="import" href="/tracing/core/auditor.html"> 10 <link rel="import" href="/tracing/core/auditor.html">
11 <link rel="import" href="/tracing/extras/chrome/cc/input_latency_async_slice.htm l"> 11 <link rel="import" href="/tracing/extras/chrome/cc/input_latency_async_slice.htm l">
12 <link rel="import" href="/tracing/importer/find_input_expectations.html"> 12 <link rel="import" href="/tracing/importer/find_input_expectations.html">
13 <link rel="import" href="/tracing/importer/find_load_expectations.html"> 13 <link rel="import" href="/tracing/importer/find_load_expectations.html">
14 <link rel="import" href="/tracing/importer/find_startup_expectations.html"> 14 <link rel="import" href="/tracing/importer/find_startup_expectations.html">
15 <link rel="import" href="/tracing/model/event_info.html"> 15 <link rel="import" href="/tracing/model/event_info.html">
16 <link rel="import" href="/tracing/model/ir_coverage.html"> 16 <link rel="import" href="/tracing/model/ir_coverage.html">
17 <link rel="import" href="/tracing/model/user_model/idle_expectation.html"> 17 <link rel="import" href="/tracing/model/user_model/idle_expectation.html">
18 <link rel="import" href="/tracing/model/user_model/segment.html"> 18 <link rel="import" href="/tracing/model/user_model/segment.html">
19 19
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 timestamps.add(expectation.start); 73 timestamps.add(expectation.start);
74 timestamps.add(expectation.end); 74 timestamps.add(expectation.end);
75 } 75 }
76 timestamps = [...timestamps]; 76 timestamps = [...timestamps];
77 timestamps.sort((x, y) => x - y); 77 timestamps.sort((x, y) => x - y);
78 var segments = []; 78 var segments = [];
79 for (var i = 0; i < timestamps.length - 1; ++i) { 79 for (var i = 0; i < timestamps.length - 1; ++i) {
80 var segment = new tr.model.um.Segment( 80 var segment = new tr.model.um.Segment(
81 timestamps[i], timestamps[i + 1] - timestamps[i]); 81 timestamps[i], timestamps[i + 1] - timestamps[i]);
82 segments.push(segment); 82 segments.push(segment);
83 var segmentRange = tr.b.Range.fromExplicitRange( 83 var segmentRange = tr.b.math.Range.fromExplicitRange(
84 segment.start, segment.end); 84 segment.start, segment.end);
85 for (var expectation of this.model.userModel.expectations) { 85 for (var expectation of this.model.userModel.expectations) {
86 var expectationRange = tr.b.Range.fromExplicitRange( 86 var expectationRange = tr.b.math.Range.fromExplicitRange(
87 expectation.start, expectation.end); 87 expectation.start, expectation.end);
88 if (segmentRange.intersectsRangeExclusive(expectationRange)) { 88 if (segmentRange.intersectsRangeExclusive(expectationRange)) {
89 segment.expectations.push(expectation); 89 segment.expectations.push(expectation);
90 } 90 }
91 } 91 }
92 } 92 }
93 return segments; 93 return segments;
94 } 94 }
95 95
96 /** 96 /**
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 break; 149 break;
150 } 150 }
151 } 151 }
152 } 152 }
153 } 153 }
154 154
155 // Fill in the empty space between UEs with IdleUEs. 155 // Fill in the empty space between UEs with IdleUEs.
156 findIdleExpectations(otherUEs) { 156 findIdleExpectations(otherUEs) {
157 if (this.model.bounds.isEmpty) return; 157 if (this.model.bounds.isEmpty) return;
158 158
159 var emptyRanges = tr.b.findEmptyRangesBetweenRanges( 159 var emptyRanges = tr.b.math.findEmptyRangesBetweenRanges(
160 tr.b.convertEventsToRanges(otherUEs), 160 tr.b.math.convertEventsToRanges(otherUEs),
161 this.model.bounds); 161 this.model.bounds);
162 var expectations = []; 162 var expectations = [];
163 var model = this.model; 163 var model = this.model;
164 for (var range of emptyRanges) { 164 for (var range of emptyRanges) {
165 // Ignore insignificantly tiny idle ranges. 165 // Ignore insignificantly tiny idle ranges.
166 if (range.max < (range.min + INSIGNIFICANT_MS)) continue; 166 if (range.max < (range.min + INSIGNIFICANT_MS)) continue;
167 167
168 expectations.push(new tr.model.um.IdleExpectation( 168 expectations.push(new tr.model.um.IdleExpectation(
169 model, range.min, range.max - range.min)); 169 model, range.min, range.max - range.min));
170 } 170 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 return error; 268 return error;
269 } 269 }
270 } 270 }
271 271
272 return { 272 return {
273 UserModelBuilder, 273 UserModelBuilder,
274 createUEFinderTestCaseStringFromModel, 274 createUEFinderTestCaseStringFromModel,
275 }; 275 };
276 }); 276 });
277 </script> 277 </script>
OLDNEW
« no previous file with comments | « tracing/tracing/importer/proto_expectation.html ('k') | tracing/tracing/metrics/blink/gc_metric.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698