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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 EXPECT(walker.Down()); | 273 EXPECT(walker.Down()); |
274 EXPECT_STREQ("main", walker.CurrentName()); | 274 EXPECT_STREQ("main", walker.CurrentName()); |
275 EXPECT(walker.Down()); | 275 EXPECT(walker.Down()); |
276 EXPECT_STREQ("B.boo", walker.CurrentName()); | 276 EXPECT_STREQ("B.boo", walker.CurrentName()); |
277 EXPECT(!walker.Down()); | 277 EXPECT(!walker.Down()); |
278 | 278 |
279 // Exclusive function: boo -> main. | 279 // Exclusive function: boo -> main. |
280 walker.Reset(Profile::kExclusiveFunction); | 280 walker.Reset(Profile::kExclusiveFunction); |
281 // Move down from the root. | 281 // Move down from the root. |
282 EXPECT(walker.Down()); | 282 EXPECT(walker.Down()); |
283 EXPECT_STREQ("boo", walker.CurrentName()); | 283 EXPECT_STREQ("B.boo", walker.CurrentName()); |
284 EXPECT(walker.Down()); | 284 EXPECT(walker.Down()); |
285 EXPECT_STREQ("main", walker.CurrentName()); | 285 EXPECT_STREQ("main", walker.CurrentName()); |
286 EXPECT(!walker.Down()); | 286 EXPECT(!walker.Down()); |
287 | 287 |
288 // Inclusive function: main -> boo. | 288 // Inclusive function: main -> boo. |
289 walker.Reset(Profile::kInclusiveFunction); | 289 walker.Reset(Profile::kInclusiveFunction); |
290 // Move down from the root. | 290 // Move down from the root. |
291 EXPECT(walker.Down()); | 291 EXPECT(walker.Down()); |
292 EXPECT_STREQ("main", walker.CurrentName()); | 292 EXPECT_STREQ("main", walker.CurrentName()); |
293 EXPECT(walker.Down()); | 293 EXPECT(walker.Down()); |
294 EXPECT_STREQ("boo", walker.CurrentName()); | 294 EXPECT_STREQ("B.boo", walker.CurrentName()); |
295 EXPECT(!walker.Down()); | 295 EXPECT(!walker.Down()); |
296 } | 296 } |
297 | 297 |
298 // Turn off allocation tracing for A. | 298 // Turn off allocation tracing for A. |
299 class_a.SetTraceAllocation(false); | 299 class_a.SetTraceAllocation(false); |
300 | 300 |
301 result = Dart_Invoke(lib, NewString("main"), 0, NULL); | 301 result = Dart_Invoke(lib, NewString("main"), 0, NULL); |
302 EXPECT_VALID(result); | 302 EXPECT_VALID(result); |
303 | 303 |
304 { | 304 { |
305 Isolate* isolate = Isolate::Current(); | 305 Isolate* isolate = Isolate::Current(); |
306 StackZone zone(isolate); | 306 StackZone zone(isolate); |
307 HANDLESCOPE(isolate); | 307 HANDLESCOPE(isolate); |
308 Profile profile(isolate); | 308 Profile profile(isolate); |
309 AllocationFilter filter(isolate, class_a.id()); | 309 AllocationFilter filter(isolate, class_a.id()); |
310 profile.Build(&filter, Profile::kNoTags); | 310 profile.Build(&filter, Profile::kNoTags); |
311 // We should still only have one allocation sample. | 311 // We should still only have one allocation sample. |
312 EXPECT_EQ(1, profile.sample_count()); | 312 EXPECT_EQ(1, profile.sample_count()); |
313 } | 313 } |
314 } | 314 } |
315 | 315 |
316 } // namespace dart | 316 } // namespace dart |
OLD | NEW |