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 "cpu-profiler-inl.h" | 8 #include "cpu-profiler-inl.h" |
9 #include "cctest.h" | 9 #include "cctest.h" |
10 | 10 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 ToAddress(0x1200), | 107 ToAddress(0x1200), |
108 0x80); | 108 0x80); |
109 processor.CodeCreateEvent(i::Logger::STUB_TAG, 5, ToAddress(0x1300), 0x10); | 109 processor.CodeCreateEvent(i::Logger::STUB_TAG, 5, ToAddress(0x1300), 0x10); |
110 processor.CodeCreateEvent(i::Logger::BUILTIN_TAG, | 110 processor.CodeCreateEvent(i::Logger::BUILTIN_TAG, |
111 "ddd", | 111 "ddd", |
112 ToAddress(0x1400), | 112 ToAddress(0x1400), |
113 0x80); | 113 0x80); |
114 processor.CodeMoveEvent(ToAddress(0x1400), ToAddress(0x1500)); | 114 processor.CodeMoveEvent(ToAddress(0x1400), ToAddress(0x1500)); |
115 processor.CodeCreateEvent(i::Logger::STUB_TAG, 3, ToAddress(0x1600), 0x10); | 115 processor.CodeCreateEvent(i::Logger::STUB_TAG, 3, ToAddress(0x1600), 0x10); |
116 processor.CodeDeleteEvent(ToAddress(0x1600)); | 116 processor.CodeDeleteEvent(ToAddress(0x1600)); |
117 processor.FunctionCreateEvent(ToAddress(0x1700), ToAddress(0x1000)); | 117 processor.FunctionCreateEvent(ToAddress(0x1700), ToAddress(0x1000), |
| 118 CodeEntry::kNoSecurityToken); |
118 // Enqueue a tick event to enable code events processing. | 119 // Enqueue a tick event to enable code events processing. |
119 EnqueueTickSampleEvent(&processor, ToAddress(0x1000)); | 120 EnqueueTickSampleEvent(&processor, ToAddress(0x1000)); |
120 | 121 |
121 processor.Stop(); | 122 processor.Stop(); |
122 processor.Join(); | 123 processor.Join(); |
123 | 124 |
124 // Check the state of profile generator. | 125 // Check the state of profile generator. |
125 CodeEntry* entry1 = generator.code_map()->FindEntry(ToAddress(0x1000)); | 126 CodeEntry* entry1 = generator.code_map()->FindEntry(ToAddress(0x1000)); |
126 CHECK_NE(NULL, entry1); | 127 CHECK_NE(NULL, entry1); |
127 CHECK_EQ(aaa_str, entry1->name()); | 128 CHECK_EQ(aaa_str, entry1->name()); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 0x80); | 170 0x80); |
170 EnqueueTickSampleEvent(&processor, ToAddress(0x1210)); | 171 EnqueueTickSampleEvent(&processor, ToAddress(0x1210)); |
171 EnqueueTickSampleEvent(&processor, ToAddress(0x1305), ToAddress(0x1220)); | 172 EnqueueTickSampleEvent(&processor, ToAddress(0x1305), ToAddress(0x1220)); |
172 EnqueueTickSampleEvent(&processor, | 173 EnqueueTickSampleEvent(&processor, |
173 ToAddress(0x1404), | 174 ToAddress(0x1404), |
174 ToAddress(0x1305), | 175 ToAddress(0x1305), |
175 ToAddress(0x1230)); | 176 ToAddress(0x1230)); |
176 | 177 |
177 processor.Stop(); | 178 processor.Stop(); |
178 processor.Join(); | 179 processor.Join(); |
179 CpuProfile* profile = profiles.StopProfiling("", 1); | 180 CpuProfile* profile = |
| 181 profiles.StopProfiling(CodeEntry::kNoSecurityToken, "", 1); |
180 CHECK_NE(NULL, profile); | 182 CHECK_NE(NULL, profile); |
181 | 183 |
182 // Check call trees. | 184 // Check call trees. |
183 const i::List<ProfileNode*>* top_down_root_children = | 185 const i::List<ProfileNode*>* top_down_root_children = |
184 profile->top_down()->root()->children(); | 186 profile->top_down()->root()->children(); |
185 CHECK_EQ(1, top_down_root_children->length()); | 187 CHECK_EQ(1, top_down_root_children->length()); |
186 CHECK_EQ("bbb", top_down_root_children->last()->entry()->name()); | 188 CHECK_EQ("bbb", top_down_root_children->last()->entry()->name()); |
187 const i::List<ProfileNode*>* top_down_bbb_children = | 189 const i::List<ProfileNode*>* top_down_bbb_children = |
188 top_down_root_children->last()->children(); | 190 top_down_root_children->last()->children(); |
189 CHECK_EQ(1, top_down_bbb_children->length()); | 191 CHECK_EQ(1, top_down_bbb_children->length()); |
(...skipping 26 matching lines...) Expand all Loading... |
216 bottom_up_root_children[2]->children(); | 218 bottom_up_root_children[2]->children(); |
217 CHECK_EQ(1, bottom_up_ddd_children->length()); | 219 CHECK_EQ(1, bottom_up_ddd_children->length()); |
218 CHECK_EQ("5", bottom_up_ddd_children->last()->entry()->name()); | 220 CHECK_EQ("5", bottom_up_ddd_children->last()->entry()->name()); |
219 const i::List<ProfileNode*>* bottom_up_ddd_stub_children = | 221 const i::List<ProfileNode*>* bottom_up_ddd_stub_children = |
220 bottom_up_ddd_children->last()->children(); | 222 bottom_up_ddd_children->last()->children(); |
221 CHECK_EQ(1, bottom_up_ddd_stub_children->length()); | 223 CHECK_EQ(1, bottom_up_ddd_stub_children->length()); |
222 CHECK_EQ("bbb", bottom_up_ddd_stub_children->last()->entry()->name()); | 224 CHECK_EQ("bbb", bottom_up_ddd_stub_children->last()->entry()->name()); |
223 } | 225 } |
224 | 226 |
225 #endif // ENABLE_LOGGING_AND_PROFILING | 227 #endif // ENABLE_LOGGING_AND_PROFILING |
OLD | NEW |