| 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 30 matching lines...) Expand all Loading... |
| 41 using i::ProfileGenerator; | 41 using i::ProfileGenerator; |
| 42 using i::ProfileNode; | 42 using i::ProfileNode; |
| 43 using i::ProfilerEventsProcessor; | 43 using i::ProfilerEventsProcessor; |
| 44 using i::ScopedVector; | 44 using i::ScopedVector; |
| 45 using i::Vector; | 45 using i::Vector; |
| 46 | 46 |
| 47 | 47 |
| 48 TEST(StartStop) { | 48 TEST(StartStop) { |
| 49 CpuProfilesCollection profiles; | 49 CpuProfilesCollection profiles; |
| 50 ProfileGenerator generator(&profiles); | 50 ProfileGenerator generator(&profiles); |
| 51 ProfilerEventsProcessor processor(&generator); | 51 ProfilerEventsProcessor processor(&generator, NULL, 100); |
| 52 processor.Start(); | 52 processor.Start(); |
| 53 processor.StopSynchronously(); | 53 processor.StopSynchronously(); |
| 54 processor.Join(); | 54 processor.Join(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 | 57 |
| 58 static inline i::Address ToAddress(int n) { | 58 static inline i::Address ToAddress(int n) { |
| 59 return reinterpret_cast<i::Address>(n); | 59 return reinterpret_cast<i::Address>(n); |
| 60 } | 60 } |
| 61 | 61 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 i::Code* comment_code = CreateCode(&env); | 132 i::Code* comment_code = CreateCode(&env); |
| 133 i::Code* args5_code = CreateCode(&env); | 133 i::Code* args5_code = CreateCode(&env); |
| 134 i::Code* comment2_code = CreateCode(&env); | 134 i::Code* comment2_code = CreateCode(&env); |
| 135 i::Code* moved_code = CreateCode(&env); | 135 i::Code* moved_code = CreateCode(&env); |
| 136 i::Code* args3_code = CreateCode(&env); | 136 i::Code* args3_code = CreateCode(&env); |
| 137 i::Code* args4_code = CreateCode(&env); | 137 i::Code* args4_code = CreateCode(&env); |
| 138 | 138 |
| 139 CpuProfilesCollection* profiles = new CpuProfilesCollection; | 139 CpuProfilesCollection* profiles = new CpuProfilesCollection; |
| 140 profiles->StartProfiling("", 1, false); | 140 profiles->StartProfiling("", 1, false); |
| 141 ProfileGenerator generator(profiles); | 141 ProfileGenerator generator(profiles); |
| 142 ProfilerEventsProcessor processor(&generator); | 142 ProfilerEventsProcessor processor(&generator, NULL, 100); |
| 143 processor.Start(); | 143 processor.Start(); |
| 144 CpuProfiler profiler(isolate, profiles, &generator, &processor); | 144 CpuProfiler profiler(isolate, profiles, &generator, &processor); |
| 145 | 145 |
| 146 // Enqueue code creation events. | 146 // Enqueue code creation events. |
| 147 const char* aaa_str = "aaa"; | 147 const char* aaa_str = "aaa"; |
| 148 i::Handle<i::String> aaa_name = factory->NewStringFromAscii( | 148 i::Handle<i::String> aaa_name = factory->NewStringFromAscii( |
| 149 i::Vector<const char>(aaa_str, i::StrLength(aaa_str))); | 149 i::Vector<const char>(aaa_str, i::StrLength(aaa_str))); |
| 150 profiler.CodeCreateEvent(i::Logger::FUNCTION_TAG, aaa_code, *aaa_name); | 150 profiler.CodeCreateEvent(i::Logger::FUNCTION_TAG, aaa_code, *aaa_name); |
| 151 profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, comment_code, "comment"); | 151 profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, comment_code, "comment"); |
| 152 profiler.CodeCreateEvent(i::Logger::STUB_TAG, args5_code, 5); | 152 profiler.CodeCreateEvent(i::Logger::STUB_TAG, args5_code, 5); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 i::Isolate* isolate = i::Isolate::Current(); | 194 i::Isolate* isolate = i::Isolate::Current(); |
| 195 i::HandleScope scope(isolate); | 195 i::HandleScope scope(isolate); |
| 196 | 196 |
| 197 i::Code* frame1_code = CreateCode(&env); | 197 i::Code* frame1_code = CreateCode(&env); |
| 198 i::Code* frame2_code = CreateCode(&env); | 198 i::Code* frame2_code = CreateCode(&env); |
| 199 i::Code* frame3_code = CreateCode(&env); | 199 i::Code* frame3_code = CreateCode(&env); |
| 200 | 200 |
| 201 CpuProfilesCollection* profiles = new CpuProfilesCollection; | 201 CpuProfilesCollection* profiles = new CpuProfilesCollection; |
| 202 profiles->StartProfiling("", 1, false); | 202 profiles->StartProfiling("", 1, false); |
| 203 ProfileGenerator generator(profiles); | 203 ProfileGenerator generator(profiles); |
| 204 ProfilerEventsProcessor processor(&generator); | 204 ProfilerEventsProcessor processor(&generator, NULL, 100); |
| 205 processor.Start(); | 205 processor.Start(); |
| 206 CpuProfiler profiler(isolate, profiles, &generator, &processor); | 206 CpuProfiler profiler(isolate, profiles, &generator, &processor); |
| 207 | 207 |
| 208 profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, frame1_code, "bbb"); | 208 profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, frame1_code, "bbb"); |
| 209 profiler.CodeCreateEvent(i::Logger::STUB_TAG, frame2_code, 5); | 209 profiler.CodeCreateEvent(i::Logger::STUB_TAG, frame2_code, 5); |
| 210 profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, frame3_code, "ddd"); | 210 profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, frame3_code, "ddd"); |
| 211 | 211 |
| 212 EnqueueTickSampleEvent(&processor, frame1_code->instruction_start()); | 212 EnqueueTickSampleEvent(&processor, frame1_code->instruction_start()); |
| 213 EnqueueTickSampleEvent( | 213 EnqueueTickSampleEvent( |
| 214 &processor, | 214 &processor, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 TestSetup test_setup; | 263 TestSetup test_setup; |
| 264 LocalContext env; | 264 LocalContext env; |
| 265 i::Isolate* isolate = i::Isolate::Current(); | 265 i::Isolate* isolate = i::Isolate::Current(); |
| 266 i::HandleScope scope(isolate); | 266 i::HandleScope scope(isolate); |
| 267 | 267 |
| 268 i::Code* code = CreateCode(&env); | 268 i::Code* code = CreateCode(&env); |
| 269 | 269 |
| 270 CpuProfilesCollection* profiles = new CpuProfilesCollection; | 270 CpuProfilesCollection* profiles = new CpuProfilesCollection; |
| 271 profiles->StartProfiling("", 1, false); | 271 profiles->StartProfiling("", 1, false); |
| 272 ProfileGenerator generator(profiles); | 272 ProfileGenerator generator(profiles); |
| 273 ProfilerEventsProcessor processor(&generator); | 273 ProfilerEventsProcessor processor(&generator, NULL, 100); |
| 274 processor.Start(); | 274 processor.Start(); |
| 275 CpuProfiler profiler(isolate, profiles, &generator, &processor); | 275 CpuProfiler profiler(isolate, profiles, &generator, &processor); |
| 276 | 276 |
| 277 profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, code, "bbb"); | 277 profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, code, "bbb"); |
| 278 | 278 |
| 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) { |
| (...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1372 CHECK_GE(programNode->GetHitCount(), 3); | 1372 CHECK_GE(programNode->GetHitCount(), 3); |
| 1373 | 1373 |
| 1374 const v8::CpuProfileNode* idleNode = | 1374 const v8::CpuProfileNode* idleNode = |
| 1375 GetChild(root, ProfileGenerator::kIdleEntryName); | 1375 GetChild(root, ProfileGenerator::kIdleEntryName); |
| 1376 CHECK_EQ(0, idleNode->GetChildrenCount()); | 1376 CHECK_EQ(0, idleNode->GetChildrenCount()); |
| 1377 CHECK_GE(idleNode->GetSelfSamplesCount(), 3); | 1377 CHECK_GE(idleNode->GetSelfSamplesCount(), 3); |
| 1378 CHECK_GE(idleNode->GetHitCount(), 3); | 1378 CHECK_GE(idleNode->GetHitCount(), 3); |
| 1379 | 1379 |
| 1380 cpu_profiler->DeleteAllCpuProfiles(); | 1380 cpu_profiler->DeleteAllCpuProfiles(); |
| 1381 } | 1381 } |
| OLD | NEW |