OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 frame2_code->instruction_start() + frame2_code->ExecutableSize() / 2, | 215 frame2_code->instruction_start() + frame2_code->ExecutableSize() / 2, |
216 frame1_code->instruction_start() + frame2_code->ExecutableSize() / 2); | 216 frame1_code->instruction_start() + frame2_code->ExecutableSize() / 2); |
217 EnqueueTickSampleEvent( | 217 EnqueueTickSampleEvent( |
218 &processor, | 218 &processor, |
219 frame3_code->instruction_end() - 1, | 219 frame3_code->instruction_end() - 1, |
220 frame2_code->instruction_end() - 1, | 220 frame2_code->instruction_end() - 1, |
221 frame1_code->instruction_end() - 1); | 221 frame1_code->instruction_end() - 1); |
222 | 222 |
223 processor.StopSynchronously(); | 223 processor.StopSynchronously(); |
224 processor.Join(); | 224 processor.Join(); |
225 CpuProfile* profile = profiles->StopProfiling("", 1); | 225 CpuProfile* profile = profiles->StopProfiling(""); |
226 CHECK_NE(NULL, profile); | 226 CHECK_NE(NULL, profile); |
227 | 227 |
228 // Check call trees. | 228 // Check call trees. |
229 const i::List<ProfileNode*>* top_down_root_children = | 229 const i::List<ProfileNode*>* top_down_root_children = |
230 profile->top_down()->root()->children(); | 230 profile->top_down()->root()->children(); |
231 CHECK_EQ(1, top_down_root_children->length()); | 231 CHECK_EQ(1, top_down_root_children->length()); |
232 CHECK_EQ("bbb", top_down_root_children->last()->entry()->name()); | 232 CHECK_EQ("bbb", top_down_root_children->last()->entry()->name()); |
233 const i::List<ProfileNode*>* top_down_bbb_children = | 233 const i::List<ProfileNode*>* top_down_bbb_children = |
234 top_down_root_children->last()->children(); | 234 top_down_root_children->last()->children(); |
235 CHECK_EQ(1, top_down_bbb_children->length()); | 235 CHECK_EQ(1, top_down_bbb_children->length()); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 i::TickSample* sample = processor.TickSampleEvent(); | 279 i::TickSample* sample = processor.TickSampleEvent(); |
280 sample->pc = code->address(); | 280 sample->pc = code->address(); |
281 sample->tos = 0; | 281 sample->tos = 0; |
282 sample->frames_count = i::TickSample::kMaxFramesCount; | 282 sample->frames_count = i::TickSample::kMaxFramesCount; |
283 for (int i = 0; i < sample->frames_count; ++i) { | 283 for (int i = 0; i < sample->frames_count; ++i) { |
284 sample->stack[i] = code->address(); | 284 sample->stack[i] = code->address(); |
285 } | 285 } |
286 | 286 |
287 processor.StopSynchronously(); | 287 processor.StopSynchronously(); |
288 processor.Join(); | 288 processor.Join(); |
289 CpuProfile* profile = profiles->StopProfiling("", 1); | 289 CpuProfile* profile = profiles->StopProfiling(""); |
290 CHECK_NE(NULL, profile); | 290 CHECK_NE(NULL, profile); |
291 | 291 |
292 int actual_depth = 0; | 292 int actual_depth = 0; |
293 const ProfileNode* node = profile->top_down()->root(); | 293 const ProfileNode* node = profile->top_down()->root(); |
294 while (node->children()->length() > 0) { | 294 while (node->children()->length() > 0) { |
295 node = node->children()->last(); | 295 node = node->children()->last(); |
296 ++actual_depth; | 296 ++actual_depth; |
297 } | 297 } |
298 | 298 |
299 CHECK_EQ(1 + i::TickSample::kMaxFramesCount, actual_depth); // +1 for PC. | 299 CHECK_EQ(1 + i::TickSample::kMaxFramesCount, actual_depth); // +1 for PC. |
(...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1302 | 1302 |
1303 CHECK_EQ(1, barNode->GetChildrenCount()); | 1303 CHECK_EQ(1, barNode->GetChildrenCount()); |
1304 const v8::CpuProfileNode* nativeNode2 = GetChild(barNode, "CallJsFunction2"); | 1304 const v8::CpuProfileNode* nativeNode2 = GetChild(barNode, "CallJsFunction2"); |
1305 | 1305 |
1306 CHECK_EQ(1, nativeNode2->GetChildrenCount()); | 1306 CHECK_EQ(1, nativeNode2->GetChildrenCount()); |
1307 GetChild(nativeNode2, "foo"); | 1307 GetChild(nativeNode2, "foo"); |
1308 | 1308 |
1309 v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler(); | 1309 v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler(); |
1310 cpu_profiler->DeleteAllCpuProfiles(); | 1310 cpu_profiler->DeleteAllCpuProfiles(); |
1311 } | 1311 } |
OLD | NEW |