| 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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 | 343 |
| 344 } // namespace | 344 } // namespace |
| 345 | 345 |
| 346 TEST(RecordTickSample) { | 346 TEST(RecordTickSample) { |
| 347 TestSetup test_setup; | 347 TestSetup test_setup; |
| 348 i::Isolate* isolate = CcTest::i_isolate(); | 348 i::Isolate* isolate = CcTest::i_isolate(); |
| 349 CpuProfilesCollection profiles(isolate); | 349 CpuProfilesCollection profiles(isolate); |
| 350 CpuProfiler profiler(isolate); | 350 CpuProfiler profiler(isolate); |
| 351 profiles.set_cpu_profiler(&profiler); | 351 profiles.set_cpu_profiler(&profiler); |
| 352 profiles.StartProfiling("", false); | 352 profiles.StartProfiling("", false); |
| 353 ProfileGenerator generator(isolate, &profiles); | 353 ProfileGenerator generator(&profiles); |
| 354 CodeEntry* entry1 = new CodeEntry(i::Logger::FUNCTION_TAG, "aaa"); | 354 CodeEntry* entry1 = new CodeEntry(i::Logger::FUNCTION_TAG, "aaa"); |
| 355 CodeEntry* entry2 = new CodeEntry(i::Logger::FUNCTION_TAG, "bbb"); | 355 CodeEntry* entry2 = new CodeEntry(i::Logger::FUNCTION_TAG, "bbb"); |
| 356 CodeEntry* entry3 = new CodeEntry(i::Logger::FUNCTION_TAG, "ccc"); | 356 CodeEntry* entry3 = new CodeEntry(i::Logger::FUNCTION_TAG, "ccc"); |
| 357 generator.code_map()->AddCode(ToAddress(0x1500), entry1, 0x200); | 357 generator.code_map()->AddCode(ToAddress(0x1500), entry1, 0x200); |
| 358 generator.code_map()->AddCode(ToAddress(0x1700), entry2, 0x100); | 358 generator.code_map()->AddCode(ToAddress(0x1700), entry2, 0x100); |
| 359 generator.code_map()->AddCode(ToAddress(0x1900), entry3, 0x50); | 359 generator.code_map()->AddCode(ToAddress(0x1900), entry3, 0x50); |
| 360 | 360 |
| 361 // We are building the following calls tree: | 361 // We are building the following calls tree: |
| 362 // -> aaa - sample1 | 362 // -> aaa - sample1 |
| 363 // aaa -> bbb -> ccc - sample2 | 363 // aaa -> bbb -> ccc - sample2 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 } | 416 } |
| 417 | 417 |
| 418 | 418 |
| 419 TEST(SampleIds) { | 419 TEST(SampleIds) { |
| 420 TestSetup test_setup; | 420 TestSetup test_setup; |
| 421 i::Isolate* isolate = CcTest::i_isolate(); | 421 i::Isolate* isolate = CcTest::i_isolate(); |
| 422 CpuProfilesCollection profiles(isolate); | 422 CpuProfilesCollection profiles(isolate); |
| 423 CpuProfiler profiler(isolate); | 423 CpuProfiler profiler(isolate); |
| 424 profiles.set_cpu_profiler(&profiler); | 424 profiles.set_cpu_profiler(&profiler); |
| 425 profiles.StartProfiling("", true); | 425 profiles.StartProfiling("", true); |
| 426 ProfileGenerator generator(isolate, &profiles); | 426 ProfileGenerator generator(&profiles); |
| 427 CodeEntry* entry1 = new CodeEntry(i::Logger::FUNCTION_TAG, "aaa"); | 427 CodeEntry* entry1 = new CodeEntry(i::Logger::FUNCTION_TAG, "aaa"); |
| 428 CodeEntry* entry2 = new CodeEntry(i::Logger::FUNCTION_TAG, "bbb"); | 428 CodeEntry* entry2 = new CodeEntry(i::Logger::FUNCTION_TAG, "bbb"); |
| 429 CodeEntry* entry3 = new CodeEntry(i::Logger::FUNCTION_TAG, "ccc"); | 429 CodeEntry* entry3 = new CodeEntry(i::Logger::FUNCTION_TAG, "ccc"); |
| 430 generator.code_map()->AddCode(ToAddress(0x1500), entry1, 0x200); | 430 generator.code_map()->AddCode(ToAddress(0x1500), entry1, 0x200); |
| 431 generator.code_map()->AddCode(ToAddress(0x1700), entry2, 0x100); | 431 generator.code_map()->AddCode(ToAddress(0x1700), entry2, 0x100); |
| 432 generator.code_map()->AddCode(ToAddress(0x1900), entry3, 0x50); | 432 generator.code_map()->AddCode(ToAddress(0x1900), entry3, 0x50); |
| 433 | 433 |
| 434 // We are building the following calls tree: | 434 // We are building the following calls tree: |
| 435 // -> aaa #3 - sample1 | 435 // -> aaa #3 - sample1 |
| 436 // (root)#1 -> aaa #2 -> bbb #4 -> ccc #5 - sample2 | 436 // (root)#1 -> aaa #2 -> bbb #4 -> ccc #5 - sample2 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 } | 474 } |
| 475 | 475 |
| 476 | 476 |
| 477 TEST(NoSamples) { | 477 TEST(NoSamples) { |
| 478 TestSetup test_setup; | 478 TestSetup test_setup; |
| 479 i::Isolate* isolate = CcTest::i_isolate(); | 479 i::Isolate* isolate = CcTest::i_isolate(); |
| 480 CpuProfilesCollection profiles(isolate); | 480 CpuProfilesCollection profiles(isolate); |
| 481 CpuProfiler profiler(isolate); | 481 CpuProfiler profiler(isolate); |
| 482 profiles.set_cpu_profiler(&profiler); | 482 profiles.set_cpu_profiler(&profiler); |
| 483 profiles.StartProfiling("", false); | 483 profiles.StartProfiling("", false); |
| 484 ProfileGenerator generator(isolate, &profiles); | 484 ProfileGenerator generator(&profiles); |
| 485 CodeEntry* entry1 = new CodeEntry(i::Logger::FUNCTION_TAG, "aaa"); | 485 CodeEntry* entry1 = new CodeEntry(i::Logger::FUNCTION_TAG, "aaa"); |
| 486 generator.code_map()->AddCode(ToAddress(0x1500), entry1, 0x200); | 486 generator.code_map()->AddCode(ToAddress(0x1500), entry1, 0x200); |
| 487 | 487 |
| 488 // We are building the following calls tree: | 488 // We are building the following calls tree: |
| 489 // (root)#1 -> aaa #2 -> aaa #3 - sample1 | 489 // (root)#1 -> aaa #2 -> aaa #3 - sample1 |
| 490 TickSample sample1; | 490 TickSample sample1; |
| 491 sample1.pc = ToAddress(0x1600); | 491 sample1.pc = ToAddress(0x1600); |
| 492 sample1.stack[0] = ToAddress(0x1510); | 492 sample1.stack[0] = ToAddress(0x1510); |
| 493 sample1.frames_count = 1; | 493 sample1.frames_count = 1; |
| 494 generator.RecordTickSample(sample1); | 494 generator.RecordTickSample(sample1); |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 // (root) | 722 // (root) |
| 723 // "" | 723 // "" |
| 724 // kDebuggerStatement | 724 // kDebuggerStatement |
| 725 current = PickChild(current, ""); | 725 current = PickChild(current, ""); |
| 726 CHECK(const_cast<v8::CpuProfileNode*>(current)); | 726 CHECK(const_cast<v8::CpuProfileNode*>(current)); |
| 727 | 727 |
| 728 current = PickChild(current, "Debugger"); | 728 current = PickChild(current, "Debugger"); |
| 729 CHECK(const_cast<v8::CpuProfileNode*>(current)); | 729 CHECK(const_cast<v8::CpuProfileNode*>(current)); |
| 730 CHECK(!strcmp("DebuggerStatement", current->GetBailoutReason())); | 730 CHECK(!strcmp("DebuggerStatement", current->GetBailoutReason())); |
| 731 } | 731 } |
| OLD | NEW |