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

Unified Diff: tracing/tracing/metrics/tracing_metric_test.html

Issue 2043203003: Add MemoryInfra overheads to tracingMetrics (Closed) Base URL: https://chromium.googlesource.com/external/github.com/catapult-project/catapult.git@master
Patch Set: Renames to memory-infra. Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tracing/tracing/metrics/tracing_metric.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tracing/tracing/metrics/tracing_metric_test.html
diff --git a/tracing/tracing/metrics/tracing_metric_test.html b/tracing/tracing/metrics/tracing_metric_test.html
index 1a5807ef09d3c7ff89cae34bafa4753a27fc9011..05c53413399a4404ccfef9cd4c8d65429090af4d 100644
--- a/tracing/tracing/metrics/tracing_metric_test.html
+++ b/tracing/tracing/metrics/tracing_metric_test.html
@@ -9,6 +9,7 @@ found in the LICENSE file.
<link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
<link rel="import" href="/tracing/metrics/tracing_metric.html">
<link rel="import" href="/tracing/metrics/value_set.html">
+<link rel="import" href="/tracing/model/memory_dump_test_utils.html">
<script>
'use strict';
@@ -27,6 +28,12 @@ tr.b.unittest.testSuite(function() {
}, 0);
}
+ function checkDurationValue(allValues, metricName, expected) {
+ var values = allValues.getValuesWithName(metricName);
+ assert.lengthOf(values, 1);
+ assert.closeTo(1000 * values[0].numeric.value, expected, 0.1);
+ }
+
test('hasEventSizesInBytes', function() {
var allValues = new tr.metrics.ValueSet();
var events = [
@@ -108,5 +115,58 @@ tr.b.unittest.testSuite(function() {
}
});
+ test('testMemoryInfraTracingMetrics', function() {
+ var MEMORY_INFRA_TRACING_CATEGORY =
+ tr.metrics.MEMORY_INFRA_TRACING_CATEGORY;
+ var allValues = new tr.metrics.ValueSet();
+ var events = [
+ {name: 'OnMemoryDump', pid: 1, ts: 510, tid: 1, ph: 'X', cat: MEMORY_INFRA_TRACING_CATEGORY, args: {'dump_provider.name': 'mdp1'}, dur: 4}, // @suppress longLineCheck
+ {name: 'OnMemoryDump', pid: 1, ts: 520, tid: 7, ph: 'X', cat: MEMORY_INFRA_TRACING_CATEGORY, args: {'dump_provider.name': 'mdp2'}, dur: 15}, // @suppress longLineCheck
+ {name: 'OnMemoryDump', pid: 1, ts: 530, tid: 7, ph: 'X', cat: MEMORY_INFRA_TRACING_CATEGORY, args: {'dump_provider.name': 'mdp3'}, dur: 5}, // @suppress longLineCheck
+ {name: 'OnMemoryDump', pid: 2, ts: 510, tid: 2, ph: 'X', cat: MEMORY_INFRA_TRACING_CATEGORY, args: {'dump_provider.name': 'mdp1'}, dur: 9}, // @suppress longLineCheck
+ {name: 'OnMemoryDump', pid: 2, ts: 520, tid: 8, ph: 'X', cat: MEMORY_INFRA_TRACING_CATEGORY, args: {'dump_provider.name': 'mdp2'}, dur: 17}, // @suppress longLineCheck
+ {name: 'OnMemoryDump', pid: 2, ts: 530, tid: 8, ph: 'X', cat: MEMORY_INFRA_TRACING_CATEGORY, args: {'dump_provider.name': 'mdp3'}, dur: 7}, // @suppress longLineCheck
+ {name: 'OnMemoryDump', pid: 2, ts: 540, tid: 3, ph: 'X', cat: MEMORY_INFRA_TRACING_CATEGORY, args: {'dump_provider.name': 'mdp4'}, dur: 8}, // @suppress longLineCheck
+ {name: 'ProcessDumps', pid: 1, ts: 550, tid: 1, ph: 'X', cat: MEMORY_INFRA_TRACING_CATEGORY, args: {guid: 4}, dur: 8}, // @suppress longLineCheck
+ {name: 'ProcessDumps', pid: 2, ts: 540, tid: 2, ph: 'X', cat: MEMORY_INFRA_TRACING_CATEGORY, args: {guid: 4}, dur: 18}, // @suppress longLineCheck
+ {name: 'thread_name', pid: 1, ts: 0, tid: 1, ph: 'M', cat: '__metadata', args: {name: 'CrBrowsermain'}}, // @suppress longLineCheck
+ {name: 'thread_name', pid: 1, ts: 0, tid: 7, ph: 'M', cat: '__metadata', args: {name: 'MemoryInfra'}}, // @suppress longLineCheck
+ {name: 'thread_name', pid: 2, ts: 0, tid: 2, ph: 'M', cat: '__metadata', args: {name: 'CrRendererMain'}}, // @suppress longLineCheck
+ {name: 'thread_name', pid: 2, ts: 0, tid: 8, ph: 'M', cat: '__metadata', args: {name: 'MemoryInfra'}}, // @suppress longLineCheck
+ {name: 'thread_name', pid: 2, ts: 0, tid: 3, ph: 'M', cat: '__metadata', args: {name: 'Compositor'}} // @suppress longLineCheck
+ ];
+
+ var model = makeModel(JSON.stringify(events), true);
+ tr.model.MemoryDumpTestUtils.addGlobalMemoryDump(model, 550);
+ tr.metrics.tracingMetric(allValues, model);
+
+ var memoryCategorySize = events.filter(
+ slice => slice['cat'] === MEMORY_INFRA_TRACING_CATEGORY).reduce(
+ (acc, slice) => acc + JSON.stringify(slice).length, 0);
+ var totalSizeValue = allValues.getValuesWithName(
+ 'Total trace size of memory-infra dumps in bytes');
+ assert.lengthOf(totalSizeValue, 1);
+ assert.strictEqual(totalSizeValue[0].numeric.value, memoryCategorySize);
+ var sizePerDumpValue = allValues.getValuesWithName(
+ 'Average trace size of memory-infra dumps in bytes');
+ assert.lengthOf(sizePerDumpValue, 1);
+ assert.strictEqual(sizePerDumpValue[0].numeric.value, memoryCategorySize);
+
+ checkDurationValue(allValues,
+ 'Average CPU overhead of mdp1 per memory-infra dump', 13);
+ checkDurationValue(allValues,
+ 'Average CPU overhead of mdp2 per memory-infra dump', 32);
+ checkDurationValue(allValues,
+ 'Average CPU overhead of mdp3 per memory-infra dump', 12);
+ checkDurationValue(allValues,
+ 'Average CPU overhead of mdp4 per memory-infra dump', 8);
+ checkDurationValue(allValues,
+ 'Average CPU overhead on non-memory-infra threads per memory-infra ' +
+ 'dump',
+ 47);
+ checkDurationValue(allValues,
+ 'Average CPU overhead on all threads per memory-infra dump', 91);
+ });
+
});
</script>
« no previous file with comments | « tracing/tracing/metrics/tracing_metric.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698