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

Side by Side Diff: test/cctest/test-heap-profiler.cc

Issue 9223009: Detailed heap snapshot usability improvement. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix for coding style problem Created 8 years, 11 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 | Annotate | Revision Log
« src/profile-generator.cc ('K') | « src/profile-generator.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // 2 //
3 // Tests for heap profiler 3 // Tests for heap profiler
4 4
5 #include "v8.h" 5 #include "v8.h"
6 6
7 #include "cctest.h" 7 #include "cctest.h"
8 #include "heap-profiler.h" 8 #include "heap-profiler.h"
9 #include "snapshot.h" 9 #include "snapshot.h"
10 #include "utils-inl.h" 10 #include "utils-inl.h"
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 } 678 }
679 virtual ~TestRetainedObjectInfo() {} 679 virtual ~TestRetainedObjectInfo() {}
680 virtual void Dispose() { 680 virtual void Dispose() {
681 CHECK(!disposed_); 681 CHECK(!disposed_);
682 disposed_ = true; 682 disposed_ = true;
683 } 683 }
684 virtual bool IsEquivalent(RetainedObjectInfo* other) { 684 virtual bool IsEquivalent(RetainedObjectInfo* other) {
685 return GetHash() == other->GetHash(); 685 return GetHash() == other->GetHash();
686 } 686 }
687 virtual intptr_t GetHash() { return hash_; } 687 virtual intptr_t GetHash() { return hash_; }
688 virtual const char* GetLabel() { return label_; } 688 virtual const char* GetLabel() { return label_; }
mnaganov (inactive) 2012/01/27 09:53:17 Perhaps you need to test usage of GetGroupLabel as
689 virtual intptr_t GetElementCount() { return element_count_; } 689 virtual intptr_t GetElementCount() { return element_count_; }
690 virtual intptr_t GetSizeInBytes() { return size_; } 690 virtual intptr_t GetSizeInBytes() { return size_; }
691 bool disposed() { return disposed_; } 691 bool disposed() { return disposed_; }
692 692
693 static v8::RetainedObjectInfo* WrapperInfoCallback( 693 static v8::RetainedObjectInfo* WrapperInfoCallback(
694 uint16_t class_id, v8::Handle<v8::Value> wrapper) { 694 uint16_t class_id, v8::Handle<v8::Value> wrapper) {
695 if (class_id == 1) { 695 if (class_id == 1) {
696 if (wrapper->IsString()) { 696 if (wrapper->IsString()) {
697 v8::String::AsciiValue ascii(wrapper); 697 v8::String::AsciiValue ascii(wrapper);
698 if (strcmp(*ascii, "AAA") == 0) 698 if (strcmp(*ascii, "AAA") == 0)
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 CHECK_EQ(0, TestRetainedObjectInfo::instances.length()); 762 CHECK_EQ(0, TestRetainedObjectInfo::instances.length());
763 const v8::HeapSnapshot* snapshot = 763 const v8::HeapSnapshot* snapshot =
764 v8::HeapProfiler::TakeSnapshot(v8_str("retained")); 764 v8::HeapProfiler::TakeSnapshot(v8_str("retained"));
765 765
766 CHECK_EQ(3, TestRetainedObjectInfo::instances.length()); 766 CHECK_EQ(3, TestRetainedObjectInfo::instances.length());
767 for (int i = 0; i < TestRetainedObjectInfo::instances.length(); ++i) { 767 for (int i = 0; i < TestRetainedObjectInfo::instances.length(); ++i) {
768 CHECK(TestRetainedObjectInfo::instances[i]->disposed()); 768 CHECK(TestRetainedObjectInfo::instances[i]->disposed());
769 delete TestRetainedObjectInfo::instances[i]; 769 delete TestRetainedObjectInfo::instances[i];
770 } 770 }
771 771
772 const v8::HeapGraphNode* natives = GetNode( 772 const v8::HeapGraphNode* native_group_aaa = GetNode(
773 snapshot->GetRoot(), v8::HeapGraphNode::kObject, "(Native objects)"); 773 snapshot->GetRoot(), v8::HeapGraphNode::kNative, "aaa");
774 CHECK_NE(NULL, natives); 774 CHECK_NE(NULL, native_group_aaa);
775 CHECK_EQ(2, natives->GetChildrenCount()); 775 CHECK_EQ(1, native_group_aaa->GetChildrenCount());
776 const v8::HeapGraphNode* aaa = GetNode( 776 const v8::HeapGraphNode* aaa = GetNode(
777 natives, v8::HeapGraphNode::kNative, "aaa / 100 entries"); 777 native_group_aaa, v8::HeapGraphNode::kNative, "aaa / 100 entries");
778 CHECK_NE(NULL, aaa); 778 CHECK_NE(NULL, aaa);
779 CHECK_EQ(2, aaa->GetChildrenCount());
780
781 const v8::HeapGraphNode* native_group_ccc = GetNode(
782 snapshot->GetRoot(), v8::HeapGraphNode::kNative, "ccc");
779 const v8::HeapGraphNode* ccc = GetNode( 783 const v8::HeapGraphNode* ccc = GetNode(
780 natives, v8::HeapGraphNode::kNative, "ccc"); 784 native_group_ccc, v8::HeapGraphNode::kNative, "ccc");
781 CHECK_NE(NULL, ccc); 785 CHECK_NE(NULL, ccc);
782 786
783 CHECK_EQ(2, aaa->GetChildrenCount());
784 const v8::HeapGraphNode* n_AAA = GetNode( 787 const v8::HeapGraphNode* n_AAA = GetNode(
785 aaa, v8::HeapGraphNode::kString, "AAA"); 788 aaa, v8::HeapGraphNode::kString, "AAA");
786 CHECK_NE(NULL, n_AAA); 789 CHECK_NE(NULL, n_AAA);
787 const v8::HeapGraphNode* n_BBB = GetNode( 790 const v8::HeapGraphNode* n_BBB = GetNode(
788 aaa, v8::HeapGraphNode::kString, "BBB"); 791 aaa, v8::HeapGraphNode::kString, "BBB");
789 CHECK_NE(NULL, n_BBB); 792 CHECK_NE(NULL, n_BBB);
790 CHECK_EQ(1, ccc->GetChildrenCount()); 793 CHECK_EQ(1, ccc->GetChildrenCount());
791 const v8::HeapGraphNode* n_CCC = GetNode( 794 const v8::HeapGraphNode* n_CCC = GetNode(
792 ccc, v8::HeapGraphNode::kString, "CCC"); 795 ccc, v8::HeapGraphNode::kString, "CCC");
793 CHECK_NE(NULL, n_CCC); 796 CHECK_NE(NULL, n_CCC);
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
1148 v8::HeapProfiler::TakeSnapshot(v8_str("fun")); 1151 v8::HeapProfiler::TakeSnapshot(v8_str("fun"));
1149 const v8::HeapGraphNode* global = GetGlobalObject(snapshot); 1152 const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
1150 CHECK_NE(NULL, global); 1153 CHECK_NE(NULL, global);
1151 const v8::HeapGraphNode* fun = 1154 const v8::HeapGraphNode* fun =
1152 GetProperty(global, v8::HeapGraphEdge::kShortcut, "fun"); 1155 GetProperty(global, v8::HeapGraphEdge::kShortcut, "fun");
1153 CHECK(HasWeakEdge(fun)); 1156 CHECK(HasWeakEdge(fun));
1154 const v8::HeapGraphNode* shared = 1157 const v8::HeapGraphNode* shared =
1155 GetProperty(fun, v8::HeapGraphEdge::kInternal, "shared"); 1158 GetProperty(fun, v8::HeapGraphEdge::kInternal, "shared");
1156 CHECK(HasWeakEdge(shared)); 1159 CHECK(HasWeakEdge(shared));
1157 } 1160 }
OLDNEW
« src/profile-generator.cc ('K') | « src/profile-generator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698