Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: runtime/vm/profiler_test.cc

Issue 1723733002: Simplify various name flavors in VM. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/assert.h" 5 #include "platform/assert.h"
6 6
7 #include "vm/dart_api_impl.h" 7 #include "vm/dart_api_impl.h"
8 #include "vm/dart_api_state.h" 8 #include "vm/dart_api_state.h"
9 #include "vm/globals.h" 9 #include "vm/globals.h"
10 #include "vm/profiler.h" 10 #include "vm/profiler.h"
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 HANDLESCOPE(thread); 653 HANDLESCOPE(thread);
654 Profile profile(isolate); 654 Profile profile(isolate);
655 AllocationFilter filter(isolate, double_class.id()); 655 AllocationFilter filter(isolate, double_class.id());
656 profile.Build(thread, &filter, Profile::kNoTags); 656 profile.Build(thread, &filter, Profile::kNoTags);
657 // We should have one allocation sample. 657 // We should have one allocation sample.
658 EXPECT_EQ(1, profile.sample_count()); 658 EXPECT_EQ(1, profile.sample_count());
659 ProfileTrieWalker walker(&profile); 659 ProfileTrieWalker walker(&profile);
660 660
661 walker.Reset(Profile::kExclusiveCode); 661 walker.Reset(Profile::kExclusiveCode);
662 EXPECT(walker.Down()); 662 EXPECT(walker.Down());
663 EXPECT_STREQ("_Double._add", walker.CurrentName()); 663 EXPECT_STREQ("double._add", walker.CurrentName());
664 EXPECT(walker.Down()); 664 EXPECT(walker.Down());
665 EXPECT_STREQ("_Double.+", walker.CurrentName()); 665 EXPECT_STREQ("double.+", walker.CurrentName());
666 EXPECT(walker.Down()); 666 EXPECT(walker.Down());
667 EXPECT_STREQ("foo", walker.CurrentName()); 667 EXPECT_STREQ("foo", walker.CurrentName());
668 EXPECT(!walker.Down()); 668 EXPECT(!walker.Down());
669 } 669 }
670 670
671 double_class.SetTraceAllocation(false); 671 double_class.SetTraceAllocation(false);
672 result = Dart_Invoke(lib, NewString("foo"), 2, &args[0]); 672 result = Dart_Invoke(lib, NewString("foo"), 2, &args[0]);
673 EXPECT_VALID(result); 673 EXPECT_VALID(result);
674 674
675 { 675 {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 HANDLESCOPE(thread); 721 HANDLESCOPE(thread);
722 Profile profile(isolate); 722 Profile profile(isolate);
723 AllocationFilter filter(isolate, array_class.id()); 723 AllocationFilter filter(isolate, array_class.id());
724 profile.Build(thread, &filter, Profile::kNoTags); 724 profile.Build(thread, &filter, Profile::kNoTags);
725 // We should have one allocation sample. 725 // We should have one allocation sample.
726 EXPECT_EQ(1, profile.sample_count()); 726 EXPECT_EQ(1, profile.sample_count());
727 ProfileTrieWalker walker(&profile); 727 ProfileTrieWalker walker(&profile);
728 728
729 walker.Reset(Profile::kExclusiveCode); 729 walker.Reset(Profile::kExclusiveCode);
730 EXPECT(walker.Down()); 730 EXPECT(walker.Down());
731 EXPECT_STREQ("_List._List", walker.CurrentName()); 731 EXPECT_STREQ("List._List", walker.CurrentName());
732 EXPECT(walker.Down()); 732 EXPECT(walker.Down());
733 EXPECT_STREQ("List.List", walker.CurrentName()); 733 EXPECT_STREQ("List.List", walker.CurrentName());
734 EXPECT(walker.Down()); 734 EXPECT(walker.Down());
735 EXPECT_STREQ("foo", walker.CurrentName()); 735 EXPECT_STREQ("foo", walker.CurrentName());
736 EXPECT(!walker.Down()); 736 EXPECT(!walker.Down());
737 } 737 }
738 738
739 array_class.SetTraceAllocation(false); 739 array_class.SetTraceAllocation(false);
740 result = Dart_Invoke(lib, NewString("foo"), 0, NULL); 740 result = Dart_Invoke(lib, NewString("foo"), 0, NULL);
741 EXPECT_VALID(result); 741 EXPECT_VALID(result);
(...skipping 27 matching lines...) Expand all
769 HANDLESCOPE(thread); 769 HANDLESCOPE(thread);
770 Profile profile(isolate); 770 Profile profile(isolate);
771 AllocationFilter filter(isolate, array_class.id()); 771 AllocationFilter filter(isolate, array_class.id());
772 profile.Build(thread, &filter, Profile::kNoTags); 772 profile.Build(thread, &filter, Profile::kNoTags);
773 // We should still only have one allocation sample. 773 // We should still only have one allocation sample.
774 EXPECT_EQ(1, profile.sample_count()); 774 EXPECT_EQ(1, profile.sample_count());
775 ProfileTrieWalker walker(&profile); 775 ProfileTrieWalker walker(&profile);
776 776
777 walker.Reset(Profile::kExclusiveCode); 777 walker.Reset(Profile::kExclusiveCode);
778 EXPECT(walker.Down()); 778 EXPECT(walker.Down());
779 EXPECT_STREQ("_List._List", walker.CurrentName()); 779 EXPECT_STREQ("List._List", walker.CurrentName());
780 EXPECT(walker.Down()); 780 EXPECT(walker.Down());
781 EXPECT_STREQ("_GrowableList._GrowableList", walker.CurrentName()); 781 EXPECT_STREQ("List._GrowableList", walker.CurrentName());
782 EXPECT(walker.Down()); 782 EXPECT(walker.Down());
783 EXPECT_STREQ("List.List", walker.CurrentName()); 783 EXPECT_STREQ("List.List", walker.CurrentName());
784 EXPECT(walker.Down()); 784 EXPECT(walker.Down());
785 EXPECT_STREQ("bar", walker.CurrentName()); 785 EXPECT_STREQ("bar", walker.CurrentName());
786 EXPECT(!walker.Down()); 786 EXPECT(!walker.Down());
787 } 787 }
788 } 788 }
789 789
790 790
791 TEST_CASE(Profiler_ContextAllocation) { 791 TEST_CASE(Profiler_ContextAllocation) {
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 HANDLESCOPE(thread); 963 HANDLESCOPE(thread);
964 Profile profile(isolate); 964 Profile profile(isolate);
965 AllocationFilter filter(isolate, float32_list_class.id()); 965 AllocationFilter filter(isolate, float32_list_class.id());
966 profile.Build(thread, &filter, Profile::kNoTags); 966 profile.Build(thread, &filter, Profile::kNoTags);
967 // We should have one allocation sample. 967 // We should have one allocation sample.
968 EXPECT_EQ(1, profile.sample_count()); 968 EXPECT_EQ(1, profile.sample_count());
969 ProfileTrieWalker walker(&profile); 969 ProfileTrieWalker walker(&profile);
970 970
971 walker.Reset(Profile::kExclusiveCode); 971 walker.Reset(Profile::kExclusiveCode);
972 EXPECT(walker.Down()); 972 EXPECT(walker.Down());
973 EXPECT_STREQ("_Float32Array._new", walker.CurrentName()); 973 EXPECT_STREQ("Float32List._new", walker.CurrentName());
974 EXPECT(walker.Down()); 974 EXPECT(walker.Down());
975 EXPECT_STREQ("_Float32Array._Float32Array", walker.CurrentName()); 975 EXPECT_STREQ("Float32List._Float32Array", walker.CurrentName());
976 EXPECT(walker.Down()); 976 EXPECT(walker.Down());
977 EXPECT_STREQ("Float32List.Float32List", walker.CurrentName()); 977 EXPECT_STREQ("Float32List.Float32List", walker.CurrentName());
978 EXPECT(walker.Down()); 978 EXPECT(walker.Down());
979 EXPECT_STREQ("foo", walker.CurrentName()); 979 EXPECT_STREQ("foo", walker.CurrentName());
980 EXPECT(!walker.Down()); 980 EXPECT(!walker.Down());
981 } 981 }
982 982
983 float32_list_class.SetTraceAllocation(false); 983 float32_list_class.SetTraceAllocation(false);
984 result = Dart_Invoke(lib, NewString("foo"), 0, NULL); 984 result = Dart_Invoke(lib, NewString("foo"), 0, NULL);
985 EXPECT_VALID(result); 985 EXPECT_VALID(result);
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1127 HANDLESCOPE(thread); 1127 HANDLESCOPE(thread);
1128 Profile profile(isolate); 1128 Profile profile(isolate);
1129 AllocationFilter filter(isolate, one_byte_string_class.id()); 1129 AllocationFilter filter(isolate, one_byte_string_class.id());
1130 profile.Build(thread, &filter, Profile::kNoTags); 1130 profile.Build(thread, &filter, Profile::kNoTags);
1131 // We should still only have one allocation sample. 1131 // We should still only have one allocation sample.
1132 EXPECT_EQ(1, profile.sample_count()); 1132 EXPECT_EQ(1, profile.sample_count());
1133 ProfileTrieWalker walker(&profile); 1133 ProfileTrieWalker walker(&profile);
1134 1134
1135 walker.Reset(Profile::kExclusiveCode); 1135 walker.Reset(Profile::kExclusiveCode);
1136 EXPECT(walker.Down()); 1136 EXPECT(walker.Down());
1137 EXPECT_STREQ("_OneByteString._allocate", walker.CurrentName()); 1137 EXPECT_STREQ("String._allocate", walker.CurrentName());
1138 EXPECT(walker.Down()); 1138 EXPECT(walker.Down());
1139 EXPECT_STREQ("_OneByteString._concatAll", walker.CurrentName()); 1139 EXPECT_STREQ("String._concatAll", walker.CurrentName());
1140 EXPECT(walker.Down()); 1140 EXPECT(walker.Down());
1141 EXPECT_STREQ("_StringBase._interpolate", walker.CurrentName()); 1141 EXPECT_STREQ("_StringBase._interpolate", walker.CurrentName());
1142 EXPECT(walker.Down()); 1142 EXPECT(walker.Down());
1143 EXPECT_STREQ("foo", walker.CurrentName()); 1143 EXPECT_STREQ("foo", walker.CurrentName());
1144 EXPECT(!walker.Down()); 1144 EXPECT(!walker.Down());
1145 } 1145 }
1146 1146
1147 one_byte_string_class.SetTraceAllocation(false); 1147 one_byte_string_class.SetTraceAllocation(false);
1148 result = Dart_Invoke(lib, NewString("foo"), 2, &args[0]); 1148 result = Dart_Invoke(lib, NewString("foo"), 2, &args[0]);
1149 EXPECT_VALID(result); 1149 EXPECT_VALID(result);
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
1655 EXPECT_STREQ("go", walker.CurrentName()); 1655 EXPECT_STREQ("go", walker.CurrentName());
1656 EXPECT(walker.Down()); 1656 EXPECT(walker.Down());
1657 EXPECT_STREQ("main", walker.CurrentName()); 1657 EXPECT_STREQ("main", walker.CurrentName());
1658 EXPECT(!walker.Down()); 1658 EXPECT(!walker.Down());
1659 } 1659 }
1660 } 1660 }
1661 1661
1662 #endif // !PRODUCT 1662 #endif // !PRODUCT
1663 1663
1664 } // namespace dart 1664 } // namespace dart
OLDNEW
« runtime/observatory/tests/service/get_object_rpc_test.dart ('K') | « runtime/vm/profiler_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698