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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 result = Dart_Invoke(lib, NewString("main"), 0, NULL); | 362 result = Dart_Invoke(lib, NewString("main"), 0, NULL); |
363 EXPECT_VALID(result); | 363 EXPECT_VALID(result); |
364 | 364 |
365 { | 365 { |
366 Isolate* isolate = Isolate::Current(); | 366 Isolate* isolate = Isolate::Current(); |
367 StackZone zone(isolate); | 367 StackZone zone(isolate); |
368 HANDLESCOPE(isolate); | 368 HANDLESCOPE(isolate); |
369 Profile profile(isolate); | 369 Profile profile(isolate); |
370 AllocationFilter filter(isolate, class_a.id()); | 370 AllocationFilter filter(isolate, class_a.id()); |
371 profile.Build(&filter, Profile::kNoTags); | 371 profile.Build(&filter, Profile::kNoTags); |
372 // We should have one allocation sample. | 372 // We should have three allocation samples. |
373 EXPECT_EQ(3, profile.sample_count()); | 373 EXPECT_EQ(3, profile.sample_count()); |
374 ProfileTrieWalker walker(&profile); | 374 ProfileTrieWalker walker(&profile); |
375 | 375 |
376 // Exclusive code: B.boo -> main. | 376 // Exclusive code: B.boo -> main. |
377 walker.Reset(Profile::kExclusiveCode); | 377 walker.Reset(Profile::kExclusiveCode); |
378 // Move down from the root. | 378 // Move down from the root. |
379 EXPECT(walker.Down()); | 379 EXPECT(walker.Down()); |
380 EXPECT_STREQ("B.boo", walker.CurrentName()); | 380 EXPECT_STREQ("B.boo", walker.CurrentName()); |
381 EXPECT_EQ(3, walker.CurrentNodeTickCount()); | 381 EXPECT_EQ(3, walker.CurrentNodeTickCount()); |
382 EXPECT_EQ(3, walker.CurrentInclusiveTicks()); | 382 EXPECT_EQ(3, walker.CurrentInclusiveTicks()); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 result = Dart_Invoke(lib, NewString("main"), 0, NULL); | 454 result = Dart_Invoke(lib, NewString("main"), 0, NULL); |
455 EXPECT_VALID(result); | 455 EXPECT_VALID(result); |
456 | 456 |
457 { | 457 { |
458 Isolate* isolate = Isolate::Current(); | 458 Isolate* isolate = Isolate::Current(); |
459 StackZone zone(isolate); | 459 StackZone zone(isolate); |
460 HANDLESCOPE(isolate); | 460 HANDLESCOPE(isolate); |
461 Profile profile(isolate); | 461 Profile profile(isolate); |
462 AllocationFilter filter(isolate, class_a.id()); | 462 AllocationFilter filter(isolate, class_a.id()); |
463 profile.Build(&filter, Profile::kNoTags); | 463 profile.Build(&filter, Profile::kNoTags); |
464 // We should have one allocation sample. | 464 // We should have three allocation samples. |
465 EXPECT_EQ(3, profile.sample_count()); | 465 EXPECT_EQ(3, profile.sample_count()); |
466 ProfileTrieWalker walker(&profile); | 466 ProfileTrieWalker walker(&profile); |
467 | 467 |
468 // Exclusive function: B.boo -> main. | 468 // Exclusive function: B.boo -> main. |
469 walker.Reset(Profile::kExclusiveFunction); | 469 walker.Reset(Profile::kExclusiveFunction); |
470 // Move down from the root. | 470 // Move down from the root. |
471 EXPECT(walker.Down()); | 471 EXPECT(walker.Down()); |
472 EXPECT_STREQ("B.boo", walker.CurrentName()); | 472 EXPECT_STREQ("B.boo", walker.CurrentName()); |
473 EXPECT_EQ(3, walker.CurrentNodeTickCount()); | 473 EXPECT_EQ(3, walker.CurrentNodeTickCount()); |
474 EXPECT_EQ(3, walker.CurrentInclusiveTicks()); | 474 EXPECT_EQ(3, walker.CurrentInclusiveTicks()); |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
909 HANDLESCOPE(isolate); | 909 HANDLESCOPE(isolate); |
910 Profile profile(isolate); | 910 Profile profile(isolate); |
911 AllocationFilter filter(isolate, one_byte_string_class.id()); | 911 AllocationFilter filter(isolate, one_byte_string_class.id()); |
912 profile.Build(&filter, Profile::kNoTags); | 912 profile.Build(&filter, Profile::kNoTags); |
913 // We should now have two allocation samples. | 913 // We should now have two allocation samples. |
914 EXPECT_EQ(2, profile.sample_count()); | 914 EXPECT_EQ(2, profile.sample_count()); |
915 } | 915 } |
916 } | 916 } |
917 | 917 |
918 } // namespace dart | 918 } // namespace dart |
OLD | NEW |