OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright 2015 The Chromium Authors. All rights reserved. | 3 Copyright 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/iteration_helpers.html"> | 8 <link rel="import" href="/tracing/base/iteration_helpers.html"> |
9 <link rel="import" href="/tracing/core/test_utils.html"> | 9 <link rel="import" href="/tracing/core/test_utils.html"> |
10 <link rel="import" href="/tracing/importer/import.html"> | 10 <link rel="import" href="/tracing/importer/import.html"> |
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 } | 664 } |
665 ] | 665 ] |
666 ]); | 666 ]); |
667 }, 'invalid parent'); | 667 }, 'invalid parent'); |
668 }); | 668 }); |
669 | 669 |
670 test('testSanityCheck_checkDumpTrees_invalidSize', function() { | 670 test('testSanityCheck_checkDumpTrees_invalidSize', function() { |
671 var containerDumps = createContainerDumps(1); | 671 var containerDumps = createContainerDumps(1); |
672 var gmd = containerDumps[0]; | 672 var gmd = containerDumps[0]; |
673 var pmd = containerDumps[1]; | 673 var pmd = containerDumps[1]; |
674 var rootDump = newAllocatorDump(pmd, 'root', { size: 100 }); | 674 var rootDump = newAllocatorDump(pmd, 'root', {numerics: {size: 100}}); |
675 addChildDump(rootDump, 'parent', { size: 49 }); | 675 addChildDump(rootDump, 'parent', {numerics: {size: 49}}); |
676 pmd.memoryAllocatorDumps = [rootDump]; | 676 pmd.memoryAllocatorDumps = [rootDump]; |
677 | 677 |
678 assert.throws(function() { | 678 assert.throws(function() { |
679 checkDumpTrees(containerDumps, [ | 679 checkDumpTrees(containerDumps, [ |
680 undefined, | 680 undefined, |
681 [ | 681 [ |
682 { | 682 { |
683 'name': 'root', | 683 'name': 'root', |
684 'expected_size': 100, | 684 'expected_size': 100, |
685 'children': [ | 685 'children': [ |
686 { | 686 { |
687 'name': 'parent', | 687 'name': 'parent', |
688 'expected_size': 50 // This should be 49. | 688 'expected_size': 50 // This should be 49. |
689 } | 689 } |
690 ] | 690 ] |
691 } | 691 } |
692 ] | 692 ] |
693 ]); | 693 ]); |
694 }, /expected.*'size'.*value.*\b50\b.*got.*\b49\b/); | 694 }, /expected.*'size'.*value.*\b50\b.*got.*\b49\b/); |
695 }); | 695 }); |
696 | 696 |
697 test('testSanityCheck_checkDumpTrees_invalidEffectiveSize', function() { | 697 test('testSanityCheck_checkDumpTrees_invalidEffectiveSize', function() { |
698 var containerDumps = createContainerDumps(1); | 698 var containerDumps = createContainerDumps(1); |
699 var gmd = containerDumps[0]; | 699 var gmd = containerDumps[0]; |
700 var pmd = containerDumps[1]; | 700 var pmd = containerDumps[1]; |
701 var rootDump = newAllocatorDump(pmd, 'root', { effective_size: 99 }); | 701 var rootDump = newAllocatorDump(pmd, 'root', |
702 addChildDump(rootDump, 'parent', { effective_size: 50 }); | 702 {numerics: {effective_size: 99}}); |
| 703 addChildDump(rootDump, 'parent', {numerics: {effective_size: 50}}); |
703 pmd.memoryAllocatorDumps = [rootDump]; | 704 pmd.memoryAllocatorDumps = [rootDump]; |
704 | 705 |
705 assert.throws(function() { | 706 assert.throws(function() { |
706 checkDumpTrees(containerDumps, [ | 707 checkDumpTrees(containerDumps, [ |
707 undefined, | 708 undefined, |
708 [ | 709 [ |
709 { | 710 { |
710 'name': 'root', | 711 'name': 'root', |
711 'expected_effective_size': 100, // This should be 99. | 712 'expected_effective_size': 100, // This should be 99. |
712 'children': [ | 713 'children': [ |
713 { | 714 { |
714 'name': 'parent', | 715 'name': 'parent', |
715 'expected_effective_size': 50 | 716 'expected_effective_size': 50 |
716 } | 717 } |
717 ] | 718 ] |
718 } | 719 } |
719 ] | 720 ] |
720 ]); | 721 ]); |
721 }, /expected.*'effective_size'.*value.*\b100\b.*got.*\b99\b/); | 722 }, /expected.*'effective_size'.*value.*\b100\b.*got.*\b99\b/); |
722 }); | 723 }); |
723 | 724 |
724 test('testSanityCheck_checkDumpTrees_invalidInfoCount', function() { | 725 test('testSanityCheck_checkDumpTrees_invalidInfoCount', function() { |
725 var containerDumps = createContainerDumps(0); | 726 var containerDumps = createContainerDumps(0); |
726 var gmd = containerDumps[0]; | 727 var gmd = containerDumps[0]; |
727 gmd.memoryAllocatorDumps = [ | 728 gmd.memoryAllocatorDumps = [ |
728 newAllocatorDump(gmd, 'v8', { | 729 newAllocatorDump(gmd, 'v8', {numerics: {size: 50}}) |
729 size: 50 | |
730 }) | |
731 ]; | 730 ]; |
732 | 731 |
733 assert.throws(function() { | 732 assert.throws(function() { |
734 checkDumpTrees(containerDumps, [ | 733 checkDumpTrees(containerDumps, [ |
735 [ | 734 [ |
736 { | 735 { |
737 'name': 'v8', | 736 'name': 'v8', |
738 'expected_size': 50, | 737 'expected_size': 50, |
739 'expected_infos': [ | 738 'expected_infos': [ |
740 { | 739 { |
741 type: PROVIDED_SIZE_LESS_THAN_AGGREGATED_CHILDREN, | 740 type: PROVIDED_SIZE_LESS_THAN_AGGREGATED_CHILDREN, |
742 providedSize: 50, | 741 providedSize: 50, |
743 dependencySize: 60 | 742 dependencySize: 60 |
744 } | 743 } |
745 ] | 744 ] |
746 } | 745 } |
747 ] | 746 ] |
748 ]); | 747 ]); |
749 }, /expected.*'v8'.*\b1 infos\b.*\bgot\b.*\b0\b/); | 748 }, /expected.*'v8'.*\b1 infos\b.*\bgot\b.*\b0\b/); |
750 }); | 749 }); |
751 | 750 |
752 test('testSanityCheck_checkDumpTrees_invalidInfo', function() { | 751 test('testSanityCheck_checkDumpTrees_invalidInfo', function() { |
753 var containerDumps = createContainerDumps(0); | 752 var containerDumps = createContainerDumps(0); |
754 var gmd = containerDumps[0]; | 753 var gmd = containerDumps[0]; |
755 var v8Dump = newAllocatorDump(gmd, 'v8', { size: 50 }); | 754 var v8Dump = newAllocatorDump(gmd, 'v8', {numerics: {size: 50}}); |
756 v8Dump.infos.push({ | 755 v8Dump.infos.push({ |
757 type: PROVIDED_SIZE_LESS_THAN_AGGREGATED_CHILDREN, | 756 type: PROVIDED_SIZE_LESS_THAN_AGGREGATED_CHILDREN, |
758 providedSize: 40, | 757 providedSize: 40, |
759 dependencySize: 50 | 758 dependencySize: 50 |
760 }); | 759 }); |
761 gmd.memoryAllocatorDumps = [v8Dump]; | 760 gmd.memoryAllocatorDumps = [v8Dump]; |
762 | 761 |
763 assert.throws(function() { | 762 assert.throws(function() { |
764 checkDumpTrees(containerDumps, [ | 763 checkDumpTrees(containerDumps, [ |
765 [ | 764 [ |
(...skipping 11 matching lines...) Expand all Loading... |
777 } | 776 } |
778 ] | 777 ] |
779 ]); | 778 ]); |
780 }, /\binfo 0\b.*'v8'.*\bexpected\b/); | 779 }, /\binfo 0\b.*'v8'.*\bexpected\b/); |
781 }); | 780 }); |
782 | 781 |
783 test('testSanityCheck_checkDumpTrees_invalidOwnedBySiblingSizes', function() { | 782 test('testSanityCheck_checkDumpTrees_invalidOwnedBySiblingSizes', function() { |
784 var containerDumps = createContainerDumps(0); | 783 var containerDumps = createContainerDumps(0); |
785 var gmd = containerDumps[0]; | 784 var gmd = containerDumps[0]; |
786 var v8Dump = new MemoryAllocatorDump(gmd, 'v8'); | 785 var v8Dump = new MemoryAllocatorDump(gmd, 'v8'); |
787 addChildDump(v8Dump, 'child1', {}, 42 /* guid */); | 786 addChildDump(v8Dump, 'child1', {guid: 42}); |
788 addChildDump(v8Dump, 'child2'); | 787 addChildDump(v8Dump, 'child2'); |
789 gmd.memoryAllocatorDumps = [v8Dump]; | 788 gmd.memoryAllocatorDumps = [v8Dump]; |
790 | 789 |
791 assert.throws(function() { | 790 assert.throws(function() { |
792 checkDumpTrees(containerDumps, [ | 791 checkDumpTrees(containerDumps, [ |
793 [ | 792 [ |
794 { | 793 { |
795 'name': 'v8', | 794 'name': 'v8', |
796 'children': [ | 795 'children': [ |
797 { | 796 { |
(...skipping 2627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3425 var rootDump = pmd.getMemoryAllocatorDumpByFullName('root'); | 3424 var rootDump = pmd.getMemoryAllocatorDumpByFullName('root'); |
3426 assertDumpSizes(rootDump, 20, 20); | 3425 assertDumpSizes(rootDump, 20, 20); |
3427 | 3426 |
3428 var ownerChildDump = pmd.getMemoryAllocatorDumpByFullName( | 3427 var ownerChildDump = pmd.getMemoryAllocatorDumpByFullName( |
3429 'root/owner_child'); | 3428 'root/owner_child'); |
3430 assertDumpSizes(ownerChildDump, 7, 7); | 3429 assertDumpSizes(ownerChildDump, 7, 7); |
3431 | 3430 |
3432 var ownedChildDump = pmd.getMemoryAllocatorDumpByFullName( | 3431 var ownedChildDump = pmd.getMemoryAllocatorDumpByFullName( |
3433 'root/owned_child'); | 3432 'root/owned_child'); |
3434 assertDumpSizes(ownedChildDump, 20, 13, [] /* expectedInfos */, | 3433 assertDumpSizes(ownedChildDump, 20, 13, [] /* expectedInfos */, |
3435 { owner_child: 7 } /* expectedOwnedBySiblingSizes */); | 3434 {'owner_child': 7} /* expectedOwnedBySiblingSizes */); |
3436 }); | 3435 }); |
3437 | 3436 |
3438 // Check that numeric and diagnostics propagation and aggregation are | 3437 // Check that numeric and diagnostics propagation and aggregation are |
3439 // performed in the correct order. | 3438 // performed in the correct order. |
3440 test('finalizeGraph_propagation', function() { | 3439 test('finalizeGraph_propagation', function() { |
3441 var model = tr.c.TestUtils.newModel(function(model) { | 3440 var model = tr.c.TestUtils.newModel(function(model) { |
3442 buildDumpTrees([ | 3441 buildDumpTrees([ |
3443 [ // GMD. | 3442 [ // GMD. |
3444 { | 3443 { |
3445 'name': 'owned_root', | 3444 'name': 'owned_root', |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3504 'owns': 2 | 3503 'owns': 2 |
3505 } | 3504 } |
3506 ] | 3505 ] |
3507 ], model); | 3506 ], model); |
3508 }); | 3507 }); |
3509 var pmd = model.getProcess(0).memoryDumps[0]; | 3508 var pmd = model.getProcess(0).memoryDumps[0]; |
3510 | 3509 |
3511 checkDumpNumericsAndDiagnostics( | 3510 checkDumpNumericsAndDiagnostics( |
3512 pmd.getMemoryAllocatorDumpByFullName('direct_owner'), | 3511 pmd.getMemoryAllocatorDumpByFullName('direct_owner'), |
3513 { | 3512 { |
3514 'size': 10, | 3513 size: 10, |
3515 'effective_size': 3.3333, | 3514 effective_size: 3.3333, |
3516 'summed': 27 | 3515 summed: 27 |
3517 }, | 3516 }, |
3518 { | 3517 { |
3519 'url': 'file://not_overriden.html' | 3518 url: 'file://not_overriden.html' |
3520 }); | 3519 }); |
3521 checkDumpNumericsAndDiagnostics( | 3520 checkDumpNumericsAndDiagnostics( |
3522 pmd.getMemoryAllocatorDumpByFullName('parent_owner/child_owner'), | 3521 pmd.getMemoryAllocatorDumpByFullName('parent_owner/child_owner'), |
3523 { | 3522 { |
3524 'size': 10, | 3523 size: 10, |
3525 'effective_size': 3.3333, | 3524 effective_size: 3.3333, |
3526 'summed': 27 | 3525 summed: 27 |
3527 }, | 3526 }, |
3528 { | 3527 { |
3529 'url': 'https://hello.world.com:42' | 3528 url: 'https://hello.world.com:42' |
3530 }); | 3529 }); |
3531 checkDumpNumericsAndDiagnostics( | 3530 checkDumpNumericsAndDiagnostics( |
3532 pmd.getMemoryAllocatorDumpByFullName('parent_owner'), | 3531 pmd.getMemoryAllocatorDumpByFullName('parent_owner'), |
3533 { | 3532 { |
3534 'size': 15, | 3533 size: 15, |
3535 'effective_size': 8.3333, | 3534 effective_size: 8.3333, |
3536 'summed': 40 | 3535 summed: 40 |
3537 }, {}); | 3536 }, {}); |
3538 checkDumpNumericsAndDiagnostics( | 3537 checkDumpNumericsAndDiagnostics( |
3539 pmd.getMemoryAllocatorDumpByFullName('precedent_owner'), | 3538 pmd.getMemoryAllocatorDumpByFullName('precedent_owner'), |
3540 { | 3539 { |
3541 'size': 10, | 3540 size: 10, |
3542 'effective_size': 3.3333, | 3541 effective_size: 3.3333, |
3543 'summed': 0 | 3542 summed: 0 |
3544 }, | 3543 }, |
3545 { | 3544 { |
3546 'url': 'https://hello.world.com:42' | 3545 url: 'https://hello.world.com:42' |
3547 }); | 3546 }); |
3548 checkDumpNumericsAndDiagnostics( | 3547 checkDumpNumericsAndDiagnostics( |
3549 pmd.getMemoryAllocatorDumpByFullName('indirect_owner'), {}, {}); | 3548 pmd.getMemoryAllocatorDumpByFullName('indirect_owner'), {}, {}); |
3550 }); | 3549 }); |
3551 | 3550 |
3552 // Check that weak dumps are removed before size size calculation. | 3551 // Check that weak dumps are removed before size size calculation. |
3553 test('finalizeGraph_weakDumpRemoval', function() { | 3552 test('finalizeGraph_weakDumpRemoval', function() { |
3554 var model = tr.c.TestUtils.newModel(function(model) { | 3553 var model = tr.c.TestUtils.newModel(function(model) { |
3555 buildDumpTrees([ | 3554 buildDumpTrees([ |
3556 undefined, // GMD. | 3555 undefined, // GMD. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3603 assert.isUndefined(pmd.getMemoryAllocatorDumpByFullName( | 3602 assert.isUndefined(pmd.getMemoryAllocatorDumpByFullName( |
3604 'root/separate_weak_child')); | 3603 'root/separate_weak_child')); |
3605 }); | 3604 }); |
3606 | 3605 |
3607 test('indicesUpdatedCorrectly', function() { | 3606 test('indicesUpdatedCorrectly', function() { |
3608 var gmd, rootDump, childDump; | 3607 var gmd, rootDump, childDump; |
3609 var model = tr.c.TestUtils.newModel(function(model) { | 3608 var model = tr.c.TestUtils.newModel(function(model) { |
3610 gmd = new GlobalMemoryDump(model, 10); | 3609 gmd = new GlobalMemoryDump(model, 10); |
3611 model.globalMemoryDumps.push(gmd); | 3610 model.globalMemoryDumps.push(gmd); |
3612 | 3611 |
3613 rootDump = newAllocatorDump(gmd, 'root', { size: 64 }); | 3612 rootDump = newAllocatorDump(gmd, 'root', {numerics: {size: 64}}); |
3614 childDump = addChildDump(rootDump, 'child', { size: 48 }); | 3613 childDump = addChildDump(rootDump, 'child', {numerics: {size: 48}}); |
3615 | 3614 |
3616 gmd.memoryAllocatorDumps = [rootDump]; | 3615 gmd.memoryAllocatorDumps = [rootDump]; |
3617 | 3616 |
3618 // Before model is finalized. | 3617 // Before model is finalized. |
3619 assert.strictEqual( | 3618 assert.strictEqual( |
3620 gmd.getMemoryAllocatorDumpByFullName('root'), rootDump); | 3619 gmd.getMemoryAllocatorDumpByFullName('root'), rootDump); |
3621 assert.strictEqual( | 3620 assert.strictEqual( |
3622 gmd.getMemoryAllocatorDumpByFullName('root/child'), childDump); | 3621 gmd.getMemoryAllocatorDumpByFullName('root/child'), childDump); |
3623 assert.isUndefined( | 3622 assert.isUndefined( |
3624 gmd.getMemoryAllocatorDumpByFullName('root/<unspecified>')); | 3623 gmd.getMemoryAllocatorDumpByFullName('root/<unspecified>')); |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3935 'name': 'child7', | 3934 'name': 'child7', |
3936 'guid': 7, | 3935 'guid': 7, |
3937 'owns': 4 | 3936 'owns': 4 |
3938 } | 3937 } |
3939 ] | 3938 ] |
3940 } | 3939 } |
3941 ] | 3940 ] |
3942 ]); | 3941 ]); |
3943 }); | 3942 }); |
3944 </script> | 3943 </script> |
OLD | NEW |