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