OLD | NEW |
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 967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
978 // We should have one allocation sample. | 978 // We should have one allocation sample. |
979 EXPECT_EQ(1, profile.sample_count()); | 979 EXPECT_EQ(1, profile.sample_count()); |
980 ProfileTrieWalker walker(&profile); | 980 ProfileTrieWalker walker(&profile); |
981 | 981 |
982 walker.Reset(Profile::kExclusiveCode); | 982 walker.Reset(Profile::kExclusiveCode); |
983 EXPECT(walker.Down()); | 983 EXPECT(walker.Down()); |
984 EXPECT_STREQ("DRT_AllocateArray", walker.CurrentName()); | 984 EXPECT_STREQ("DRT_AllocateArray", walker.CurrentName()); |
985 EXPECT(walker.Down()); | 985 EXPECT(walker.Down()); |
986 EXPECT_STREQ("[Stub] AllocateArray", walker.CurrentName()); | 986 EXPECT_STREQ("[Stub] AllocateArray", walker.CurrentName()); |
987 EXPECT(walker.Down()); | 987 EXPECT(walker.Down()); |
988 EXPECT_STREQ("_List._List", walker.CurrentName()); | 988 EXPECT_STREQ("new _List", walker.CurrentName()); |
989 EXPECT(walker.Down()); | 989 EXPECT(walker.Down()); |
990 EXPECT_STREQ("List.List._internal", walker.CurrentName()); | 990 EXPECT_STREQ("new List._internal", walker.CurrentName()); |
991 EXPECT(walker.Down()); | 991 EXPECT(walker.Down()); |
992 EXPECT_STREQ("foo", walker.CurrentName()); | 992 EXPECT_STREQ("foo", walker.CurrentName()); |
993 EXPECT(!walker.Down()); | 993 EXPECT(!walker.Down()); |
994 } | 994 } |
995 | 995 |
996 array_class.SetTraceAllocation(false); | 996 array_class.SetTraceAllocation(false); |
997 result = Dart_Invoke(lib, NewString("foo"), 0, NULL); | 997 result = Dart_Invoke(lib, NewString("foo"), 0, NULL); |
998 EXPECT_VALID(result); | 998 EXPECT_VALID(result); |
999 | 999 |
1000 { | 1000 { |
(...skipping 29 matching lines...) Expand all Loading... |
1030 // We should still only have one allocation sample. | 1030 // We should still only have one allocation sample. |
1031 EXPECT_EQ(1, profile.sample_count()); | 1031 EXPECT_EQ(1, profile.sample_count()); |
1032 ProfileTrieWalker walker(&profile); | 1032 ProfileTrieWalker walker(&profile); |
1033 | 1033 |
1034 walker.Reset(Profile::kExclusiveCode); | 1034 walker.Reset(Profile::kExclusiveCode); |
1035 EXPECT(walker.Down()); | 1035 EXPECT(walker.Down()); |
1036 EXPECT_STREQ("DRT_AllocateArray", walker.CurrentName()); | 1036 EXPECT_STREQ("DRT_AllocateArray", walker.CurrentName()); |
1037 EXPECT(walker.Down()); | 1037 EXPECT(walker.Down()); |
1038 EXPECT_STREQ("[Stub] AllocateArray", walker.CurrentName()); | 1038 EXPECT_STREQ("[Stub] AllocateArray", walker.CurrentName()); |
1039 EXPECT(walker.Down()); | 1039 EXPECT(walker.Down()); |
1040 EXPECT_STREQ("_List._List", walker.CurrentName()); | 1040 EXPECT_STREQ("new _List", walker.CurrentName()); |
1041 EXPECT(walker.Down()); | 1041 EXPECT(walker.Down()); |
1042 EXPECT_STREQ("_GrowableList._GrowableList", walker.CurrentName()); | 1042 EXPECT_STREQ("new _GrowableList", walker.CurrentName()); |
1043 EXPECT(walker.Down()); | 1043 EXPECT(walker.Down()); |
1044 EXPECT_STREQ("List.List._internal", walker.CurrentName()); | 1044 EXPECT_STREQ("new List._internal", walker.CurrentName()); |
1045 EXPECT(walker.Down()); | 1045 EXPECT(walker.Down()); |
1046 EXPECT_STREQ("bar", walker.CurrentName()); | 1046 EXPECT_STREQ("bar", walker.CurrentName()); |
1047 EXPECT(!walker.Down()); | 1047 EXPECT(!walker.Down()); |
1048 } | 1048 } |
1049 } | 1049 } |
1050 | 1050 |
1051 | 1051 |
1052 TEST_CASE(Profiler_ContextAllocation) { | 1052 TEST_CASE(Profiler_ContextAllocation) { |
1053 DisableNativeProfileScope dnps; | 1053 DisableNativeProfileScope dnps; |
1054 const char* kScript = | 1054 const char* kScript = |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1233 AllocationFilter filter(isolate->main_port(), float32_list_class.id()); | 1233 AllocationFilter filter(isolate->main_port(), float32_list_class.id()); |
1234 profile.Build(thread, &filter, Profile::kNoTags); | 1234 profile.Build(thread, &filter, Profile::kNoTags); |
1235 // We should have one allocation sample. | 1235 // We should have one allocation sample. |
1236 EXPECT_EQ(1, profile.sample_count()); | 1236 EXPECT_EQ(1, profile.sample_count()); |
1237 ProfileTrieWalker walker(&profile); | 1237 ProfileTrieWalker walker(&profile); |
1238 | 1238 |
1239 walker.Reset(Profile::kExclusiveCode); | 1239 walker.Reset(Profile::kExclusiveCode); |
1240 EXPECT(walker.Down()); | 1240 EXPECT(walker.Down()); |
1241 EXPECT_STREQ("TypedData_Float32Array_new", walker.CurrentName()); | 1241 EXPECT_STREQ("TypedData_Float32Array_new", walker.CurrentName()); |
1242 EXPECT(walker.Down()); | 1242 EXPECT(walker.Down()); |
1243 EXPECT_STREQ("Float32List.Float32List", walker.CurrentName()); | 1243 EXPECT_STREQ("new Float32List", walker.CurrentName()); |
1244 EXPECT(walker.Down()); | 1244 EXPECT(walker.Down()); |
1245 EXPECT_STREQ("foo", walker.CurrentName()); | 1245 EXPECT_STREQ("foo", walker.CurrentName()); |
1246 EXPECT(!walker.Down()); | 1246 EXPECT(!walker.Down()); |
1247 } | 1247 } |
1248 | 1248 |
1249 float32_list_class.SetTraceAllocation(false); | 1249 float32_list_class.SetTraceAllocation(false); |
1250 result = Dart_Invoke(lib, NewString("foo"), 0, NULL); | 1250 result = Dart_Invoke(lib, NewString("foo"), 0, NULL); |
1251 EXPECT_VALID(result); | 1251 EXPECT_VALID(result); |
1252 | 1252 |
1253 { | 1253 { |
(...skipping 1551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2805 EXPECT_SUBSTRING("\"positions\":[\"TempMove\",39]", js.ToCString()); | 2805 EXPECT_SUBSTRING("\"positions\":[\"TempMove\",39]", js.ToCString()); |
2806 // Verify exclusive ticks in main. | 2806 // Verify exclusive ticks in main. |
2807 EXPECT_SUBSTRING("\"exclusiveTicks\":[1,0]", js.ToCString()); | 2807 EXPECT_SUBSTRING("\"exclusiveTicks\":[1,0]", js.ToCString()); |
2808 // Verify inclusive ticks in main. | 2808 // Verify inclusive ticks in main. |
2809 EXPECT_SUBSTRING("\"inclusiveTicks\":[1,2]", js.ToCString()); | 2809 EXPECT_SUBSTRING("\"inclusiveTicks\":[1,2]", js.ToCString()); |
2810 } | 2810 } |
2811 | 2811 |
2812 #endif // !PRODUCT | 2812 #endif // !PRODUCT |
2813 | 2813 |
2814 } // namespace dart | 2814 } // namespace dart |
OLD | NEW |