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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 profiles->StartProfiling("", false); | 161 profiles->StartProfiling("", false); |
162 ProfileGenerator generator(profiles); | 162 ProfileGenerator generator(profiles); |
163 SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor( | 163 SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor( |
164 &generator, NULL, v8::base::TimeDelta::FromMicroseconds(100))); | 164 &generator, NULL, v8::base::TimeDelta::FromMicroseconds(100))); |
165 processor->Start(); | 165 processor->Start(); |
166 CpuProfiler profiler(isolate, profiles, &generator, processor.get()); | 166 CpuProfiler profiler(isolate, profiles, &generator, processor.get()); |
167 | 167 |
168 // Enqueue code creation events. | 168 // Enqueue code creation events. |
169 const char* aaa_str = "aaa"; | 169 const char* aaa_str = "aaa"; |
170 i::Handle<i::String> aaa_name = factory->NewStringFromAsciiChecked(aaa_str); | 170 i::Handle<i::String> aaa_name = factory->NewStringFromAsciiChecked(aaa_str); |
171 profiler.CodeCreateEvent(i::Logger::FUNCTION_TAG, aaa_code, *aaa_name); | 171 profiler.CodeCreateEvent(i::CodeEventListener::FUNCTION_TAG, aaa_code, |
172 profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, comment_code, "comment"); | 172 *aaa_name); |
173 profiler.CodeCreateEvent(i::Logger::STUB_TAG, args5_code, 5); | 173 profiler.CodeCreateEvent(i::CodeEventListener::BUILTIN_TAG, comment_code, |
174 profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, comment2_code, "comment2"); | 174 "comment"); |
| 175 profiler.CodeCreateEvent(i::CodeEventListener::STUB_TAG, args5_code, 5); |
| 176 profiler.CodeCreateEvent(i::CodeEventListener::BUILTIN_TAG, comment2_code, |
| 177 "comment2"); |
175 profiler.CodeMoveEvent(comment2_code, moved_code->address()); | 178 profiler.CodeMoveEvent(comment2_code, moved_code->address()); |
176 profiler.CodeCreateEvent(i::Logger::STUB_TAG, args3_code, 3); | 179 profiler.CodeCreateEvent(i::CodeEventListener::STUB_TAG, args3_code, 3); |
177 profiler.CodeCreateEvent(i::Logger::STUB_TAG, args4_code, 4); | 180 profiler.CodeCreateEvent(i::CodeEventListener::STUB_TAG, args4_code, 4); |
178 | 181 |
179 // Enqueue a tick event to enable code events processing. | 182 // Enqueue a tick event to enable code events processing. |
180 EnqueueTickSampleEvent(processor.get(), aaa_code->address()); | 183 EnqueueTickSampleEvent(processor.get(), aaa_code->address()); |
181 | 184 |
182 processor->StopSynchronously(); | 185 processor->StopSynchronously(); |
183 | 186 |
184 // Check the state of profile generator. | 187 // Check the state of profile generator. |
185 CodeEntry* aaa = generator.code_map()->FindEntry(aaa_code->address()); | 188 CodeEntry* aaa = generator.code_map()->FindEntry(aaa_code->address()); |
186 CHECK(aaa); | 189 CHECK(aaa); |
187 CHECK_EQ(0, strcmp(aaa_str, aaa->name())); | 190 CHECK_EQ(0, strcmp(aaa_str, aaa->name())); |
(...skipping 29 matching lines...) Expand all Loading... |
217 i::AbstractCode* frame3_code = CreateCode(&env); | 220 i::AbstractCode* frame3_code = CreateCode(&env); |
218 | 221 |
219 CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate->heap()); | 222 CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate->heap()); |
220 profiles->StartProfiling("", false); | 223 profiles->StartProfiling("", false); |
221 ProfileGenerator generator(profiles); | 224 ProfileGenerator generator(profiles); |
222 SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor( | 225 SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor( |
223 &generator, NULL, v8::base::TimeDelta::FromMicroseconds(100))); | 226 &generator, NULL, v8::base::TimeDelta::FromMicroseconds(100))); |
224 processor->Start(); | 227 processor->Start(); |
225 CpuProfiler profiler(isolate, profiles, &generator, processor.get()); | 228 CpuProfiler profiler(isolate, profiles, &generator, processor.get()); |
226 | 229 |
227 profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, frame1_code, "bbb"); | 230 profiler.CodeCreateEvent(i::CodeEventListener::BUILTIN_TAG, frame1_code, |
228 profiler.CodeCreateEvent(i::Logger::STUB_TAG, frame2_code, 5); | 231 "bbb"); |
229 profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, frame3_code, "ddd"); | 232 profiler.CodeCreateEvent(i::CodeEventListener::STUB_TAG, frame2_code, 5); |
| 233 profiler.CodeCreateEvent(i::CodeEventListener::BUILTIN_TAG, frame3_code, |
| 234 "ddd"); |
230 | 235 |
231 EnqueueTickSampleEvent(processor.get(), frame1_code->instruction_start()); | 236 EnqueueTickSampleEvent(processor.get(), frame1_code->instruction_start()); |
232 EnqueueTickSampleEvent( | 237 EnqueueTickSampleEvent( |
233 processor.get(), | 238 processor.get(), |
234 frame2_code->instruction_start() + frame2_code->ExecutableSize() / 2, | 239 frame2_code->instruction_start() + frame2_code->ExecutableSize() / 2, |
235 frame1_code->instruction_start() + frame2_code->ExecutableSize() / 2); | 240 frame1_code->instruction_start() + frame2_code->ExecutableSize() / 2); |
236 EnqueueTickSampleEvent( | 241 EnqueueTickSampleEvent( |
237 processor.get(), | 242 processor.get(), |
238 frame3_code->instruction_end() - 1, | 243 frame3_code->instruction_end() - 1, |
239 frame2_code->instruction_end() - 1, | 244 frame2_code->instruction_end() - 1, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 i::AbstractCode* code = CreateCode(&env); | 289 i::AbstractCode* code = CreateCode(&env); |
285 | 290 |
286 CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate->heap()); | 291 CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate->heap()); |
287 profiles->StartProfiling("", false); | 292 profiles->StartProfiling("", false); |
288 ProfileGenerator generator(profiles); | 293 ProfileGenerator generator(profiles); |
289 SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor( | 294 SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor( |
290 &generator, NULL, v8::base::TimeDelta::FromMicroseconds(100))); | 295 &generator, NULL, v8::base::TimeDelta::FromMicroseconds(100))); |
291 processor->Start(); | 296 processor->Start(); |
292 CpuProfiler profiler(isolate, profiles, &generator, processor.get()); | 297 CpuProfiler profiler(isolate, profiles, &generator, processor.get()); |
293 | 298 |
294 profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, code, "bbb"); | 299 profiler.CodeCreateEvent(i::CodeEventListener::BUILTIN_TAG, code, "bbb"); |
295 | 300 |
296 i::TickSample* sample = processor->StartTickSample(); | 301 i::TickSample* sample = processor->StartTickSample(); |
297 sample->pc = code->address(); | 302 sample->pc = code->address(); |
298 sample->tos = 0; | 303 sample->tos = 0; |
299 sample->frames_count = i::TickSample::kMaxFramesCount; | 304 sample->frames_count = i::TickSample::kMaxFramesCount; |
300 for (unsigned i = 0; i < sample->frames_count; ++i) { | 305 for (unsigned i = 0; i < sample->frames_count; ++i) { |
301 sample->stack[i] = code->address(); | 306 sample->stack[i] = code->address(); |
302 } | 307 } |
303 processor->FinishTickSample(); | 308 processor->FinishTickSample(); |
304 | 309 |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1026 ProfileGenerator generator(profiles); | 1031 ProfileGenerator generator(profiles); |
1027 SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor( | 1032 SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor( |
1028 &generator, NULL, v8::base::TimeDelta::FromMicroseconds(100))); | 1033 &generator, NULL, v8::base::TimeDelta::FromMicroseconds(100))); |
1029 processor->Start(); | 1034 processor->Start(); |
1030 CpuProfiler profiler(isolate, profiles, &generator, processor.get()); | 1035 CpuProfiler profiler(isolate, profiles, &generator, processor.get()); |
1031 | 1036 |
1032 // Enqueue code creation events. | 1037 // Enqueue code creation events. |
1033 i::Handle<i::String> str = factory->NewStringFromAsciiChecked(func_name); | 1038 i::Handle<i::String> str = factory->NewStringFromAsciiChecked(func_name); |
1034 int line = 1; | 1039 int line = 1; |
1035 int column = 1; | 1040 int column = 1; |
1036 profiler.CodeCreateEvent(i::Logger::FUNCTION_TAG, code, func->shared(), *str, | 1041 profiler.CodeCreateEvent(i::CodeEventListener::FUNCTION_TAG, code, |
1037 line, column); | 1042 func->shared(), *str, line, column); |
1038 | 1043 |
1039 // Enqueue a tick event to enable code events processing. | 1044 // Enqueue a tick event to enable code events processing. |
1040 EnqueueTickSampleEvent(processor.get(), code_address); | 1045 EnqueueTickSampleEvent(processor.get(), code_address); |
1041 | 1046 |
1042 processor->StopSynchronously(); | 1047 processor->StopSynchronously(); |
1043 | 1048 |
1044 CpuProfile* profile = profiles->StopProfiling(""); | 1049 CpuProfile* profile = profiles->StopProfiling(""); |
1045 CHECK(profile); | 1050 CHECK(profile); |
1046 | 1051 |
1047 // Check the state of profile generator. | 1052 // Check the state of profile generator. |
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2023 iprofile->Print(); | 2028 iprofile->Print(); |
2024 v8::CpuProfile* profile = reinterpret_cast<v8::CpuProfile*>(iprofile); | 2029 v8::CpuProfile* profile = reinterpret_cast<v8::CpuProfile*>(iprofile); |
2025 | 2030 |
2026 const char* branch[] = {"", "test"}; | 2031 const char* branch[] = {"", "test"}; |
2027 const ProfileNode* itest_node = | 2032 const ProfileNode* itest_node = |
2028 GetSimpleBranch(env, profile, branch, arraysize(branch)); | 2033 GetSimpleBranch(env, profile, branch, arraysize(branch)); |
2029 CHECK_EQ(0U, itest_node->deopt_infos().size()); | 2034 CHECK_EQ(0U, itest_node->deopt_infos().size()); |
2030 | 2035 |
2031 iprofiler->DeleteProfile(iprofile); | 2036 iprofiler->DeleteProfile(iprofile); |
2032 } | 2037 } |
OLD | NEW |