| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // | 2 // |
| 3 // Tests of profiles generator and utilities. | 3 // Tests of profiles generator and utilities. |
| 4 | 4 |
| 5 #ifdef ENABLE_LOGGING_AND_PROFILING | 5 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 6 | 6 |
| 7 #include "v8.h" | 7 #include "v8.h" |
| 8 #include "profile-generator-inl.h" | 8 #include "profile-generator-inl.h" |
| 9 #include "cctest.h" | 9 #include "cctest.h" |
| 10 #include "../include/v8-profiler.h" | 10 #include "../include/v8-profiler.h" |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 generator.code_map()->AddCode(ToAddress(0x1500), entry1, 0x200); | 593 generator.code_map()->AddCode(ToAddress(0x1500), entry1, 0x200); |
| 594 generator.code_map()->AddCode(ToAddress(0x1700), entry2, 0x100); | 594 generator.code_map()->AddCode(ToAddress(0x1700), entry2, 0x100); |
| 595 generator.code_map()->AddCode(ToAddress(0x1900), entry3, 0x50); | 595 generator.code_map()->AddCode(ToAddress(0x1900), entry3, 0x50); |
| 596 | 596 |
| 597 // We are building the following calls tree: | 597 // We are building the following calls tree: |
| 598 // -> aaa - sample1 | 598 // -> aaa - sample1 |
| 599 // aaa -> bbb -> ccc - sample2 | 599 // aaa -> bbb -> ccc - sample2 |
| 600 // -> ccc -> aaa - sample3 | 600 // -> ccc -> aaa - sample3 |
| 601 TickSample sample1; | 601 TickSample sample1; |
| 602 sample1.pc = ToAddress(0x1600); | 602 sample1.pc = ToAddress(0x1600); |
| 603 sample1.function = ToAddress(0x1500); | 603 sample1.tos = ToAddress(0x1500); |
| 604 sample1.stack[0] = ToAddress(0x1510); | 604 sample1.stack[0] = ToAddress(0x1510); |
| 605 sample1.frames_count = 1; | 605 sample1.frames_count = 1; |
| 606 generator.RecordTickSample(sample1); | 606 generator.RecordTickSample(sample1); |
| 607 TickSample sample2; | 607 TickSample sample2; |
| 608 sample2.pc = ToAddress(0x1925); | 608 sample2.pc = ToAddress(0x1925); |
| 609 sample2.function = ToAddress(0x1900); | 609 sample2.tos = ToAddress(0x1900); |
| 610 sample2.stack[0] = ToAddress(0x1780); | 610 sample2.stack[0] = ToAddress(0x1780); |
| 611 sample2.stack[1] = ToAddress(0x10000); // non-existent. | 611 sample2.stack[1] = ToAddress(0x10000); // non-existent. |
| 612 sample2.stack[2] = ToAddress(0x1620); | 612 sample2.stack[2] = ToAddress(0x1620); |
| 613 sample2.frames_count = 3; | 613 sample2.frames_count = 3; |
| 614 generator.RecordTickSample(sample2); | 614 generator.RecordTickSample(sample2); |
| 615 TickSample sample3; | 615 TickSample sample3; |
| 616 sample3.pc = ToAddress(0x1510); | 616 sample3.pc = ToAddress(0x1510); |
| 617 sample3.function = ToAddress(0x1500); | 617 sample3.tos = ToAddress(0x1500); |
| 618 sample3.stack[0] = ToAddress(0x1910); | 618 sample3.stack[0] = ToAddress(0x1910); |
| 619 sample3.stack[1] = ToAddress(0x1610); | 619 sample3.stack[1] = ToAddress(0x1610); |
| 620 sample3.frames_count = 2; | 620 sample3.frames_count = 2; |
| 621 generator.RecordTickSample(sample3); | 621 generator.RecordTickSample(sample3); |
| 622 | 622 |
| 623 CpuProfile* profile = | 623 CpuProfile* profile = |
| 624 profiles.StopProfiling(TokenEnumerator::kNoSecurityToken, "", 1); | 624 profiles.StopProfiling(TokenEnumerator::kNoSecurityToken, "", 1); |
| 625 CHECK_NE(NULL, profile); | 625 CHECK_NE(NULL, profile); |
| 626 ProfileTreeTestHelper top_down_test_helper(profile->top_down()); | 626 ProfileTreeTestHelper top_down_test_helper(profile->top_down()); |
| 627 CHECK_EQ(NULL, top_down_test_helper.Walk(entry2)); | 627 CHECK_EQ(NULL, top_down_test_helper.Walk(entry2)); |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 CHECK(collection.StartProfiling(title.start(), i + 1)); // UID must be > 0. | 819 CHECK(collection.StartProfiling(title.start(), i + 1)); // UID must be > 0. |
| 820 titles[i] = title.start(); | 820 titles[i] = title.start(); |
| 821 } | 821 } |
| 822 CHECK(!collection.StartProfiling( | 822 CHECK(!collection.StartProfiling( |
| 823 "maximum", CpuProfilesCollection::kMaxSimultaneousProfiles + 1)); | 823 "maximum", CpuProfilesCollection::kMaxSimultaneousProfiles + 1)); |
| 824 for (int i = 0; i < CpuProfilesCollection::kMaxSimultaneousProfiles; ++i) | 824 for (int i = 0; i < CpuProfilesCollection::kMaxSimultaneousProfiles; ++i) |
| 825 i::DeleteArray(titles[i]); | 825 i::DeleteArray(titles[i]); |
| 826 } | 826 } |
| 827 | 827 |
| 828 #endif // ENABLE_LOGGING_AND_PROFILING | 828 #endif // ENABLE_LOGGING_AND_PROFILING |
| OLD | NEW |