OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
2 // | 2 // |
3 // Tests of profiles generator and utilities. | 3 // Tests of profiles generator and utilities. |
4 | 4 |
5 #ifdef ENABLE_LOGGING_AND_PROFILING | 5 #ifdef ENABLE_LOGGING_AND_PROFILING |
6 | 6 |
7 #include "v8.h" | 7 #include "v8.h" |
8 #include "profile-generator-inl.h" | 8 #include "profile-generator-inl.h" |
9 #include "cctest.h" | 9 #include "cctest.h" |
10 #include "../include/v8-profiler.h" | 10 #include "../include/v8-profiler.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 CHECK_NE(NULL, childNode3); | 83 CHECK_NE(NULL, childNode3); |
84 CHECK_NE(childNode1, childNode3); | 84 CHECK_NE(childNode1, childNode3); |
85 CHECK_NE(childNode2, childNode3); | 85 CHECK_NE(childNode2, childNode3); |
86 CHECK_EQ(childNode1, node.FindOrAddChild(&entry1)); | 86 CHECK_EQ(childNode1, node.FindOrAddChild(&entry1)); |
87 CHECK_EQ(childNode2, node.FindOrAddChild(&entry2)); | 87 CHECK_EQ(childNode2, node.FindOrAddChild(&entry2)); |
88 CHECK_EQ(childNode3, node.FindOrAddChild(&entry3)); | 88 CHECK_EQ(childNode3, node.FindOrAddChild(&entry3)); |
89 } | 89 } |
90 | 90 |
91 | 91 |
92 TEST(ProfileNodeFindOrAddChildForSameFunction) { | 92 TEST(ProfileNodeFindOrAddChildForSameFunction) { |
| 93 const char* empty = ""; |
| 94 const char* aaa = "aaa"; |
93 ProfileNode node(NULL, NULL); | 95 ProfileNode node(NULL, NULL); |
94 CodeEntry entry1(i::Logger::FUNCTION_TAG, "", "aaa", "", 0, | 96 CodeEntry entry1(i::Logger::FUNCTION_TAG, empty, aaa, empty, 0, |
95 TokenEnumerator::kNoSecurityToken); | 97 TokenEnumerator::kNoSecurityToken); |
96 ProfileNode* childNode1 = node.FindOrAddChild(&entry1); | 98 ProfileNode* childNode1 = node.FindOrAddChild(&entry1); |
97 CHECK_NE(NULL, childNode1); | 99 CHECK_NE(NULL, childNode1); |
98 CHECK_EQ(childNode1, node.FindOrAddChild(&entry1)); | 100 CHECK_EQ(childNode1, node.FindOrAddChild(&entry1)); |
99 // The same function again. | 101 // The same function again. |
100 CodeEntry entry2(i::Logger::FUNCTION_TAG, "", "aaa", "", 0, | 102 CodeEntry entry2(i::Logger::FUNCTION_TAG, empty, aaa, empty, 0, |
101 TokenEnumerator::kNoSecurityToken); | 103 TokenEnumerator::kNoSecurityToken); |
102 CHECK_EQ(childNode1, node.FindOrAddChild(&entry2)); | 104 CHECK_EQ(childNode1, node.FindOrAddChild(&entry2)); |
103 // Now with a different security token. | 105 // Now with a different security token. |
104 CodeEntry entry3(i::Logger::FUNCTION_TAG, "", "aaa", "", 0, | 106 CodeEntry entry3(i::Logger::FUNCTION_TAG, empty, aaa, empty, 0, |
105 TokenEnumerator::kNoSecurityToken + 1); | 107 TokenEnumerator::kNoSecurityToken + 1); |
106 CHECK_EQ(childNode1, node.FindOrAddChild(&entry3)); | 108 CHECK_EQ(childNode1, node.FindOrAddChild(&entry3)); |
107 } | 109 } |
108 | 110 |
109 | 111 |
110 namespace { | 112 namespace { |
111 | 113 |
112 class ProfileTreeTestHelper { | 114 class ProfileTreeTestHelper { |
113 public: | 115 public: |
114 explicit ProfileTreeTestHelper(const ProfileTree* tree) | 116 explicit ProfileTreeTestHelper(const ProfileTree* tree) |
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 CHECK(collection.StartProfiling(title.start(), i + 1)); // UID must be > 0. | 806 CHECK(collection.StartProfiling(title.start(), i + 1)); // UID must be > 0. |
805 titles[i] = title.start(); | 807 titles[i] = title.start(); |
806 } | 808 } |
807 CHECK(!collection.StartProfiling( | 809 CHECK(!collection.StartProfiling( |
808 "maximum", CpuProfilesCollection::kMaxSimultaneousProfiles + 1)); | 810 "maximum", CpuProfilesCollection::kMaxSimultaneousProfiles + 1)); |
809 for (int i = 0; i < CpuProfilesCollection::kMaxSimultaneousProfiles; ++i) | 811 for (int i = 0; i < CpuProfilesCollection::kMaxSimultaneousProfiles; ++i) |
810 i::DeleteArray(titles[i]); | 812 i::DeleteArray(titles[i]); |
811 } | 813 } |
812 | 814 |
813 #endif // ENABLE_LOGGING_AND_PROFILING | 815 #endif // ENABLE_LOGGING_AND_PROFILING |
OLD | NEW |