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

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

Issue 1268803006: Support profiler code transition tags (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « runtime/vm/profiler_service.cc ('k') | runtime/vm/service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 EXPECT_EQ(50000, walker.CurrentInclusiveTicks()); 1069 EXPECT_EQ(50000, walker.CurrentInclusiveTicks());
1070 EXPECT_EQ(0, walker.CurrentExclusiveTicks()); 1070 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
1071 EXPECT(walker.Down()); 1071 EXPECT(walker.Down());
1072 EXPECT_STREQ("B.choo", walker.CurrentName()); 1072 EXPECT_STREQ("B.choo", walker.CurrentName());
1073 EXPECT_EQ(1, walker.SiblingCount()); 1073 EXPECT_EQ(1, walker.SiblingCount());
1074 EXPECT_EQ(50000, walker.CurrentNodeTickCount()); 1074 EXPECT_EQ(50000, walker.CurrentNodeTickCount());
1075 EXPECT_EQ(50000, walker.CurrentInclusiveTicks()); 1075 EXPECT_EQ(50000, walker.CurrentInclusiveTicks());
1076 EXPECT_EQ(50000, walker.CurrentExclusiveTicks()); 1076 EXPECT_EQ(50000, walker.CurrentExclusiveTicks());
1077 EXPECT(!walker.Down()); 1077 EXPECT(!walker.Down());
1078 } 1078 }
1079
1080 // Test code transition tags.
1081 {
1082 Isolate* isolate = Isolate::Current();
1083 StackZone zone(isolate);
1084 HANDLESCOPE(isolate);
1085 Profile profile(isolate);
1086 AllocationFilter filter(isolate, class_a.id());
1087 profile.Build(&filter,
1088 Profile::kNoTags,
1089 ProfilerService::kCodeTransitionTagsBit);
1090 // We should have 50,000 allocation samples.
1091 EXPECT_EQ(50000, profile.sample_count());
1092 ProfileTrieWalker walker(&profile);
1093 // We have two code objects: mainA and B.boo.
1094 walker.Reset(Profile::kExclusiveCode);
1095 EXPECT(walker.Down());
1096 EXPECT_STREQ("B.boo", walker.CurrentName());
1097 EXPECT(walker.Down());
1098 EXPECT_STREQ("[Optimized Code]", walker.CurrentName());
1099 EXPECT(walker.Down());
1100 EXPECT_STREQ("mainA", walker.CurrentName());
1101 EXPECT(walker.Down());
1102 EXPECT_STREQ("[Unoptimized Code]", walker.CurrentName());
1103 EXPECT(!walker.Down());
1104 // We have two code objects: mainA and B.boo.
1105 walker.Reset(Profile::kInclusiveCode);
1106 EXPECT(walker.Down());
1107 EXPECT_STREQ("[Unoptimized Code]", walker.CurrentName());
1108 EXPECT(walker.Down());
1109 EXPECT_STREQ("mainA", walker.CurrentName());
1110 EXPECT(walker.Down());
1111 EXPECT_STREQ("[Optimized Code]", walker.CurrentName());
1112 EXPECT(walker.Down());
1113 EXPECT_STREQ("B.boo", walker.CurrentName());
1114 EXPECT(!walker.Down());
1115
1116 // Inline expansion should show us the complete call chain:
1117 // mainA -> B.boo -> B.foo -> B.choo.
1118 walker.Reset(Profile::kExclusiveFunction);
1119 EXPECT(walker.Down());
1120 EXPECT_STREQ("[Inline End]", walker.CurrentName());
1121 EXPECT(walker.Down());
1122 EXPECT_STREQ("B.choo", walker.CurrentName());
1123 EXPECT(walker.Down());
1124 EXPECT_STREQ("B.foo", walker.CurrentName());
1125 EXPECT(walker.Down());
1126 EXPECT_STREQ("[Inline Start]", walker.CurrentName());
1127 EXPECT(walker.Down());
1128 EXPECT_STREQ("B.boo", walker.CurrentName());
1129 EXPECT(walker.Down());
1130 EXPECT_STREQ("[Optimized Code]", walker.CurrentName());
1131 EXPECT(walker.Down());
1132 EXPECT_STREQ("mainA", walker.CurrentName());
1133 EXPECT(walker.Down());
1134 EXPECT_STREQ("[Unoptimized Code]", walker.CurrentName());
1135 EXPECT(!walker.Down());
1136
1137 // Inline expansion should show us the complete call chain:
1138 // mainA -> B.boo -> B.foo -> B.choo.
1139 walker.Reset(Profile::kInclusiveFunction);
1140 EXPECT(walker.Down());
1141 EXPECT_STREQ("[Unoptimized Code]", walker.CurrentName());
1142 EXPECT(walker.Down());
1143 EXPECT_STREQ("mainA", walker.CurrentName());
1144 EXPECT(walker.Down());
1145 EXPECT_STREQ("[Optimized Code]", walker.CurrentName());
1146 EXPECT(walker.Down());
1147 EXPECT_STREQ("B.boo", walker.CurrentName());
1148 EXPECT(walker.Down());
1149 EXPECT_STREQ("[Inline Start]", walker.CurrentName());
1150 EXPECT(walker.Down());
1151 EXPECT_STREQ("B.foo", walker.CurrentName());
1152 EXPECT(walker.Down());
1153 EXPECT_STREQ("B.choo", walker.CurrentName());
1154 EXPECT(walker.Down());
1155 EXPECT_STREQ("[Inline End]", walker.CurrentName());
1156 EXPECT(!walker.Down());
1157 }
1079 } 1158 }
1080 1159
1081 } // namespace dart 1160 } // namespace dart
1161
OLDNEW
« no previous file with comments | « runtime/vm/profiler_service.cc ('k') | runtime/vm/service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698