| 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 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 bool old_flag_prof_browser_mode_; | 604 bool old_flag_prof_browser_mode_; |
| 605 }; | 605 }; |
| 606 | 606 |
| 607 } // namespace | 607 } // namespace |
| 608 | 608 |
| 609 TEST(RecordTickSample) { | 609 TEST(RecordTickSample) { |
| 610 TestSetup test_setup; | 610 TestSetup test_setup; |
| 611 CpuProfilesCollection profiles; | 611 CpuProfilesCollection profiles; |
| 612 profiles.StartProfiling("", 1, false); | 612 profiles.StartProfiling("", 1, false); |
| 613 ProfileGenerator generator(&profiles); | 613 ProfileGenerator generator(&profiles); |
| 614 CodeEntry* entry1 = generator.NewCodeEntry(i::Logger::FUNCTION_TAG, "aaa"); | 614 CodeEntry* entry1 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "aaa"); |
| 615 CodeEntry* entry2 = generator.NewCodeEntry(i::Logger::FUNCTION_TAG, "bbb"); | 615 CodeEntry* entry2 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "bbb"); |
| 616 CodeEntry* entry3 = generator.NewCodeEntry(i::Logger::FUNCTION_TAG, "ccc"); | 616 CodeEntry* entry3 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "ccc"); |
| 617 generator.code_map()->AddCode(ToAddress(0x1500), entry1, 0x200); | 617 generator.code_map()->AddCode(ToAddress(0x1500), entry1, 0x200); |
| 618 generator.code_map()->AddCode(ToAddress(0x1700), entry2, 0x100); | 618 generator.code_map()->AddCode(ToAddress(0x1700), entry2, 0x100); |
| 619 generator.code_map()->AddCode(ToAddress(0x1900), entry3, 0x50); | 619 generator.code_map()->AddCode(ToAddress(0x1900), entry3, 0x50); |
| 620 | 620 |
| 621 // We are building the following calls tree: | 621 // We are building the following calls tree: |
| 622 // -> aaa - sample1 | 622 // -> aaa - sample1 |
| 623 // aaa -> bbb -> ccc - sample2 | 623 // aaa -> bbb -> ccc - sample2 |
| 624 // -> ccc -> aaa - sample3 | 624 // -> ccc -> aaa - sample3 |
| 625 TickSample sample1; | 625 TickSample sample1; |
| 626 sample1.pc = ToAddress(0x1600); | 626 sample1.pc = ToAddress(0x1600); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 for (int i = 0; i < node->children()->length(); i++) { | 720 for (int i = 0; i < node->children()->length(); i++) { |
| 721 CheckNodeIds(node->children()->at(i), expectedId); | 721 CheckNodeIds(node->children()->at(i), expectedId); |
| 722 } | 722 } |
| 723 } | 723 } |
| 724 | 724 |
| 725 TEST(SampleIds) { | 725 TEST(SampleIds) { |
| 726 TestSetup test_setup; | 726 TestSetup test_setup; |
| 727 CpuProfilesCollection profiles; | 727 CpuProfilesCollection profiles; |
| 728 profiles.StartProfiling("", 1, true); | 728 profiles.StartProfiling("", 1, true); |
| 729 ProfileGenerator generator(&profiles); | 729 ProfileGenerator generator(&profiles); |
| 730 CodeEntry* entry1 = generator.NewCodeEntry(i::Logger::FUNCTION_TAG, "aaa"); | 730 CodeEntry* entry1 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "aaa"); |
| 731 CodeEntry* entry2 = generator.NewCodeEntry(i::Logger::FUNCTION_TAG, "bbb"); | 731 CodeEntry* entry2 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "bbb"); |
| 732 CodeEntry* entry3 = generator.NewCodeEntry(i::Logger::FUNCTION_TAG, "ccc"); | 732 CodeEntry* entry3 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "ccc"); |
| 733 generator.code_map()->AddCode(ToAddress(0x1500), entry1, 0x200); | 733 generator.code_map()->AddCode(ToAddress(0x1500), entry1, 0x200); |
| 734 generator.code_map()->AddCode(ToAddress(0x1700), entry2, 0x100); | 734 generator.code_map()->AddCode(ToAddress(0x1700), entry2, 0x100); |
| 735 generator.code_map()->AddCode(ToAddress(0x1900), entry3, 0x50); | 735 generator.code_map()->AddCode(ToAddress(0x1900), entry3, 0x50); |
| 736 | 736 |
| 737 // We are building the following calls tree: | 737 // We are building the following calls tree: |
| 738 // -> aaa #3 - sample1 | 738 // -> aaa #3 - sample1 |
| 739 // (root)#1 -> aaa #2 -> bbb #4 -> ccc #5 - sample2 | 739 // (root)#1 -> aaa #2 -> bbb #4 -> ccc #5 - sample2 |
| 740 // -> ccc #6 -> aaa #7 - sample3 | 740 // -> ccc #6 -> aaa #7 - sample3 |
| 741 TickSample sample1; | 741 TickSample sample1; |
| 742 sample1.pc = ToAddress(0x1600); | 742 sample1.pc = ToAddress(0x1600); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 769 CHECK_EQ(expected_id[i], profile->sample(i)->id()); | 769 CHECK_EQ(expected_id[i], profile->sample(i)->id()); |
| 770 } | 770 } |
| 771 } | 771 } |
| 772 | 772 |
| 773 | 773 |
| 774 TEST(NoSamples) { | 774 TEST(NoSamples) { |
| 775 TestSetup test_setup; | 775 TestSetup test_setup; |
| 776 CpuProfilesCollection profiles; | 776 CpuProfilesCollection profiles; |
| 777 profiles.StartProfiling("", 1, false); | 777 profiles.StartProfiling("", 1, false); |
| 778 ProfileGenerator generator(&profiles); | 778 ProfileGenerator generator(&profiles); |
| 779 CodeEntry* entry1 = generator.NewCodeEntry(i::Logger::FUNCTION_TAG, "aaa"); | 779 CodeEntry* entry1 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "aaa"); |
| 780 generator.code_map()->AddCode(ToAddress(0x1500), entry1, 0x200); | 780 generator.code_map()->AddCode(ToAddress(0x1500), entry1, 0x200); |
| 781 | 781 |
| 782 // We are building the following calls tree: | 782 // We are building the following calls tree: |
| 783 // (root)#1 -> aaa #2 -> aaa #3 - sample1 | 783 // (root)#1 -> aaa #2 -> aaa #3 - sample1 |
| 784 TickSample sample1; | 784 TickSample sample1; |
| 785 sample1.pc = ToAddress(0x1600); | 785 sample1.pc = ToAddress(0x1600); |
| 786 sample1.stack[0] = ToAddress(0x1510); | 786 sample1.stack[0] = ToAddress(0x1510); |
| 787 sample1.frames_count = 1; | 787 sample1.frames_count = 1; |
| 788 generator.RecordTickSample(sample1); | 788 generator.RecordTickSample(sample1); |
| 789 | 789 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 i::OS::SNPrintF(title, "%d", i); | 926 i::OS::SNPrintF(title, "%d", i); |
| 927 // UID must be > 0. | 927 // UID must be > 0. |
| 928 CHECK(collection.StartProfiling(title.start(), i + 1, false)); | 928 CHECK(collection.StartProfiling(title.start(), i + 1, false)); |
| 929 titles[i] = title.start(); | 929 titles[i] = title.start(); |
| 930 } | 930 } |
| 931 CHECK(!collection.StartProfiling( | 931 CHECK(!collection.StartProfiling( |
| 932 "maximum", CpuProfilesCollection::kMaxSimultaneousProfiles + 1, false)); | 932 "maximum", CpuProfilesCollection::kMaxSimultaneousProfiles + 1, false)); |
| 933 for (int i = 0; i < CpuProfilesCollection::kMaxSimultaneousProfiles; ++i) | 933 for (int i = 0; i < CpuProfilesCollection::kMaxSimultaneousProfiles; ++i) |
| 934 i::DeleteArray(titles[i]); | 934 i::DeleteArray(titles[i]); |
| 935 } | 935 } |
| OLD | NEW |