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

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

Issue 2510093005: Revert "Fix tsan failure" (Closed)
Patch Set: Created 4 years, 1 month 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.cc ('k') | runtime/vm/stack_frame.h » ('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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 // We should have 1 allocation sample. 245 // We should have 1 allocation sample.
246 EXPECT_EQ(1, profile.sample_count()); 246 EXPECT_EQ(1, profile.sample_count());
247 ProfileTrieWalker walker(&profile); 247 ProfileTrieWalker walker(&profile);
248 248
249 // Exclusive code: B.boo -> main. 249 // Exclusive code: B.boo -> main.
250 walker.Reset(Profile::kExclusiveCode); 250 walker.Reset(Profile::kExclusiveCode);
251 // Move down from the root. 251 // Move down from the root.
252 EXPECT(walker.Down()); 252 EXPECT(walker.Down());
253 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName()); 253 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
254 EXPECT(walker.Down()); 254 EXPECT(walker.Down());
255 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
256 EXPECT(walker.Down());
257 EXPECT_STREQ("B.boo", walker.CurrentName()); 255 EXPECT_STREQ("B.boo", walker.CurrentName());
258 EXPECT(walker.Down()); 256 EXPECT(walker.Down());
259 EXPECT_STREQ("main", walker.CurrentName()); 257 EXPECT_STREQ("main", walker.CurrentName());
260 EXPECT(!walker.Down()); 258 EXPECT(!walker.Down());
261 259
262 // Inclusive code: main -> B.boo. 260 // Inclusive code: main -> B.boo.
263 walker.Reset(Profile::kInclusiveCode); 261 walker.Reset(Profile::kInclusiveCode);
264 // Move down from the root. 262 // Move down from the root.
265 EXPECT(walker.Down()); 263 EXPECT(walker.Down());
266 EXPECT_STREQ("main", walker.CurrentName()); 264 EXPECT_STREQ("main", walker.CurrentName());
267 EXPECT(walker.Down()); 265 EXPECT(walker.Down());
268 EXPECT_STREQ("B.boo", walker.CurrentName()); 266 EXPECT_STREQ("B.boo", walker.CurrentName());
269 EXPECT(walker.Down()); 267 EXPECT(walker.Down());
270 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
271 EXPECT(walker.Down());
272 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName()); 268 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
273 EXPECT(!walker.Down()); 269 EXPECT(!walker.Down());
274 270
275 // Exclusive function: B.boo -> main. 271 // Exclusive function: B.boo -> main.
276 walker.Reset(Profile::kExclusiveFunction); 272 walker.Reset(Profile::kExclusiveFunction);
277 // Move down from the root. 273 // Move down from the root.
278 EXPECT(walker.Down()); 274 EXPECT(walker.Down());
279 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName()); 275 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
280 EXPECT(walker.Down()); 276 EXPECT(walker.Down());
281 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
282 EXPECT(walker.Down());
283 EXPECT_STREQ("B.boo", walker.CurrentName()); 277 EXPECT_STREQ("B.boo", walker.CurrentName());
284 EXPECT(walker.Down()); 278 EXPECT(walker.Down());
285 EXPECT_STREQ("main", walker.CurrentName()); 279 EXPECT_STREQ("main", walker.CurrentName());
286 EXPECT(!walker.Down()); 280 EXPECT(!walker.Down());
287 281
288 // Inclusive function: main -> B.boo. 282 // Inclusive function: main -> B.boo.
289 walker.Reset(Profile::kInclusiveFunction); 283 walker.Reset(Profile::kInclusiveFunction);
290 // Move down from the root. 284 // Move down from the root.
291 EXPECT(walker.Down()); 285 EXPECT(walker.Down());
292 EXPECT_STREQ("main", walker.CurrentName()); 286 EXPECT_STREQ("main", walker.CurrentName());
293 EXPECT(walker.Down()); 287 EXPECT(walker.Down());
294 EXPECT_STREQ("B.boo", walker.CurrentName()); 288 EXPECT_STREQ("B.boo", walker.CurrentName());
295 EXPECT(walker.Down()); 289 EXPECT(walker.Down());
296 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
297 EXPECT(walker.Down());
298 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName()); 290 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
299 EXPECT(!walker.Down()); 291 EXPECT(!walker.Down());
300 } 292 }
301 293
302 // Query with a time filter where no allocations occurred. 294 // Query with a time filter where no allocations occurred.
303 { 295 {
304 Thread* thread = Thread::Current(); 296 Thread* thread = Thread::Current();
305 Isolate* isolate = thread->isolate(); 297 Isolate* isolate = thread->isolate();
306 StackZone zone(thread); 298 StackZone zone(thread);
307 HANDLESCOPE(thread); 299 HANDLESCOPE(thread);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 // We should have one allocation sample. 365 // We should have one allocation sample.
374 EXPECT_EQ(1, profile.sample_count()); 366 EXPECT_EQ(1, profile.sample_count());
375 ProfileTrieWalker walker(&profile); 367 ProfileTrieWalker walker(&profile);
376 368
377 // Exclusive code: B.boo -> main. 369 // Exclusive code: B.boo -> main.
378 walker.Reset(Profile::kExclusiveCode); 370 walker.Reset(Profile::kExclusiveCode);
379 // Move down from the root. 371 // Move down from the root.
380 EXPECT(walker.Down()); 372 EXPECT(walker.Down());
381 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName()); 373 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
382 EXPECT(walker.Down()); 374 EXPECT(walker.Down());
383 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
384 EXPECT(walker.Down());
385 EXPECT_STREQ("B.boo", walker.CurrentName()); 375 EXPECT_STREQ("B.boo", walker.CurrentName());
386 EXPECT(walker.Down()); 376 EXPECT(walker.Down());
387 EXPECT_STREQ("main", walker.CurrentName()); 377 EXPECT_STREQ("main", walker.CurrentName());
388 EXPECT(!walker.Down()); 378 EXPECT(!walker.Down());
389 379
390 // Inclusive code: main -> B.boo. 380 // Inclusive code: main -> B.boo.
391 walker.Reset(Profile::kInclusiveCode); 381 walker.Reset(Profile::kInclusiveCode);
392 // Move down from the root. 382 // Move down from the root.
393 EXPECT(walker.Down()); 383 EXPECT(walker.Down());
394 EXPECT_STREQ("main", walker.CurrentName()); 384 EXPECT_STREQ("main", walker.CurrentName());
395 EXPECT(walker.Down()); 385 EXPECT(walker.Down());
396 EXPECT_STREQ("B.boo", walker.CurrentName()); 386 EXPECT_STREQ("B.boo", walker.CurrentName());
397 EXPECT(walker.Down()); 387 EXPECT(walker.Down());
398 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
399 EXPECT(walker.Down());
400 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName()); 388 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
401 EXPECT(!walker.Down()); 389 EXPECT(!walker.Down());
402 390
403 // Exclusive function: boo -> main. 391 // Exclusive function: boo -> main.
404 walker.Reset(Profile::kExclusiveFunction); 392 walker.Reset(Profile::kExclusiveFunction);
405 // Move down from the root. 393 // Move down from the root.
406 EXPECT(walker.Down()); 394 EXPECT(walker.Down());
407 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName()); 395 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
408 EXPECT(walker.Down()); 396 EXPECT(walker.Down());
409 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
410 EXPECT(walker.Down());
411 EXPECT_STREQ("B.boo", walker.CurrentName()); 397 EXPECT_STREQ("B.boo", walker.CurrentName());
412 EXPECT(walker.Down()); 398 EXPECT(walker.Down());
413 EXPECT_STREQ("main", walker.CurrentName()); 399 EXPECT_STREQ("main", walker.CurrentName());
414 EXPECT(!walker.Down()); 400 EXPECT(!walker.Down());
415 401
416 // Inclusive function: main -> boo. 402 // Inclusive function: main -> boo.
417 walker.Reset(Profile::kInclusiveFunction); 403 walker.Reset(Profile::kInclusiveFunction);
418 // Move down from the root. 404 // Move down from the root.
419 EXPECT(walker.Down()); 405 EXPECT(walker.Down());
420 EXPECT_STREQ("main", walker.CurrentName()); 406 EXPECT_STREQ("main", walker.CurrentName());
421 EXPECT(walker.Down()); 407 EXPECT(walker.Down());
422 EXPECT_STREQ("B.boo", walker.CurrentName()); 408 EXPECT_STREQ("B.boo", walker.CurrentName());
423 EXPECT(walker.Down()); 409 EXPECT(walker.Down());
424 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
425 EXPECT(walker.Down());
426 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName()); 410 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
427 EXPECT(!walker.Down()); 411 EXPECT(!walker.Down());
428 } 412 }
429 413
430 // Turn off allocation tracing for A. 414 // Turn off allocation tracing for A.
431 class_a.SetTraceAllocation(false); 415 class_a.SetTraceAllocation(false);
432 416
433 result = Dart_Invoke(lib, NewString("main"), 0, NULL); 417 result = Dart_Invoke(lib, NewString("main"), 0, NULL);
434 EXPECT_VALID(result); 418 EXPECT_VALID(result);
435 419
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 // We should have three allocation samples. 492 // We should have three allocation samples.
509 EXPECT_EQ(3, profile.sample_count()); 493 EXPECT_EQ(3, profile.sample_count());
510 ProfileTrieWalker walker(&profile); 494 ProfileTrieWalker walker(&profile);
511 495
512 // Exclusive code: B.boo -> main. 496 // Exclusive code: B.boo -> main.
513 walker.Reset(Profile::kExclusiveCode); 497 walker.Reset(Profile::kExclusiveCode);
514 // Move down from the root. 498 // Move down from the root.
515 EXPECT(walker.Down()); 499 EXPECT(walker.Down());
516 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName()); 500 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
517 EXPECT(walker.Down()); 501 EXPECT(walker.Down());
518 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
519 EXPECT_EQ(3, walker.CurrentExclusiveTicks());
520 EXPECT(walker.Down());
521 EXPECT_STREQ("B.boo", walker.CurrentName()); 502 EXPECT_STREQ("B.boo", walker.CurrentName());
522 EXPECT_EQ(3, walker.CurrentNodeTickCount()); 503 EXPECT_EQ(3, walker.CurrentNodeTickCount());
523 EXPECT_EQ(3, walker.CurrentInclusiveTicks()); 504 EXPECT_EQ(3, walker.CurrentInclusiveTicks());
505 EXPECT_EQ(3, walker.CurrentExclusiveTicks());
524 EXPECT(walker.Down()); 506 EXPECT(walker.Down());
525 EXPECT_STREQ("main", walker.CurrentName()); 507 EXPECT_STREQ("main", walker.CurrentName());
526 EXPECT_EQ(3, walker.CurrentNodeTickCount()); 508 EXPECT_EQ(3, walker.CurrentNodeTickCount());
527 EXPECT_EQ(3, walker.CurrentInclusiveTicks()); 509 EXPECT_EQ(3, walker.CurrentInclusiveTicks());
528 EXPECT_EQ(0, walker.CurrentExclusiveTicks()); 510 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
529 EXPECT(!walker.Down()); 511 EXPECT(!walker.Down());
530 512
531 // Inclusive code: main -> B.boo. 513 // Inclusive code: main -> B.boo.
532 walker.Reset(Profile::kInclusiveCode); 514 walker.Reset(Profile::kInclusiveCode);
533 // Move down from the root. 515 // Move down from the root.
534 EXPECT(walker.Down()); 516 EXPECT(walker.Down());
535 EXPECT_STREQ("main", walker.CurrentName()); 517 EXPECT_STREQ("main", walker.CurrentName());
536 EXPECT_EQ(3, walker.CurrentNodeTickCount()); 518 EXPECT_EQ(3, walker.CurrentNodeTickCount());
537 EXPECT_EQ(3, walker.CurrentInclusiveTicks()); 519 EXPECT_EQ(3, walker.CurrentInclusiveTicks());
538 EXPECT_EQ(0, walker.CurrentExclusiveTicks()); 520 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
539 EXPECT(walker.Down()); 521 EXPECT(walker.Down());
540 EXPECT_STREQ("B.boo", walker.CurrentName()); 522 EXPECT_STREQ("B.boo", walker.CurrentName());
541 EXPECT_EQ(3, walker.CurrentNodeTickCount()); 523 EXPECT_EQ(3, walker.CurrentNodeTickCount());
542 EXPECT_EQ(3, walker.CurrentInclusiveTicks()); 524 EXPECT_EQ(3, walker.CurrentInclusiveTicks());
543 EXPECT(walker.Down());
544 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
545 EXPECT_EQ(3, walker.CurrentExclusiveTicks()); 525 EXPECT_EQ(3, walker.CurrentExclusiveTicks());
546 EXPECT(walker.Down()); 526 EXPECT(walker.Down());
547 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName()); 527 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
548 EXPECT(!walker.Down()); 528 EXPECT(!walker.Down());
549 } 529 }
550 } 530 }
551 531
552 532
553 TEST_CASE(Profiler_FunctionTicks) { 533 TEST_CASE(Profiler_FunctionTicks) {
554 DisableNativeProfileScope dnps; 534 DisableNativeProfileScope dnps;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 // We should have three allocation samples. 591 // We should have three allocation samples.
612 EXPECT_EQ(3, profile.sample_count()); 592 EXPECT_EQ(3, profile.sample_count());
613 ProfileTrieWalker walker(&profile); 593 ProfileTrieWalker walker(&profile);
614 594
615 // Exclusive function: B.boo -> main. 595 // Exclusive function: B.boo -> main.
616 walker.Reset(Profile::kExclusiveFunction); 596 walker.Reset(Profile::kExclusiveFunction);
617 // Move down from the root. 597 // Move down from the root.
618 EXPECT(walker.Down()); 598 EXPECT(walker.Down());
619 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName()); 599 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
620 EXPECT(walker.Down()); 600 EXPECT(walker.Down());
621 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
622 EXPECT_EQ(3, walker.CurrentExclusiveTicks());
623 EXPECT(walker.Down());
624 EXPECT_STREQ("B.boo", walker.CurrentName()); 601 EXPECT_STREQ("B.boo", walker.CurrentName());
625 EXPECT_EQ(3, walker.CurrentNodeTickCount()); 602 EXPECT_EQ(3, walker.CurrentNodeTickCount());
626 EXPECT_EQ(3, walker.CurrentInclusiveTicks()); 603 EXPECT_EQ(3, walker.CurrentInclusiveTicks());
604 EXPECT_EQ(3, walker.CurrentExclusiveTicks());
627 EXPECT(walker.Down()); 605 EXPECT(walker.Down());
628 EXPECT_STREQ("main", walker.CurrentName()); 606 EXPECT_STREQ("main", walker.CurrentName());
629 EXPECT_EQ(3, walker.CurrentNodeTickCount()); 607 EXPECT_EQ(3, walker.CurrentNodeTickCount());
630 EXPECT_EQ(3, walker.CurrentInclusiveTicks()); 608 EXPECT_EQ(3, walker.CurrentInclusiveTicks());
631 EXPECT_EQ(0, walker.CurrentExclusiveTicks()); 609 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
632 EXPECT(!walker.Down()); 610 EXPECT(!walker.Down());
633 611
634 // Inclusive function: main -> B.boo. 612 // Inclusive function: main -> B.boo.
635 walker.Reset(Profile::kInclusiveFunction); 613 walker.Reset(Profile::kInclusiveFunction);
636 // Move down from the root. 614 // Move down from the root.
637 EXPECT(walker.Down()); 615 EXPECT(walker.Down());
638 EXPECT_STREQ("main", walker.CurrentName()); 616 EXPECT_STREQ("main", walker.CurrentName());
639 EXPECT_EQ(3, walker.CurrentNodeTickCount()); 617 EXPECT_EQ(3, walker.CurrentNodeTickCount());
640 EXPECT_EQ(3, walker.CurrentInclusiveTicks()); 618 EXPECT_EQ(3, walker.CurrentInclusiveTicks());
641 EXPECT_EQ(0, walker.CurrentExclusiveTicks()); 619 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
642 EXPECT(walker.Down()); 620 EXPECT(walker.Down());
643 EXPECT_STREQ("B.boo", walker.CurrentName()); 621 EXPECT_STREQ("B.boo", walker.CurrentName());
644 EXPECT_EQ(3, walker.CurrentNodeTickCount()); 622 EXPECT_EQ(3, walker.CurrentNodeTickCount());
645 EXPECT_EQ(3, walker.CurrentInclusiveTicks()); 623 EXPECT_EQ(3, walker.CurrentInclusiveTicks());
646 EXPECT(walker.Down());
647 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
648 EXPECT_EQ(3, walker.CurrentExclusiveTicks()); 624 EXPECT_EQ(3, walker.CurrentExclusiveTicks());
649 EXPECT(walker.Down()); 625 EXPECT(walker.Down());
650 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName()); 626 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
651 EXPECT(!walker.Down()); 627 EXPECT(!walker.Down());
652 } 628 }
653 } 629 }
654 630
655 631
656 TEST_CASE(Profiler_IntrinsicAllocation) { 632 TEST_CASE(Profiler_IntrinsicAllocation) {
657 DisableNativeProfileScope dnps; 633 DisableNativeProfileScope dnps;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 AllocationFilter filter(isolate, array_class.id()); 740 AllocationFilter filter(isolate, array_class.id());
765 profile.Build(thread, &filter, Profile::kNoTags); 741 profile.Build(thread, &filter, Profile::kNoTags);
766 // We should have one allocation sample. 742 // We should have one allocation sample.
767 EXPECT_EQ(1, profile.sample_count()); 743 EXPECT_EQ(1, profile.sample_count());
768 ProfileTrieWalker walker(&profile); 744 ProfileTrieWalker walker(&profile);
769 745
770 walker.Reset(Profile::kExclusiveCode); 746 walker.Reset(Profile::kExclusiveCode);
771 EXPECT(walker.Down()); 747 EXPECT(walker.Down());
772 EXPECT_STREQ("DRT_AllocateArray", walker.CurrentName()); 748 EXPECT_STREQ("DRT_AllocateArray", walker.CurrentName());
773 EXPECT(walker.Down()); 749 EXPECT(walker.Down());
774 EXPECT_STREQ("[Stub] AllocateArray", walker.CurrentName());
775 EXPECT(walker.Down());
776 EXPECT_STREQ("_List._List", walker.CurrentName()); 750 EXPECT_STREQ("_List._List", walker.CurrentName());
777 EXPECT(walker.Down()); 751 EXPECT(walker.Down());
778 EXPECT_STREQ("List.List", walker.CurrentName()); 752 EXPECT_STREQ("List.List", walker.CurrentName());
779 EXPECT(walker.Down()); 753 EXPECT(walker.Down());
780 EXPECT_STREQ("foo", walker.CurrentName()); 754 EXPECT_STREQ("foo", walker.CurrentName());
781 EXPECT(!walker.Down()); 755 EXPECT(!walker.Down());
782 } 756 }
783 757
784 array_class.SetTraceAllocation(false); 758 array_class.SetTraceAllocation(false);
785 result = Dart_Invoke(lib, NewString("foo"), 0, NULL); 759 result = Dart_Invoke(lib, NewString("foo"), 0, NULL);
(...skipping 30 matching lines...) Expand all
816 AllocationFilter filter(isolate, array_class.id()); 790 AllocationFilter filter(isolate, array_class.id());
817 profile.Build(thread, &filter, Profile::kNoTags); 791 profile.Build(thread, &filter, Profile::kNoTags);
818 // We should still only have one allocation sample. 792 // We should still only have one allocation sample.
819 EXPECT_EQ(1, profile.sample_count()); 793 EXPECT_EQ(1, profile.sample_count());
820 ProfileTrieWalker walker(&profile); 794 ProfileTrieWalker walker(&profile);
821 795
822 walker.Reset(Profile::kExclusiveCode); 796 walker.Reset(Profile::kExclusiveCode);
823 EXPECT(walker.Down()); 797 EXPECT(walker.Down());
824 EXPECT_STREQ("DRT_AllocateArray", walker.CurrentName()); 798 EXPECT_STREQ("DRT_AllocateArray", walker.CurrentName());
825 EXPECT(walker.Down()); 799 EXPECT(walker.Down());
826 EXPECT_STREQ("[Stub] AllocateArray", walker.CurrentName());
827 EXPECT(walker.Down());
828 EXPECT_STREQ("_List._List", walker.CurrentName()); 800 EXPECT_STREQ("_List._List", walker.CurrentName());
829 EXPECT(walker.Down()); 801 EXPECT(walker.Down());
830 EXPECT_STREQ("_GrowableList._GrowableList", walker.CurrentName()); 802 EXPECT_STREQ("_GrowableList._GrowableList", walker.CurrentName());
831 EXPECT(walker.Down()); 803 EXPECT(walker.Down());
832 EXPECT_STREQ("List.List", walker.CurrentName()); 804 EXPECT_STREQ("List.List", walker.CurrentName());
833 EXPECT(walker.Down()); 805 EXPECT(walker.Down());
834 EXPECT_STREQ("bar", walker.CurrentName()); 806 EXPECT_STREQ("bar", walker.CurrentName());
835 EXPECT(!walker.Down()); 807 EXPECT(!walker.Down());
836 } 808 }
837 } 809 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 AllocationFilter filter(isolate, context_class.id()); 850 AllocationFilter filter(isolate, context_class.id());
879 profile.Build(thread, &filter, Profile::kNoTags); 851 profile.Build(thread, &filter, Profile::kNoTags);
880 // We should have one allocation sample. 852 // We should have one allocation sample.
881 EXPECT_EQ(1, profile.sample_count()); 853 EXPECT_EQ(1, profile.sample_count());
882 ProfileTrieWalker walker(&profile); 854 ProfileTrieWalker walker(&profile);
883 855
884 walker.Reset(Profile::kExclusiveCode); 856 walker.Reset(Profile::kExclusiveCode);
885 EXPECT(walker.Down()); 857 EXPECT(walker.Down());
886 EXPECT_STREQ("DRT_AllocateContext", walker.CurrentName()); 858 EXPECT_STREQ("DRT_AllocateContext", walker.CurrentName());
887 EXPECT(walker.Down()); 859 EXPECT(walker.Down());
888 EXPECT_STREQ("[Stub] AllocateContext", walker.CurrentName());
889 EXPECT(walker.Down());
890 EXPECT_STREQ("foo", walker.CurrentName()); 860 EXPECT_STREQ("foo", walker.CurrentName());
891 EXPECT(!walker.Down()); 861 EXPECT(!walker.Down());
892 } 862 }
893 863
894 context_class.SetTraceAllocation(false); 864 context_class.SetTraceAllocation(false);
895 result = Dart_Invoke(lib, NewString("foo"), 0, NULL); 865 result = Dart_Invoke(lib, NewString("foo"), 0, NULL);
896 EXPECT_VALID(result); 866 EXPECT_VALID(result);
897 867
898 { 868 {
899 StackZone zone(thread); 869 StackZone zone(thread);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 filter.set_enable_vm_ticks(true); 916 filter.set_enable_vm_ticks(true);
947 profile.Build(thread, &filter, Profile::kNoTags); 917 profile.Build(thread, &filter, Profile::kNoTags);
948 // We should have one allocation sample. 918 // We should have one allocation sample.
949 EXPECT_EQ(1, profile.sample_count()); 919 EXPECT_EQ(1, profile.sample_count());
950 ProfileTrieWalker walker(&profile); 920 ProfileTrieWalker walker(&profile);
951 921
952 walker.Reset(Profile::kExclusiveCode); 922 walker.Reset(Profile::kExclusiveCode);
953 EXPECT(walker.Down()); 923 EXPECT(walker.Down());
954 EXPECT_SUBSTRING("DRT_AllocateObject", walker.CurrentName()); 924 EXPECT_SUBSTRING("DRT_AllocateObject", walker.CurrentName());
955 EXPECT(walker.Down()); 925 EXPECT(walker.Down());
956 EXPECT_STREQ("[Stub] Allocate _Closure", walker.CurrentName());
957 EXPECT(walker.Down());
958 EXPECT_SUBSTRING("foo", walker.CurrentName()); 926 EXPECT_SUBSTRING("foo", walker.CurrentName());
959 EXPECT(!walker.Down()); 927 EXPECT(!walker.Down());
960 } 928 }
961 929
962 // Disable allocation tracing for Closure. 930 // Disable allocation tracing for Closure.
963 closure_class.SetTraceAllocation(false); 931 closure_class.SetTraceAllocation(false);
964 932
965 // Invoke "bar" which during compilation, triggers a closure allocation. 933 // Invoke "bar" which during compilation, triggers a closure allocation.
966 result = Dart_Invoke(lib, NewString("bar"), 0, NULL); 934 result = Dart_Invoke(lib, NewString("bar"), 0, NULL);
967 EXPECT_VALID(result); 935 EXPECT_VALID(result);
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1105 AllocationFilter filter(isolate, one_byte_string_class.id()); 1073 AllocationFilter filter(isolate, one_byte_string_class.id());
1106 profile.Build(thread, &filter, Profile::kNoTags); 1074 profile.Build(thread, &filter, Profile::kNoTags);
1107 // We should still only have one allocation sample. 1075 // We should still only have one allocation sample.
1108 EXPECT_EQ(1, profile.sample_count()); 1076 EXPECT_EQ(1, profile.sample_count());
1109 ProfileTrieWalker walker(&profile); 1077 ProfileTrieWalker walker(&profile);
1110 1078
1111 walker.Reset(Profile::kExclusiveCode); 1079 walker.Reset(Profile::kExclusiveCode);
1112 EXPECT(walker.Down()); 1080 EXPECT(walker.Down());
1113 EXPECT_STREQ("String_concat", walker.CurrentName()); 1081 EXPECT_STREQ("String_concat", walker.CurrentName());
1114 EXPECT(walker.Down()); 1082 EXPECT(walker.Down());
1115 #if 1
1116 EXPECT_STREQ("_StringBase.+", walker.CurrentName()); 1083 EXPECT_STREQ("_StringBase.+", walker.CurrentName());
1117 EXPECT(walker.Down()); 1084 EXPECT(walker.Down());
1118 #endif
1119 EXPECT_STREQ("foo", walker.CurrentName()); 1085 EXPECT_STREQ("foo", walker.CurrentName());
1120 EXPECT(!walker.Down()); 1086 EXPECT(!walker.Down());
1121 } 1087 }
1122 1088
1123 one_byte_string_class.SetTraceAllocation(false); 1089 one_byte_string_class.SetTraceAllocation(false);
1124 result = Dart_Invoke(lib, NewString("foo"), 2, &args[0]); 1090 result = Dart_Invoke(lib, NewString("foo"), 2, &args[0]);
1125 EXPECT_VALID(result); 1091 EXPECT_VALID(result);
1126 1092
1127 { 1093 {
1128 StackZone zone(thread); 1094 StackZone zone(thread);
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
1313 AllocationFilter filter(isolate, class_a.id()); 1279 AllocationFilter filter(isolate, class_a.id());
1314 profile.Build(thread, &filter, Profile::kNoTags); 1280 profile.Build(thread, &filter, Profile::kNoTags);
1315 // We should have 50,000 allocation samples. 1281 // We should have 50,000 allocation samples.
1316 EXPECT_EQ(50000, profile.sample_count()); 1282 EXPECT_EQ(50000, profile.sample_count());
1317 ProfileTrieWalker walker(&profile); 1283 ProfileTrieWalker walker(&profile);
1318 // We have two code objects: mainA and B.boo. 1284 // We have two code objects: mainA and B.boo.
1319 walker.Reset(Profile::kExclusiveCode); 1285 walker.Reset(Profile::kExclusiveCode);
1320 EXPECT(walker.Down()); 1286 EXPECT(walker.Down());
1321 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName()); 1287 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
1322 EXPECT(walker.Down()); 1288 EXPECT(walker.Down());
1323 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
1324 EXPECT_EQ(50000, walker.CurrentExclusiveTicks());
1325 EXPECT(walker.Down());
1326 EXPECT_STREQ("B.boo", walker.CurrentName()); 1289 EXPECT_STREQ("B.boo", walker.CurrentName());
1327 EXPECT_EQ(1, walker.SiblingCount()); 1290 EXPECT_EQ(1, walker.SiblingCount());
1328 EXPECT_EQ(50000, walker.CurrentNodeTickCount()); 1291 EXPECT_EQ(50000, walker.CurrentNodeTickCount());
1329 EXPECT_EQ(50000, walker.CurrentInclusiveTicks()); 1292 EXPECT_EQ(50000, walker.CurrentInclusiveTicks());
1293 EXPECT_EQ(50000, walker.CurrentExclusiveTicks());
1330 EXPECT(walker.Down()); 1294 EXPECT(walker.Down());
1331 EXPECT_STREQ("mainA", walker.CurrentName()); 1295 EXPECT_STREQ("mainA", walker.CurrentName());
1332 EXPECT_EQ(1, walker.SiblingCount()); 1296 EXPECT_EQ(1, walker.SiblingCount());
1333 EXPECT_EQ(50000, walker.CurrentNodeTickCount()); 1297 EXPECT_EQ(50000, walker.CurrentNodeTickCount());
1334 EXPECT_EQ(50000, walker.CurrentInclusiveTicks()); 1298 EXPECT_EQ(50000, walker.CurrentInclusiveTicks());
1335 EXPECT_EQ(0, walker.CurrentExclusiveTicks()); 1299 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
1336 EXPECT(!walker.Down()); 1300 EXPECT(!walker.Down());
1337 // We have two code objects: mainA and B.boo. 1301 // We have two code objects: mainA and B.boo.
1338 walker.Reset(Profile::kInclusiveCode); 1302 walker.Reset(Profile::kInclusiveCode);
1339 EXPECT(walker.Down()); 1303 EXPECT(walker.Down());
1340 EXPECT_STREQ("mainA", walker.CurrentName()); 1304 EXPECT_STREQ("mainA", walker.CurrentName());
1341 EXPECT_EQ(1, walker.SiblingCount()); 1305 EXPECT_EQ(1, walker.SiblingCount());
1342 EXPECT_EQ(50000, walker.CurrentNodeTickCount()); 1306 EXPECT_EQ(50000, walker.CurrentNodeTickCount());
1343 EXPECT_EQ(50000, walker.CurrentInclusiveTicks()); 1307 EXPECT_EQ(50000, walker.CurrentInclusiveTicks());
1344 EXPECT_EQ(0, walker.CurrentExclusiveTicks()); 1308 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
1345 EXPECT(walker.Down()); 1309 EXPECT(walker.Down());
1346 EXPECT_STREQ("B.boo", walker.CurrentName()); 1310 EXPECT_STREQ("B.boo", walker.CurrentName());
1347 EXPECT_EQ(1, walker.SiblingCount()); 1311 EXPECT_EQ(1, walker.SiblingCount());
1348 EXPECT_EQ(50000, walker.CurrentNodeTickCount()); 1312 EXPECT_EQ(50000, walker.CurrentNodeTickCount());
1349 EXPECT_EQ(50000, walker.CurrentInclusiveTicks()); 1313 EXPECT_EQ(50000, walker.CurrentInclusiveTicks());
1350 EXPECT(walker.Down());
1351 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
1352 EXPECT_EQ(50000, walker.CurrentExclusiveTicks()); 1314 EXPECT_EQ(50000, walker.CurrentExclusiveTicks());
1353 EXPECT(walker.Down()); 1315 EXPECT(walker.Down());
1354 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName()); 1316 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
1355 EXPECT(!walker.Down()); 1317 EXPECT(!walker.Down());
1356 1318
1357 // Inline expansion should show us the complete call chain: 1319 // Inline expansion should show us the complete call chain:
1358 // mainA -> B.boo -> B.foo -> B.choo. 1320 // mainA -> B.boo -> B.foo -> B.choo.
1359 walker.Reset(Profile::kExclusiveFunction); 1321 walker.Reset(Profile::kExclusiveFunction);
1360 EXPECT(walker.Down()); 1322 EXPECT(walker.Down());
1361 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName()); 1323 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
1362 EXPECT(walker.Down()); 1324 EXPECT(walker.Down());
1363 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
1364 EXPECT_EQ(50000, walker.CurrentExclusiveTicks());
1365 EXPECT(walker.Down());
1366 EXPECT_STREQ("B.choo", walker.CurrentName()); 1325 EXPECT_STREQ("B.choo", walker.CurrentName());
1367 EXPECT_EQ(1, walker.SiblingCount()); 1326 EXPECT_EQ(1, walker.SiblingCount());
1368 EXPECT_EQ(50000, walker.CurrentNodeTickCount()); 1327 EXPECT_EQ(50000, walker.CurrentNodeTickCount());
1369 EXPECT_EQ(50000, walker.CurrentInclusiveTicks()); 1328 EXPECT_EQ(50000, walker.CurrentInclusiveTicks());
1329 EXPECT_EQ(50000, walker.CurrentExclusiveTicks());
1370 EXPECT(walker.Down()); 1330 EXPECT(walker.Down());
1371 EXPECT_STREQ("B.foo", walker.CurrentName()); 1331 EXPECT_STREQ("B.foo", walker.CurrentName());
1372 EXPECT_EQ(1, walker.SiblingCount()); 1332 EXPECT_EQ(1, walker.SiblingCount());
1373 EXPECT_EQ(50000, walker.CurrentNodeTickCount()); 1333 EXPECT_EQ(50000, walker.CurrentNodeTickCount());
1374 EXPECT_EQ(50000, walker.CurrentInclusiveTicks()); 1334 EXPECT_EQ(50000, walker.CurrentInclusiveTicks());
1375 EXPECT_EQ(0, walker.CurrentExclusiveTicks()); 1335 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
1376 EXPECT(walker.Down()); 1336 EXPECT(walker.Down());
1377 EXPECT_STREQ("B.boo", walker.CurrentName()); 1337 EXPECT_STREQ("B.boo", walker.CurrentName());
1378 EXPECT_EQ(1, walker.SiblingCount()); 1338 EXPECT_EQ(1, walker.SiblingCount());
1379 EXPECT_EQ(50000, walker.CurrentNodeTickCount()); 1339 EXPECT_EQ(50000, walker.CurrentNodeTickCount());
(...skipping 26 matching lines...) Expand all
1406 EXPECT_STREQ("B.foo", walker.CurrentName()); 1366 EXPECT_STREQ("B.foo", walker.CurrentName());
1407 EXPECT_EQ(1, walker.SiblingCount()); 1367 EXPECT_EQ(1, walker.SiblingCount());
1408 EXPECT_EQ(50000, walker.CurrentNodeTickCount()); 1368 EXPECT_EQ(50000, walker.CurrentNodeTickCount());
1409 EXPECT_EQ(50000, walker.CurrentInclusiveTicks()); 1369 EXPECT_EQ(50000, walker.CurrentInclusiveTicks());
1410 EXPECT_EQ(0, walker.CurrentExclusiveTicks()); 1370 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
1411 EXPECT(walker.Down()); 1371 EXPECT(walker.Down());
1412 EXPECT_STREQ("B.choo", walker.CurrentName()); 1372 EXPECT_STREQ("B.choo", walker.CurrentName());
1413 EXPECT_EQ(1, walker.SiblingCount()); 1373 EXPECT_EQ(1, walker.SiblingCount());
1414 EXPECT_EQ(50000, walker.CurrentNodeTickCount()); 1374 EXPECT_EQ(50000, walker.CurrentNodeTickCount());
1415 EXPECT_EQ(50000, walker.CurrentInclusiveTicks()); 1375 EXPECT_EQ(50000, walker.CurrentInclusiveTicks());
1416 EXPECT(walker.Down());
1417 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
1418 EXPECT_EQ(50000, walker.CurrentExclusiveTicks()); 1376 EXPECT_EQ(50000, walker.CurrentExclusiveTicks());
1419 EXPECT(walker.Down()); 1377 EXPECT(walker.Down());
1420 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName()); 1378 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
1421 EXPECT(!walker.Down()); 1379 EXPECT(!walker.Down());
1422 } 1380 }
1423 1381
1424 // Test code transition tags. 1382 // Test code transition tags.
1425 { 1383 {
1426 Thread* thread = Thread::Current(); 1384 Thread* thread = Thread::Current();
1427 Isolate* isolate = thread->isolate(); 1385 Isolate* isolate = thread->isolate();
1428 StackZone zone(thread); 1386 StackZone zone(thread);
1429 HANDLESCOPE(thread); 1387 HANDLESCOPE(thread);
1430 Profile profile(isolate); 1388 Profile profile(isolate);
1431 AllocationFilter filter(isolate, class_a.id()); 1389 AllocationFilter filter(isolate, class_a.id());
1432 profile.Build(thread, &filter, Profile::kNoTags, 1390 profile.Build(thread, &filter, Profile::kNoTags,
1433 ProfilerService::kCodeTransitionTagsBit); 1391 ProfilerService::kCodeTransitionTagsBit);
1434 // We should have 50,000 allocation samples. 1392 // We should have 50,000 allocation samples.
1435 EXPECT_EQ(50000, profile.sample_count()); 1393 EXPECT_EQ(50000, profile.sample_count());
1436 ProfileTrieWalker walker(&profile); 1394 ProfileTrieWalker walker(&profile);
1437 // We have two code objects: mainA and B.boo. 1395 // We have two code objects: mainA and B.boo.
1438 walker.Reset(Profile::kExclusiveCode); 1396 walker.Reset(Profile::kExclusiveCode);
1439 EXPECT(walker.Down()); 1397 EXPECT(walker.Down());
1440 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName()); 1398 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
1441 EXPECT(walker.Down()); 1399 EXPECT(walker.Down());
1442 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
1443 EXPECT(walker.Down());
1444 EXPECT_STREQ("[Unoptimized Code]", walker.CurrentName());
1445 EXPECT(walker.Down());
1446 EXPECT_STREQ("B.boo", walker.CurrentName()); 1400 EXPECT_STREQ("B.boo", walker.CurrentName());
1447 EXPECT(walker.Down()); 1401 EXPECT(walker.Down());
1448 EXPECT_STREQ("[Optimized Code]", walker.CurrentName()); 1402 EXPECT_STREQ("[Optimized Code]", walker.CurrentName());
1449 EXPECT(walker.Down()); 1403 EXPECT(walker.Down());
1450 EXPECT_STREQ("mainA", walker.CurrentName()); 1404 EXPECT_STREQ("mainA", walker.CurrentName());
1451 EXPECT(walker.Down()); 1405 EXPECT(walker.Down());
1452 EXPECT_STREQ("[Unoptimized Code]", walker.CurrentName()); 1406 EXPECT_STREQ("[Unoptimized Code]", walker.CurrentName());
1453 EXPECT(!walker.Down()); 1407 EXPECT(!walker.Down());
1454 // We have two code objects: mainA and B.boo. 1408 // We have two code objects: mainA and B.boo.
1455 walker.Reset(Profile::kInclusiveCode); 1409 walker.Reset(Profile::kInclusiveCode);
1456 EXPECT(walker.Down()); 1410 EXPECT(walker.Down());
1457 EXPECT_STREQ("[Unoptimized Code]", walker.CurrentName()); 1411 EXPECT_STREQ("[Unoptimized Code]", walker.CurrentName());
1458 EXPECT(walker.Down()); 1412 EXPECT(walker.Down());
1459 EXPECT_STREQ("mainA", walker.CurrentName()); 1413 EXPECT_STREQ("mainA", walker.CurrentName());
1460 EXPECT(walker.Down()); 1414 EXPECT(walker.Down());
1461 EXPECT_STREQ("[Optimized Code]", walker.CurrentName()); 1415 EXPECT_STREQ("[Optimized Code]", walker.CurrentName());
1462 EXPECT(walker.Down()); 1416 EXPECT(walker.Down());
1463 EXPECT_STREQ("B.boo", walker.CurrentName()); 1417 EXPECT_STREQ("B.boo", walker.CurrentName());
1464 EXPECT(walker.Down()); 1418 EXPECT(walker.Down());
1465 EXPECT_STREQ("[Unoptimized Code]", walker.CurrentName());
1466 EXPECT(walker.Down());
1467 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
1468 EXPECT(walker.Down());
1469 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName()); 1419 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
1470 EXPECT(!walker.Down()); 1420 EXPECT(!walker.Down());
1471 1421
1472 // Inline expansion should show us the complete call chain: 1422 // Inline expansion should show us the complete call chain:
1473 // mainA -> B.boo -> B.foo -> B.choo. 1423 // mainA -> B.boo -> B.foo -> B.choo.
1474 walker.Reset(Profile::kExclusiveFunction); 1424 walker.Reset(Profile::kExclusiveFunction);
1475 EXPECT(walker.Down()); 1425 EXPECT(walker.Down());
1476 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName()); 1426 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
1477 EXPECT(walker.Down()); 1427 EXPECT(walker.Down());
1478 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
1479 EXPECT(walker.Down());
1480 EXPECT_STREQ("[Unoptimized Code]", walker.CurrentName());
1481 EXPECT(walker.Down());
1482 EXPECT_STREQ("[Inline End]", walker.CurrentName()); 1428 EXPECT_STREQ("[Inline End]", walker.CurrentName());
1483 EXPECT(walker.Down()); 1429 EXPECT(walker.Down());
1484 EXPECT_STREQ("B.choo", walker.CurrentName()); 1430 EXPECT_STREQ("B.choo", walker.CurrentName());
1485 EXPECT(walker.Down()); 1431 EXPECT(walker.Down());
1486 EXPECT_STREQ("B.foo", walker.CurrentName()); 1432 EXPECT_STREQ("B.foo", walker.CurrentName());
1487 EXPECT(walker.Down()); 1433 EXPECT(walker.Down());
1488 EXPECT_STREQ("[Inline Start]", walker.CurrentName()); 1434 EXPECT_STREQ("[Inline Start]", walker.CurrentName());
1489 EXPECT(walker.Down()); 1435 EXPECT(walker.Down());
1490 EXPECT_STREQ("B.boo", walker.CurrentName()); 1436 EXPECT_STREQ("B.boo", walker.CurrentName());
1491 EXPECT(walker.Down()); 1437 EXPECT(walker.Down());
1492 EXPECT_STREQ("[Optimized Code]", walker.CurrentName()); 1438 EXPECT_STREQ("[Optimized Code]", walker.CurrentName());
1493 EXPECT(walker.Down()); 1439 EXPECT(walker.Down());
1494 EXPECT_STREQ("mainA", walker.CurrentName()); 1440 EXPECT_STREQ("mainA", walker.CurrentName());
1495 EXPECT(walker.Down()); 1441 EXPECT(walker.Down());
1496 EXPECT_STREQ("[Unoptimized Code]", walker.CurrentName()); 1442 EXPECT_STREQ("[Unoptimized Code]", walker.CurrentName());
1497 EXPECT(!walker.Down()); 1443 EXPECT(!walker.Down());
1498 1444
1499 // Inline expansion should show us the complete call chain: 1445 // Inline expansion should show us the complete call chain:
1500 // mainA -> B.boo -> B.foo -> B.choo. 1446 // mainA -> B.boo -> B.foo -> B.choo.
1501 walker.Reset(Profile::kInclusiveFunction); 1447 walker.Reset(Profile::kInclusiveFunction);
1502 EXPECT(walker.Down()); 1448 EXPECT(walker.Down());
1449 EXPECT_STREQ("[Unoptimized Code]", walker.CurrentName());
1450 EXPECT(walker.Down());
1503 EXPECT_STREQ("mainA", walker.CurrentName()); 1451 EXPECT_STREQ("mainA", walker.CurrentName());
1504 EXPECT(walker.Down()); 1452 EXPECT(walker.Down());
1505 EXPECT_STREQ("[Optimized Code]", walker.CurrentName()); 1453 EXPECT_STREQ("[Optimized Code]", walker.CurrentName());
1506 EXPECT(walker.Down()); 1454 EXPECT(walker.Down());
1507 EXPECT_STREQ("B.boo", walker.CurrentName()); 1455 EXPECT_STREQ("B.boo", walker.CurrentName());
1508 EXPECT(walker.Down()); 1456 EXPECT(walker.Down());
1509 EXPECT_STREQ("[Inline Start]", walker.CurrentName()); 1457 EXPECT_STREQ("[Inline Start]", walker.CurrentName());
1510 EXPECT(walker.Down()); 1458 EXPECT(walker.Down());
1511 EXPECT_STREQ("B.foo", walker.CurrentName()); 1459 EXPECT_STREQ("B.foo", walker.CurrentName());
1512 EXPECT(walker.Down()); 1460 EXPECT(walker.Down());
1513 EXPECT_STREQ("B.choo", walker.CurrentName()); 1461 EXPECT_STREQ("B.choo", walker.CurrentName());
1514 EXPECT(walker.Down()); 1462 EXPECT(walker.Down());
1515 EXPECT_STREQ("[Inline End]", walker.CurrentName()); 1463 EXPECT_STREQ("[Inline End]", walker.CurrentName());
1516 EXPECT(walker.Down()); 1464 EXPECT(walker.Down());
1517 EXPECT_STREQ("[Unoptimized Code]", walker.CurrentName());
1518 EXPECT(walker.Down());
1519 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
1520 EXPECT(walker.Down());
1521 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName()); 1465 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
1522 EXPECT(!walker.Down()); 1466 EXPECT(!walker.Down());
1523 } 1467 }
1524 } 1468 }
1525 1469
1526 1470
1527 TEST_CASE(Profiler_InliningIntervalBoundry) { 1471 TEST_CASE(Profiler_InliningIntervalBoundry) {
1528 // The PC of frames below the top frame is a call's return address, 1472 // The PC of frames below the top frame is a call's return address,
1529 // which can belong to a different inlining interval than the call. 1473 // which can belong to a different inlining interval than the call.
1530 // This test checks the profiler service takes this into account; see 1474 // This test checks the profiler service takes this into account; see
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1567 "}\n"; 1511 "}\n";
1568 1512
1569 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL); 1513 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
1570 EXPECT_VALID(lib); 1514 EXPECT_VALID(lib);
1571 Library& root_library = Library::Handle(); 1515 Library& root_library = Library::Handle();
1572 root_library ^= Api::UnwrapHandle(lib); 1516 root_library ^= Api::UnwrapHandle(lib);
1573 1517
1574 const Class& class_a = Class::Handle(GetClass(root_library, "A")); 1518 const Class& class_a = Class::Handle(GetClass(root_library, "A"));
1575 EXPECT(!class_a.IsNull()); 1519 EXPECT(!class_a.IsNull());
1576 1520
1577 /*
1578 // Compile and optimize. 1521 // Compile and optimize.
1579 Dart_Handle result = Dart_Invoke(lib, NewString("mainNoAlloc"), 0, NULL); 1522 Dart_Handle result = Dart_Invoke(lib, NewString("mainNoAlloc"), 0, NULL);
1580 EXPECT_VALID(result); 1523 EXPECT_VALID(result);
1581 result = Dart_Invoke(lib, NewString("mainAlloc"), 0, NULL); 1524 result = Dart_Invoke(lib, NewString("mainAlloc"), 0, NULL);
1582 EXPECT_VALID(result); 1525 EXPECT_VALID(result);
1583 1526
1584 // At this point a should be optimized and have inlined both right and wrong, 1527 // At this point a should be optimized and have inlined both right and wrong,
1585 // but not maybeAllocate or doNothing. 1528 // but not maybeAllocate or doNothing.
1586 Function& func = Function::Handle(); 1529 Function& func = Function::Handle();
1587 func = GetFunction(root_library, "a"); 1530 func = GetFunction(root_library, "a");
(...skipping 12 matching lines...) Expand all
1600 Thread* thread = Thread::Current(); 1543 Thread* thread = Thread::Current();
1601 Isolate* isolate = thread->isolate(); 1544 Isolate* isolate = thread->isolate();
1602 StackZone zone(thread); 1545 StackZone zone(thread);
1603 HANDLESCOPE(thread); 1546 HANDLESCOPE(thread);
1604 Profile profile(isolate); 1547 Profile profile(isolate);
1605 AllocationFilter filter(isolate, class_a.id()); 1548 AllocationFilter filter(isolate, class_a.id());
1606 profile.Build(thread, &filter, Profile::kNoTags); 1549 profile.Build(thread, &filter, Profile::kNoTags);
1607 // We should have no allocation samples. 1550 // We should have no allocation samples.
1608 EXPECT_EQ(0, profile.sample_count()); 1551 EXPECT_EQ(0, profile.sample_count());
1609 } 1552 }
1610 */
1611 1553
1612 // Turn on allocation tracing for A. 1554 // Turn on allocation tracing for A.
1613 class_a.SetTraceAllocation(true); 1555 class_a.SetTraceAllocation(true);
1614 1556
1615 Dart_Handle result = Dart_Invoke(lib, NewString("mainAlloc"), 0, NULL); 1557 result = Dart_Invoke(lib, NewString("mainAlloc"), 0, NULL);
1616 EXPECT_VALID(result); 1558 EXPECT_VALID(result);
1617 1559
1618 { 1560 {
1619 Thread* thread = Thread::Current(); 1561 Thread* thread = Thread::Current();
1620 Isolate* isolate = thread->isolate(); 1562 Isolate* isolate = thread->isolate();
1621 StackZone zone(thread); 1563 StackZone zone(thread);
1622 HANDLESCOPE(thread); 1564 HANDLESCOPE(thread);
1623 Profile profile(isolate); 1565 Profile profile(isolate);
1624 AllocationFilter filter(isolate, class_a.id()); 1566 AllocationFilter filter(isolate, class_a.id());
1625 profile.Build(thread, &filter, Profile::kNoTags); 1567 profile.Build(thread, &filter, Profile::kNoTags);
1626 EXPECT_EQ(1, profile.sample_count()); 1568 EXPECT_EQ(1, profile.sample_count());
1627 ProfileTrieWalker walker(&profile); 1569 ProfileTrieWalker walker(&profile);
1628 1570
1629 // Inline expansion should show us the complete call chain: 1571 // Inline expansion should show us the complete call chain:
1630 walker.Reset(Profile::kExclusiveFunction); 1572 walker.Reset(Profile::kExclusiveFunction);
1631 EXPECT(walker.Down()); 1573 EXPECT(walker.Down());
1632 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName()); 1574 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
1633 EXPECT(walker.Down()); 1575 EXPECT(walker.Down());
1634 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
1635 EXPECT(walker.Down());
1636 EXPECT_STREQ("maybeAlloc", walker.CurrentName()); 1576 EXPECT_STREQ("maybeAlloc", walker.CurrentName());
1637 EXPECT(walker.Down()); 1577 EXPECT(walker.Down());
1638 EXPECT_STREQ("right", walker.CurrentName()); 1578 EXPECT_STREQ("right", walker.CurrentName());
1639 EXPECT(walker.Down()); 1579 EXPECT(walker.Down());
1640 EXPECT_STREQ("a", walker.CurrentName()); 1580 EXPECT_STREQ("a", walker.CurrentName());
1641 EXPECT(walker.Down()); 1581 EXPECT(walker.Down());
1642 EXPECT_STREQ("mainAlloc", walker.CurrentName()); 1582 EXPECT_STREQ("mainAlloc", walker.CurrentName());
1643 EXPECT(!walker.Down()); 1583 EXPECT(!walker.Down());
1644 1584
1645 // Inline expansion should show us the complete call chain: 1585 // Inline expansion should show us the complete call chain:
1646 walker.Reset(Profile::kInclusiveFunction); 1586 walker.Reset(Profile::kInclusiveFunction);
1647 EXPECT(walker.Down()); 1587 EXPECT(walker.Down());
1648 EXPECT_STREQ("mainAlloc", walker.CurrentName()); 1588 EXPECT_STREQ("mainAlloc", walker.CurrentName());
1649 EXPECT(walker.Down()); 1589 EXPECT(walker.Down());
1650 EXPECT_STREQ("a", walker.CurrentName()); 1590 EXPECT_STREQ("a", walker.CurrentName());
1651 EXPECT(walker.Down()); 1591 EXPECT(walker.Down());
1652 EXPECT_STREQ("right", walker.CurrentName()); 1592 EXPECT_STREQ("right", walker.CurrentName());
1653 EXPECT(walker.Down()); 1593 EXPECT(walker.Down());
1654 EXPECT_STREQ("maybeAlloc", walker.CurrentName()); 1594 EXPECT_STREQ("maybeAlloc", walker.CurrentName());
1655 EXPECT(walker.Down()); 1595 EXPECT(walker.Down());
1656 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
1657 EXPECT(walker.Down());
1658 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName()); 1596 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
1659 EXPECT(!walker.Down()); 1597 EXPECT(!walker.Down());
1660 } 1598 }
1661 } 1599 }
1662 1600
1663 1601
1664 TEST_CASE(Profiler_ChainedSamples) { 1602 TEST_CASE(Profiler_ChainedSamples) {
1665 MaxProfileDepthScope mpds(32); 1603 MaxProfileDepthScope mpds(32);
1666 DisableNativeProfileScope dnps; 1604 DisableNativeProfileScope dnps;
1667 1605
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1722 profile.Build(thread, &filter, Profile::kNoTags); 1660 profile.Build(thread, &filter, Profile::kNoTags);
1723 // We should have 1 allocation sample. 1661 // We should have 1 allocation sample.
1724 EXPECT_EQ(1, profile.sample_count()); 1662 EXPECT_EQ(1, profile.sample_count());
1725 ProfileTrieWalker walker(&profile); 1663 ProfileTrieWalker walker(&profile);
1726 1664
1727 walker.Reset(Profile::kExclusiveCode); 1665 walker.Reset(Profile::kExclusiveCode);
1728 // Move down from the root. 1666 // Move down from the root.
1729 EXPECT(walker.Down()); 1667 EXPECT(walker.Down());
1730 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName()); 1668 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
1731 EXPECT(walker.Down()); 1669 EXPECT(walker.Down());
1732 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
1733 EXPECT(walker.Down());
1734 EXPECT_STREQ("B.boo", walker.CurrentName()); 1670 EXPECT_STREQ("B.boo", walker.CurrentName());
1735 EXPECT(walker.Down()); 1671 EXPECT(walker.Down());
1736 EXPECT_STREQ("orange", walker.CurrentName()); 1672 EXPECT_STREQ("orange", walker.CurrentName());
1737 EXPECT(walker.Down()); 1673 EXPECT(walker.Down());
1738 EXPECT_STREQ("napkin", walker.CurrentName()); 1674 EXPECT_STREQ("napkin", walker.CurrentName());
1739 EXPECT(walker.Down()); 1675 EXPECT(walker.Down());
1740 EXPECT_STREQ("mayo", walker.CurrentName()); 1676 EXPECT_STREQ("mayo", walker.CurrentName());
1741 EXPECT(walker.Down()); 1677 EXPECT(walker.Down());
1742 EXPECT_STREQ("lemon", walker.CurrentName()); 1678 EXPECT_STREQ("lemon", walker.CurrentName());
1743 EXPECT(walker.Down()); 1679 EXPECT(walker.Down());
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
1825 // We should have one allocation samples. 1761 // We should have one allocation samples.
1826 EXPECT_EQ(1, profile.sample_count()); 1762 EXPECT_EQ(1, profile.sample_count());
1827 ProfileTrieWalker walker(&profile); 1763 ProfileTrieWalker walker(&profile);
1828 1764
1829 // Exclusive function: B.boo -> main. 1765 // Exclusive function: B.boo -> main.
1830 walker.Reset(Profile::kExclusiveFunction); 1766 walker.Reset(Profile::kExclusiveFunction);
1831 // Move down from the root. 1767 // Move down from the root.
1832 EXPECT(walker.Down()); 1768 EXPECT(walker.Down());
1833 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName()); 1769 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
1834 EXPECT(walker.Down()); 1770 EXPECT(walker.Down());
1835 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
1836 EXPECT_EQ(1, walker.CurrentExclusiveTicks());
1837 EXPECT(walker.Down());
1838 EXPECT_STREQ("B.boo", walker.CurrentName()); 1771 EXPECT_STREQ("B.boo", walker.CurrentName());
1839 EXPECT_EQ(1, walker.CurrentNodeTickCount()); 1772 EXPECT_EQ(1, walker.CurrentNodeTickCount());
1840 EXPECT_EQ(1, walker.CurrentInclusiveTicks()); 1773 EXPECT_EQ(1, walker.CurrentInclusiveTicks());
1774 EXPECT_EQ(1, walker.CurrentExclusiveTicks());
1841 EXPECT_STREQ("A", walker.CurrentToken()); 1775 EXPECT_STREQ("A", walker.CurrentToken());
1842 EXPECT(walker.Down()); 1776 EXPECT(walker.Down());
1843 EXPECT_STREQ("main", walker.CurrentName()); 1777 EXPECT_STREQ("main", walker.CurrentName());
1844 EXPECT_EQ(1, walker.CurrentNodeTickCount()); 1778 EXPECT_EQ(1, walker.CurrentNodeTickCount());
1845 EXPECT_EQ(1, walker.CurrentInclusiveTicks()); 1779 EXPECT_EQ(1, walker.CurrentInclusiveTicks());
1846 EXPECT_EQ(0, walker.CurrentExclusiveTicks()); 1780 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
1847 EXPECT_STREQ("boo", walker.CurrentToken()); 1781 EXPECT_STREQ("boo", walker.CurrentToken());
1848 EXPECT(!walker.Down()); 1782 EXPECT(!walker.Down());
1849 } 1783 }
1850 } 1784 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1919 // We should have one allocation samples. 1853 // We should have one allocation samples.
1920 EXPECT_EQ(1, profile.sample_count()); 1854 EXPECT_EQ(1, profile.sample_count());
1921 ProfileTrieWalker walker(&profile); 1855 ProfileTrieWalker walker(&profile);
1922 1856
1923 // Exclusive function: B.boo -> main. 1857 // Exclusive function: B.boo -> main.
1924 walker.Reset(Profile::kExclusiveFunction); 1858 walker.Reset(Profile::kExclusiveFunction);
1925 // Move down from the root. 1859 // Move down from the root.
1926 EXPECT(walker.Down()); 1860 EXPECT(walker.Down());
1927 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName()); 1861 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
1928 EXPECT(walker.Down()); 1862 EXPECT(walker.Down());
1929 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
1930 EXPECT_EQ(1, walker.CurrentExclusiveTicks());
1931 EXPECT(walker.Down());
1932 EXPECT_STREQ("B.boo", walker.CurrentName()); 1863 EXPECT_STREQ("B.boo", walker.CurrentName());
1933 EXPECT_EQ(1, walker.CurrentNodeTickCount()); 1864 EXPECT_EQ(1, walker.CurrentNodeTickCount());
1934 EXPECT_EQ(1, walker.CurrentInclusiveTicks()); 1865 EXPECT_EQ(1, walker.CurrentInclusiveTicks());
1866 EXPECT_EQ(1, walker.CurrentExclusiveTicks());
1935 EXPECT_STREQ("A", walker.CurrentToken()); 1867 EXPECT_STREQ("A", walker.CurrentToken());
1936 EXPECT(walker.Down()); 1868 EXPECT(walker.Down());
1937 EXPECT_STREQ("main", walker.CurrentName()); 1869 EXPECT_STREQ("main", walker.CurrentName());
1938 EXPECT_EQ(1, walker.CurrentNodeTickCount()); 1870 EXPECT_EQ(1, walker.CurrentNodeTickCount());
1939 EXPECT_EQ(1, walker.CurrentInclusiveTicks()); 1871 EXPECT_EQ(1, walker.CurrentInclusiveTicks());
1940 EXPECT_EQ(0, walker.CurrentExclusiveTicks()); 1872 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
1941 EXPECT_STREQ("boo", walker.CurrentToken()); 1873 EXPECT_STREQ("boo", walker.CurrentToken());
1942 EXPECT(!walker.Down()); 1874 EXPECT(!walker.Down());
1943 } 1875 }
1944 } 1876 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
2006 // We should have one allocation samples. 1938 // We should have one allocation samples.
2007 EXPECT_EQ(1, profile.sample_count()); 1939 EXPECT_EQ(1, profile.sample_count());
2008 ProfileTrieWalker walker(&profile); 1940 ProfileTrieWalker walker(&profile);
2009 1941
2010 // Exclusive function: B.boo -> main. 1942 // Exclusive function: B.boo -> main.
2011 walker.Reset(Profile::kExclusiveFunction); 1943 walker.Reset(Profile::kExclusiveFunction);
2012 // Move down from the root. 1944 // Move down from the root.
2013 EXPECT(walker.Down()); 1945 EXPECT(walker.Down());
2014 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName()); 1946 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
2015 EXPECT(walker.Down()); 1947 EXPECT(walker.Down());
2016 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
2017 EXPECT_EQ(1, walker.CurrentExclusiveTicks());
2018 EXPECT(walker.Down());
2019 EXPECT_STREQ("B.boo", walker.CurrentName()); 1948 EXPECT_STREQ("B.boo", walker.CurrentName());
2020 EXPECT_EQ(1, walker.CurrentNodeTickCount()); 1949 EXPECT_EQ(1, walker.CurrentNodeTickCount());
2021 EXPECT_EQ(1, walker.CurrentInclusiveTicks()); 1950 EXPECT_EQ(1, walker.CurrentInclusiveTicks());
1951 EXPECT_EQ(1, walker.CurrentExclusiveTicks());
2022 EXPECT_STREQ("A", walker.CurrentToken()); 1952 EXPECT_STREQ("A", walker.CurrentToken());
2023 EXPECT(walker.Down()); 1953 EXPECT(walker.Down());
2024 EXPECT_STREQ("B.oats", walker.CurrentName()); 1954 EXPECT_STREQ("B.oats", walker.CurrentName());
2025 EXPECT_EQ(1, walker.CurrentNodeTickCount()); 1955 EXPECT_EQ(1, walker.CurrentNodeTickCount());
2026 EXPECT_EQ(1, walker.CurrentInclusiveTicks()); 1956 EXPECT_EQ(1, walker.CurrentInclusiveTicks());
2027 EXPECT_EQ(0, walker.CurrentExclusiveTicks()); 1957 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
2028 EXPECT_STREQ("boo", walker.CurrentToken()); 1958 EXPECT_STREQ("boo", walker.CurrentToken());
2029 EXPECT(walker.Down()); 1959 EXPECT(walker.Down());
2030 EXPECT_STREQ("C.fox", walker.CurrentName()); 1960 EXPECT_STREQ("C.fox", walker.CurrentName());
2031 EXPECT_EQ(1, walker.CurrentNodeTickCount()); 1961 EXPECT_EQ(1, walker.CurrentNodeTickCount());
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
2131 // We should have one allocation samples. 2061 // We should have one allocation samples.
2132 EXPECT_EQ(1, profile.sample_count()); 2062 EXPECT_EQ(1, profile.sample_count());
2133 ProfileTrieWalker walker(&profile); 2063 ProfileTrieWalker walker(&profile);
2134 2064
2135 // Exclusive function: B.boo -> main. 2065 // Exclusive function: B.boo -> main.
2136 walker.Reset(Profile::kExclusiveFunction); 2066 walker.Reset(Profile::kExclusiveFunction);
2137 // Move down from the root. 2067 // Move down from the root.
2138 EXPECT(walker.Down()); 2068 EXPECT(walker.Down());
2139 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName()); 2069 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
2140 EXPECT(walker.Down()); 2070 EXPECT(walker.Down());
2141 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
2142 EXPECT_EQ(1, walker.CurrentExclusiveTicks());
2143 EXPECT(walker.Down());
2144 EXPECT_STREQ("B.boo", walker.CurrentName()); 2071 EXPECT_STREQ("B.boo", walker.CurrentName());
2145 EXPECT_EQ(1, walker.CurrentNodeTickCount()); 2072 EXPECT_EQ(1, walker.CurrentNodeTickCount());
2146 EXPECT_EQ(1, walker.CurrentInclusiveTicks()); 2073 EXPECT_EQ(1, walker.CurrentInclusiveTicks());
2074 EXPECT_EQ(1, walker.CurrentExclusiveTicks());
2147 EXPECT_STREQ("A", walker.CurrentToken()); 2075 EXPECT_STREQ("A", walker.CurrentToken());
2148 EXPECT(walker.Down()); 2076 EXPECT(walker.Down());
2149 EXPECT_STREQ("B.oats", walker.CurrentName()); 2077 EXPECT_STREQ("B.oats", walker.CurrentName());
2150 EXPECT_EQ(1, walker.CurrentNodeTickCount()); 2078 EXPECT_EQ(1, walker.CurrentNodeTickCount());
2151 EXPECT_EQ(1, walker.CurrentInclusiveTicks()); 2079 EXPECT_EQ(1, walker.CurrentInclusiveTicks());
2152 EXPECT_EQ(0, walker.CurrentExclusiveTicks()); 2080 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
2153 EXPECT_STREQ("boo", walker.CurrentToken()); 2081 EXPECT_STREQ("boo", walker.CurrentToken());
2154 EXPECT(walker.Down()); 2082 EXPECT(walker.Down());
2155 EXPECT_STREQ("C.fox", walker.CurrentName()); 2083 EXPECT_STREQ("C.fox", walker.CurrentName());
2156 EXPECT_EQ(1, walker.CurrentNodeTickCount()); 2084 EXPECT_EQ(1, walker.CurrentNodeTickCount());
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
2239 // We should have one allocation samples. 2167 // We should have one allocation samples.
2240 EXPECT_EQ(1, profile.sample_count()); 2168 EXPECT_EQ(1, profile.sample_count());
2241 ProfileTrieWalker walker(&profile); 2169 ProfileTrieWalker walker(&profile);
2242 2170
2243 // Exclusive function: B.boo -> main. 2171 // Exclusive function: B.boo -> main.
2244 walker.Reset(Profile::kExclusiveFunction); 2172 walker.Reset(Profile::kExclusiveFunction);
2245 // Move down from the root. 2173 // Move down from the root.
2246 EXPECT(walker.Down()); 2174 EXPECT(walker.Down());
2247 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName()); 2175 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
2248 EXPECT(walker.Down()); 2176 EXPECT(walker.Down());
2249 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
2250 EXPECT_EQ(1, walker.CurrentExclusiveTicks());
2251 EXPECT(walker.Down());
2252 EXPECT_STREQ("B.boo", walker.CurrentName()); 2177 EXPECT_STREQ("B.boo", walker.CurrentName());
2253 EXPECT_EQ(1, walker.CurrentNodeTickCount()); 2178 EXPECT_EQ(1, walker.CurrentNodeTickCount());
2254 EXPECT_EQ(1, walker.CurrentInclusiveTicks()); 2179 EXPECT_EQ(1, walker.CurrentInclusiveTicks());
2180 EXPECT_EQ(1, walker.CurrentExclusiveTicks());
2255 EXPECT_STREQ("A", walker.CurrentToken()); 2181 EXPECT_STREQ("A", walker.CurrentToken());
2256 EXPECT(walker.Down()); 2182 EXPECT(walker.Down());
2257 EXPECT_STREQ("B.oats", walker.CurrentName()); 2183 EXPECT_STREQ("B.oats", walker.CurrentName());
2258 EXPECT_EQ(1, walker.CurrentNodeTickCount()); 2184 EXPECT_EQ(1, walker.CurrentNodeTickCount());
2259 EXPECT_EQ(1, walker.CurrentInclusiveTicks()); 2185 EXPECT_EQ(1, walker.CurrentInclusiveTicks());
2260 EXPECT_EQ(0, walker.CurrentExclusiveTicks()); 2186 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
2261 EXPECT_STREQ("boo", walker.CurrentToken()); 2187 EXPECT_STREQ("boo", walker.CurrentToken());
2262 EXPECT(walker.Down()); 2188 EXPECT(walker.Down());
2263 EXPECT_STREQ("C.fox", walker.CurrentName()); 2189 EXPECT_STREQ("C.fox", walker.CurrentName());
2264 EXPECT_EQ(1, walker.CurrentNodeTickCount()); 2190 EXPECT_EQ(1, walker.CurrentNodeTickCount());
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
2373 // We should have one allocation samples. 2299 // We should have one allocation samples.
2374 EXPECT_EQ(1, profile.sample_count()); 2300 EXPECT_EQ(1, profile.sample_count());
2375 ProfileTrieWalker walker(&profile); 2301 ProfileTrieWalker walker(&profile);
2376 2302
2377 // Exclusive function: B.boo -> main. 2303 // Exclusive function: B.boo -> main.
2378 walker.Reset(Profile::kExclusiveFunction); 2304 walker.Reset(Profile::kExclusiveFunction);
2379 // Move down from the root. 2305 // Move down from the root.
2380 EXPECT(walker.Down()); 2306 EXPECT(walker.Down());
2381 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName()); 2307 EXPECT_STREQ("DRT_AllocateObject", walker.CurrentName());
2382 EXPECT(walker.Down()); 2308 EXPECT(walker.Down());
2383 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
2384 EXPECT_EQ(1, walker.CurrentExclusiveTicks());
2385 EXPECT(walker.Down());
2386 EXPECT_STREQ("B.boo", walker.CurrentName()); 2309 EXPECT_STREQ("B.boo", walker.CurrentName());
2387 EXPECT_EQ(1, walker.CurrentNodeTickCount()); 2310 EXPECT_EQ(1, walker.CurrentNodeTickCount());
2388 EXPECT_EQ(1, walker.CurrentInclusiveTicks()); 2311 EXPECT_EQ(1, walker.CurrentInclusiveTicks());
2312 EXPECT_EQ(1, walker.CurrentExclusiveTicks());
2389 EXPECT_STREQ("A", walker.CurrentToken()); 2313 EXPECT_STREQ("A", walker.CurrentToken());
2390 EXPECT(walker.Down()); 2314 EXPECT(walker.Down());
2391 EXPECT_STREQ("B.oats", walker.CurrentName()); 2315 EXPECT_STREQ("B.oats", walker.CurrentName());
2392 EXPECT_EQ(1, walker.CurrentNodeTickCount()); 2316 EXPECT_EQ(1, walker.CurrentNodeTickCount());
2393 EXPECT_EQ(1, walker.CurrentInclusiveTicks()); 2317 EXPECT_EQ(1, walker.CurrentInclusiveTicks());
2394 EXPECT_EQ(0, walker.CurrentExclusiveTicks()); 2318 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
2395 EXPECT_STREQ("boo", walker.CurrentToken()); 2319 EXPECT_STREQ("boo", walker.CurrentToken());
2396 EXPECT(walker.Down()); 2320 EXPECT(walker.Down());
2397 EXPECT_STREQ("C.fox", walker.CurrentName()); 2321 EXPECT_STREQ("C.fox", walker.CurrentName());
2398 EXPECT_EQ(1, walker.CurrentNodeTickCount()); 2322 EXPECT_EQ(1, walker.CurrentNodeTickCount());
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
2602 EXPECT_SUBSTRING("\"positions\":[\"TempMove\",39]", js.ToCString()); 2526 EXPECT_SUBSTRING("\"positions\":[\"TempMove\",39]", js.ToCString());
2603 // Verify exclusive ticks in main. 2527 // Verify exclusive ticks in main.
2604 EXPECT_SUBSTRING("\"exclusiveTicks\":[1,0]", js.ToCString()); 2528 EXPECT_SUBSTRING("\"exclusiveTicks\":[1,0]", js.ToCString());
2605 // Verify inclusive ticks in main. 2529 // Verify inclusive ticks in main.
2606 EXPECT_SUBSTRING("\"inclusiveTicks\":[1,2]", js.ToCString()); 2530 EXPECT_SUBSTRING("\"inclusiveTicks\":[1,2]", js.ToCString());
2607 } 2531 }
2608 2532
2609 #endif // !PRODUCT 2533 #endif // !PRODUCT
2610 2534
2611 } // namespace dart 2535 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/profiler.cc ('k') | runtime/vm/stack_frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698