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

Side by Side Diff: tracing/tracing/metrics/v8/utils.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 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/base/category_util.html"> 8 <link rel="import" href="/tracing/base/category_util.html">
9 <link rel="import" href="/tracing/base/piecewise_linear_function.html"> 9 <link rel="import" href="/tracing/base/math/piecewise_linear_function.html">
10 <link rel="import" href="/tracing/base/range.html"> 10 <link rel="import" href="/tracing/base/math/range.html">
11 <link rel="import" href="/tracing/base/range_utils.html"> 11 <link rel="import" href="/tracing/base/math/range_utils.html">
12 <link rel="import" href="/tracing/base/unit.html"> 12 <link rel="import" href="/tracing/base/unit.html">
13 <link rel="import" href="/tracing/metrics/metric_registry.html"> 13 <link rel="import" href="/tracing/metrics/metric_registry.html">
14 <link rel="import" href="/tracing/value/histogram.html"> 14 <link rel="import" href="/tracing/value/histogram.html">
15 15
16 <script> 16 <script>
17 'use strict'; 17 'use strict';
18 18
19 tr.exportTo('tr.metrics.v8.utils', function() { 19 tr.exportTo('tr.metrics.v8.utils', function() {
20 // The title of the idle task event. 20 // The title of the idle task event.
21 var IDLE_TASK_EVENT = 'SingleThreadIdleTaskRunner::RunTask'; 21 var IDLE_TASK_EVENT = 'SingleThreadIdleTaskRunner::RunTask';
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 } 178 }
179 } 179 }
180 180
181 /** 181 /**
182 * Given a list of intervals, returns a new list with all overalapping 182 * Given a list of intervals, returns a new list with all overalapping
183 * intervals merged into a single interval. 183 * intervals merged into a single interval.
184 */ 184 */
185 function unionOfIntervals(intervals) { 185 function unionOfIntervals(intervals) {
186 if (intervals.length === 0) 186 if (intervals.length === 0)
187 return []; 187 return [];
188 return tr.b.mergeRanges( 188 return tr.b.math.mergeRanges(
189 intervals.map(x => { return { min: x.start, max: x.end }; }), 1e-6, 189 intervals.map(x => { return { min: x.start, max: x.end }; }), 1e-6,
190 function(ranges) { 190 function(ranges) {
191 return { 191 return {
192 start: ranges.reduce( 192 start: ranges.reduce(
193 (acc, x) => Math.min(acc, x.min), ranges[0].min), 193 (acc, x) => Math.min(acc, x.min), ranges[0].min),
194 end: ranges.reduce((acc, x) => Math.max(acc, x.max), ranges[0].max) 194 end: ranges.reduce((acc, x) => Math.max(acc, x.max), ranges[0].max)
195 }; 195 };
196 } 196 }
197 ); 197 );
198 } 198 }
199 199
200 function hasV8Stats(globalMemoryDump) { 200 function hasV8Stats(globalMemoryDump) {
201 var v8stats = undefined; 201 var v8stats = undefined;
202 globalMemoryDump.iterateContainerDumps(function(dump) { 202 globalMemoryDump.iterateContainerDumps(function(dump) {
203 v8stats = v8stats || dump.getMemoryAllocatorDumpByFullName('v8'); 203 v8stats = v8stats || dump.getMemoryAllocatorDumpByFullName('v8');
204 }); 204 });
205 return !!v8stats; 205 return !!v8stats;
206 } 206 }
207 207
208 function rangeForMemoryDumps(model) { 208 function rangeForMemoryDumps(model) {
209 var startOfFirstDumpWithV8 = 209 var startOfFirstDumpWithV8 =
210 model.globalMemoryDumps.filter(hasV8Stats).reduce( 210 model.globalMemoryDumps.filter(hasV8Stats).reduce(
211 (start, dump) => Math.min(start, dump.start), Infinity); 211 (start, dump) => Math.min(start, dump.start), Infinity);
212 if (startOfFirstDumpWithV8 === Infinity) 212 if (startOfFirstDumpWithV8 === Infinity)
213 return new tr.b.Range(); // Empty range. 213 return new tr.b.math.Range(); // Empty range.
214 return tr.b.Range.fromExplicitRange(startOfFirstDumpWithV8, Infinity); 214 return tr.b.math.Range.fromExplicitRange(startOfFirstDumpWithV8, Infinity);
215 } 215 }
216 216
217 return { 217 return {
218 findParent, 218 findParent,
219 groupAndProcessEvents, 219 groupAndProcessEvents,
220 isCompileEvent, 220 isCompileEvent,
221 isForcedGarbageCollectionEvent, 221 isForcedGarbageCollectionEvent,
222 isFullMarkCompactorEvent, 222 isFullMarkCompactorEvent,
223 isGarbageCollectionEvent, 223 isGarbageCollectionEvent,
224 isIdleTask, 224 isIdleTask,
225 isIncrementalMarkingEvent, 225 isIncrementalMarkingEvent,
226 isLatencyMarkCompactorEvent, 226 isLatencyMarkCompactorEvent,
227 isLowMemoryEvent, 227 isLowMemoryEvent,
228 isMemoryMarkCompactorEvent, 228 isMemoryMarkCompactorEvent,
229 isScavengerEvent, 229 isScavengerEvent,
230 isSubGarbageCollectionEvent, 230 isSubGarbageCollectionEvent,
231 isTopGarbageCollectionEvent, 231 isTopGarbageCollectionEvent,
232 isTopV8ExecuteEvent, 232 isTopV8ExecuteEvent,
233 isV8Event, 233 isV8Event,
234 isV8ExecuteEvent, 234 isV8ExecuteEvent,
235 rangeForMemoryDumps, 235 rangeForMemoryDumps,
236 subGarbageCollectionEventName, 236 subGarbageCollectionEventName,
237 topGarbageCollectionEventName, 237 topGarbageCollectionEventName,
238 unionOfIntervals, 238 unionOfIntervals,
239 }; 239 };
240 }); 240 });
241 </script> 241 </script>
OLDNEW
« no previous file with comments | « tracing/tracing/metrics/v8/runtime_stats_metric.html ('k') | tracing/tracing/metrics/webrtc/webrtc_rendering_metric.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698