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

Unified Diff: tracing/tracing/model/global_memory_dump_test.html

Issue 1395583002: Propagate attributes from global to process memory allocator dumps (Closed) Base URL: git@github.com:catapult-project/catapult.git@master
Patch Set: Created 5 years, 2 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/model/global_memory_dump.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tracing/tracing/model/global_memory_dump_test.html
diff --git a/tracing/tracing/model/global_memory_dump_test.html b/tracing/tracing/model/global_memory_dump_test.html
index 3024e0f5adbacd54c928723b1549632d20554d53..5d99c2809dc9fcaf25372cdff7669041747ddfa5 100644
--- a/tracing/tracing/model/global_memory_dump_test.html
+++ b/tracing/tracing/model/global_memory_dump_test.html
@@ -176,6 +176,7 @@ tr.b.unittest.testSuite(function() {
var guid = treeRecipe['guid'];
var owns = treeRecipe['owns'];
var size = treeRecipe['size'];
+ var attrs = treeRecipe['attrs'];
var importance = treeRecipe['importance'];
assert.notStrictEqual(skipBuild, true);
@@ -208,6 +209,9 @@ tr.b.unittest.testSuite(function() {
});
}
+ if (attrs !== undefined)
+ tr.b.iterItems(attrs, dump.addAttribute, dump);
+
return dump;
}
@@ -863,7 +867,7 @@ tr.b.unittest.testSuite(function() {
assertEqualUniqueMembers(visitedContainerDumps, containerDumps);
});
- test('iterateRootAllocatorDumps', function() {
+ test('iterateAllRootAllocatorDumps', function() {
var containerDumps = buildDumpTrees([
[ // GMD.
{
@@ -888,7 +892,7 @@ tr.b.unittest.testSuite(function() {
var pmd = containerDumps[1];
var visitedAllocatorDumps = [];
- gmd.iterateRootAllocatorDumps(buildArgPusher(visitedAllocatorDumps));
+ gmd.iterateAllRootAllocatorDumps(buildArgPusher(visitedAllocatorDumps));
assertEqualUniqueMembers(visitedAllocatorDumps, [
gmd.getMemoryAllocatorDumpByFullName('globalSharedDump1'),
gmd.getMemoryAllocatorDumpByFullName('globalSharedDump2'),
@@ -3319,7 +3323,7 @@ tr.b.unittest.testSuite(function() {
// Check that size calculation is NOT preceded by attribute
// aggregation, which would recursively sum up size attributes.
- test('calculateGraphAttributes', function() {
+ test('calculateGraphAttributes_aggregation', function() {
var model = tr.c.TestUtils.newModel(function(model) {
buildDumpTrees([
undefined, // GMD.
@@ -3362,5 +3366,97 @@ tr.b.unittest.testSuite(function() {
assertSizeAttribute(ownedChildDump, 'effective_size', 13,
[ownedInfo('root/owner_child', 'Process 0', 0)]);
});
+
+ // Check that attribute propagation and aggregation are performed in the
+ // correct order.
+ test('calculateGraphAttributes_propagation', function() {
+ var model = tr.c.TestUtils.newModel(function(model) {
+ buildDumpTrees([
+ [ // GMD.
+ {
+ 'name': 'owned_root',
+ 'guid': 1,
+ 'size': 10,
+ 'children': [
+ {
+ 'name': 'owned_child1',
+ 'attrs': {
+ 'summed': new ScalarAttribute('bytes', 12)
+ }
+ },
+ {
+ 'name': 'owned_child2',
+ 'attrs': {
+ 'summed': new ScalarAttribute('bytes', 15)
+ }
+ }
+ ]
+ }
+ ],
+ [ // PMD.
+ {
+ 'name': 'direct_owner',
+ 'owns': 1,
+ 'guid': 2
+ },
+ {
+ 'name': 'parent_owner',
+ 'children': [
+ {
+ 'name': 'child_owner',
+ 'owns': 1
+ },
+ {
+ 'name': 'sibling',
+ 'attrs': {
+ 'summed': new ScalarAttribute('bytes', 13)
+ }
+ }
+ ]
+ },
+ {
+ 'name': 'precedent_owner',
+ 'owns': 1,
+ 'attrs': {
+ 'summed': new ScalarAttribute('bytes', 0)
+ }
+ },
+ {
+ 'name': 'indirect_owner',
+ 'owns': 2
+ }
+ ]
+ ], model);
+ });
+ var pmd = model.getProcess(0).memoryDumps[0];
+
+ var directOwnerDump = pmd.getMemoryAllocatorDumpByFullName('direct_owner');
+ assertSizeAttribute(directOwnerDump, 'summed', 27);
+ assertUndefinedAttribute(directOwnerDump, 'size');
+ assertUndefinedAttribute(directOwnerDump, 'effective_size');
+
+ var childOwnerDump =
+ pmd.getMemoryAllocatorDumpByFullName('parent_owner/child_owner');
+ assertSizeAttribute(childOwnerDump, 'summed', 27);
+ assertUndefinedAttribute(childOwnerDump, 'size');
+ assertUndefinedAttribute(childOwnerDump, 'effective_size');
+
+ var parentOwnerDump = pmd.getMemoryAllocatorDumpByFullName('parent_owner');
+ assertSizeAttribute(parentOwnerDump, 'summed', 40);
+ assertUndefinedAttribute(parentOwnerDump, 'size');
+ assertUndefinedAttribute(parentOwnerDump, 'effective_size');
+
+ var precedentOwnerDump =
+ pmd.getMemoryAllocatorDumpByFullName('precedent_owner');
+ assertSizeAttribute(precedentOwnerDump, 'summed', 0);
+ assertUndefinedAttribute(precedentOwnerDump, 'size');
+ assertUndefinedAttribute(precedentOwnerDump, 'effective_size');
+
+ var indirectOwnerDump =
+ pmd.getMemoryAllocatorDumpByFullName('indirect_owner');
+ assertUndefinedAttribute(indirectOwnerDump, 'summed');
+ assertUndefinedAttribute(indirectOwnerDump, 'size');
+ assertUndefinedAttribute(indirectOwnerDump, 'effective_size');
+ });
});
</script>
« no previous file with comments | « tracing/tracing/model/global_memory_dump.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698