Chromium Code Reviews| Index: tracing/tracing/metrics/system_health/memory_metric.html |
| diff --git a/tracing/tracing/metrics/system_health/memory_metric.html b/tracing/tracing/metrics/system_health/memory_metric.html |
| index 1aa81e05b2b1a6e306adca5b6b0ce6d9d3029ecd..9c2093753541ff42b2b583100bb5b7e7857bf5b4 100644 |
| --- a/tracing/tracing/metrics/system_health/memory_metric.html |
| +++ b/tracing/tracing/metrics/system_health/memory_metric.html |
| @@ -48,8 +48,10 @@ tr.exportTo('tr.metrics.sh', function() { |
| .addBinBoundary(1024 /* 1 KiB */) |
| .addExponentialBins(16 * 1024 * 1024 * 1024 /* 16 GiB */, 4 * 24)); |
| - function memoryMetric(values, model) { |
| - var browserNameToGlobalDumps = splitGlobalDumpsByBrowserName(model); |
| + function memoryMetric(values, model, opt_options) { |
| + var rangeOfInterest = opt_options ? opt_options.rangeOfInterest : undefined; |
| + var browserNameToGlobalDumps = |
| + splitGlobalDumpsByBrowserName(model, rangeOfInterest); |
| addGeneralMemoryDumpValues(browserNameToGlobalDumps, values); |
| addDetailedMemoryDumpValues(browserNameToGlobalDumps, values); |
| addMemoryDumpCountValues(browserNameToGlobalDumps, values); |
| @@ -60,10 +62,12 @@ tr.exportTo('tr.metrics.sh', function() { |
| * |
| * @param {!tr.Model} model The trace model from which the global dumps |
| * should be extracted. |
| + * @param {!tr.b.Range=} opt_rangeOfInterest If proided, global memory dumps |
| + * that do not exclusively intersect the range will be skipped. |
| * @return {!Map<string, !Array<!tr.model.GlobalMemoryDump>} A map from |
| * browser names to the associated global memory dumps. |
| */ |
| - function splitGlobalDumpsByBrowserName(model) { |
| + function splitGlobalDumpsByBrowserName(model, opt_rangeOfInterest) { |
| var chromeModelHelper = |
| model.getOrCreateHelper(tr.model.helpers.ChromeModelHelper); |
| var browserNameToGlobalDumps = new Map(); |
| @@ -77,8 +81,9 @@ tr.exportTo('tr.metrics.sh', function() { |
| chromeModelHelper.browserHelpers.forEach(function(helper) { |
| // Retrieve the associated global memory dumps and check that they |
| // haven't been classified as belonging to another browser process. |
| - var globalDumps = helper.process.memoryDumps.map( |
| - d => d.globalMemoryDump); |
| + var globalDumps = skipDumpsThatDoNotExclusivelyIntersectRange( |
| + helper.process.memoryDumps.map(d => d.globalMemoryDump), |
| + opt_rangeOfInterest); |
| globalDumps.forEach(function(globalDump) { |
| var existingHelper = globalDumpToBrowserHelper.get(globalDump); |
| if (existingHelper !== undefined) { |
| @@ -96,8 +101,9 @@ tr.exportTo('tr.metrics.sh', function() { |
| // 2. If any global memory dump does not have any associated browser |
| // process for some reason, associate it with an 'unknown_browser' browser |
| // so that we don't lose the data. |
| - var unclassifiedGlobalDumps = |
| - model.globalMemoryDumps.filter(g => !globalDumpToBrowserHelper.has(g)); |
| + var unclassifiedGlobalDumps = skipDumpsThatDoNotExclusivelyIntersectRange( |
| + model.globalMemoryDumps.filter(g => !globalDumpToBrowserHelper.has(g)), |
| + opt_rangeOfInterest); |
| if (unclassifiedGlobalDumps.length > 0) { |
| makeKeyUniqueAndSet( |
| browserNameToGlobalDumps, 'unknown_browser', unclassifiedGlobalDumps); |
| @@ -106,6 +112,13 @@ tr.exportTo('tr.metrics.sh', function() { |
| return browserNameToGlobalDumps; |
| } |
| + function skipDumpsThatDoNotExclusivelyIntersectRange(dumps, opt_range) { |
| + if (!opt_range) |
| + return dumps; |
| + return dumps.filter(d => opt_range.intersectsExplicitRangeExclusive( |
|
petrcermak
2016/07/07 17:02:23
Ben: I used this to be consistent with the remaini
benjhayden
2016/07/07 17:23:10
I probably just copy-pasted it from somewhere else
petrcermak
2016/07/08 12:14:55
OK, I've changed it to "inclusive" for the memory
|
| + d.start, d.end)); |
| + } |
| + |
| function canonicalizeName(name) { |
| return name.toLowerCase().replace(' ', '_'); |
| }; |
| @@ -1014,7 +1027,9 @@ tr.exportTo('tr.metrics.sh', function() { |
| return numeric; |
| } |
| - tr.metrics.MetricRegistry.register(memoryMetric); |
| + tr.metrics.MetricRegistry.register(memoryMetric, { |
| + supportsRangeOfInterest: true |
| + }); |
| return { |
| memoryMetric: memoryMetric |