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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
57 static inline i::Address ToAddress(int n) { | 57 static inline i::Address ToAddress(int n) { |
58 return reinterpret_cast<i::Address>(n); | 58 return reinterpret_cast<i::Address>(n); |
59 } | 59 } |
60 | 60 |
61 static void EnqueueTickSampleEvent(ProfilerEventsProcessor* proc, | 61 static void EnqueueTickSampleEvent(ProfilerEventsProcessor* proc, |
62 i::Address frame1, | 62 i::Address frame1, |
63 i::Address frame2 = NULL, | 63 i::Address frame2 = NULL, |
64 i::Address frame3 = NULL) { | 64 i::Address frame3 = NULL) { |
65 i::TickSample* sample = proc->TickSampleEvent(); | 65 i::TickSample* sample = proc->TickSampleEvent(); |
66 sample->pc = frame1; | 66 sample->pc = frame1; |
67 sample->tos = frame1; | |
loislo
2013/04/12 10:49:26
is external_callback initialized properly?
yurys
2013/04/12 10:54:50
Yes, ProfilerEventsProcessor::TickSampleEvent call
| |
68 sample->frames_count = 0; | 67 sample->frames_count = 0; |
69 if (frame2 != NULL) { | 68 if (frame2 != NULL) { |
70 sample->stack[0] = frame2; | 69 sample->stack[0] = frame2; |
71 sample->frames_count = 1; | 70 sample->frames_count = 1; |
72 } | 71 } |
73 if (frame3 != NULL) { | 72 if (frame3 != NULL) { |
74 sample->stack[1] = frame3; | 73 sample->stack[1] = frame3; |
75 sample->frames_count = 2; | 74 sample->frames_count = 2; |
76 } | 75 } |
77 } | 76 } |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
232 ProfilerEventsProcessor processor(&generator); | 231 ProfilerEventsProcessor processor(&generator); |
233 processor.Start(); | 232 processor.Start(); |
234 | 233 |
235 processor.CodeCreateEvent(i::Logger::BUILTIN_TAG, | 234 processor.CodeCreateEvent(i::Logger::BUILTIN_TAG, |
236 "bbb", | 235 "bbb", |
237 ToAddress(0x1200), | 236 ToAddress(0x1200), |
238 0x80); | 237 0x80); |
239 | 238 |
240 i::TickSample* sample = processor.TickSampleEvent(); | 239 i::TickSample* sample = processor.TickSampleEvent(); |
241 sample->pc = ToAddress(0x1200); | 240 sample->pc = ToAddress(0x1200); |
242 sample->tos = 0; | |
243 sample->frames_count = i::TickSample::kMaxFramesCount; | 241 sample->frames_count = i::TickSample::kMaxFramesCount; |
244 for (int i = 0; i < sample->frames_count; ++i) { | 242 for (int i = 0; i < sample->frames_count; ++i) { |
245 sample->stack[i] = ToAddress(0x1200); | 243 sample->stack[i] = ToAddress(0x1200); |
246 } | 244 } |
247 | 245 |
248 processor.Stop(); | 246 processor.Stop(); |
249 processor.Join(); | 247 processor.Join(); |
250 CpuProfile* profile = | 248 CpuProfile* profile = |
251 profiles.StopProfiling(TokenEnumerator::kNoSecurityToken, "", 1); | 249 profiles.StopProfiling(TokenEnumerator::kNoSecurityToken, "", 1); |
252 CHECK_NE(NULL, profile); | 250 CHECK_NE(NULL, profile); |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
531 | 529 |
532 const char* barBranch[] = { "bar", "delay", "loop" }; | 530 const char* barBranch[] = { "bar", "delay", "loop" }; |
533 CheckSimpleBranch(fooNode, barBranch, ARRAY_SIZE(barBranch)); | 531 CheckSimpleBranch(fooNode, barBranch, ARRAY_SIZE(barBranch)); |
534 const char* bazBranch[] = { "baz", "delay", "loop" }; | 532 const char* bazBranch[] = { "baz", "delay", "loop" }; |
535 CheckSimpleBranch(fooNode, bazBranch, ARRAY_SIZE(bazBranch)); | 533 CheckSimpleBranch(fooNode, bazBranch, ARRAY_SIZE(bazBranch)); |
536 const char* delayBranch[] = { "delay", "loop" }; | 534 const char* delayBranch[] = { "delay", "loop" }; |
537 CheckSimpleBranch(fooNode, delayBranch, ARRAY_SIZE(delayBranch)); | 535 CheckSimpleBranch(fooNode, delayBranch, ARRAY_SIZE(delayBranch)); |
538 | 536 |
539 cpu_profiler->DeleteAllCpuProfiles(); | 537 cpu_profiler->DeleteAllCpuProfiles(); |
540 } | 538 } |
OLD | NEW |