diff options
| -rw-r--r-- | tools/perf/tests/hists_cumulate.c | 64 | ||||
| -rw-r--r-- | tools/perf/ui/hist.c | 3 |
2 files changed, 35 insertions, 32 deletions
diff --git a/tools/perf/tests/hists_cumulate.c b/tools/perf/tests/hists_cumulate.c index 4b8226e19a91..8d110dec393e 100644 --- a/tools/perf/tests/hists_cumulate.c +++ b/tools/perf/tests/hists_cumulate.c | |||
| @@ -454,12 +454,12 @@ static int test3(struct perf_evsel *evsel, struct machine *machine) | |||
| 454 | * 30.00% 10.00% perf perf [.] cmd_record | 454 | * 30.00% 10.00% perf perf [.] cmd_record |
| 455 | * 20.00% 0.00% bash libc [.] malloc | 455 | * 20.00% 0.00% bash libc [.] malloc |
| 456 | * 10.00% 10.00% bash [kernel] [k] page_fault | 456 | * 10.00% 10.00% bash [kernel] [k] page_fault |
| 457 | * 10.00% 10.00% perf [kernel] [k] schedule | 457 | * 10.00% 10.00% bash bash [.] xmalloc |
| 458 | * 10.00% 0.00% perf [kernel] [k] sys_perf_event_open | ||
| 459 | * 10.00% 10.00% perf [kernel] [k] page_fault | 458 | * 10.00% 10.00% perf [kernel] [k] page_fault |
| 460 | * 10.00% 10.00% perf libc [.] free | ||
| 461 | * 10.00% 10.00% perf libc [.] malloc | 459 | * 10.00% 10.00% perf libc [.] malloc |
| 462 | * 10.00% 10.00% bash bash [.] xmalloc | 460 | * 10.00% 10.00% perf [kernel] [k] schedule |
| 461 | * 10.00% 10.00% perf libc [.] free | ||
| 462 | * 10.00% 0.00% perf [kernel] [k] sys_perf_event_open | ||
| 463 | */ | 463 | */ |
| 464 | struct result expected[] = { | 464 | struct result expected[] = { |
| 465 | { 7000, 2000, "perf", "perf", "main" }, | 465 | { 7000, 2000, "perf", "perf", "main" }, |
| @@ -468,12 +468,12 @@ static int test3(struct perf_evsel *evsel, struct machine *machine) | |||
| 468 | { 3000, 1000, "perf", "perf", "cmd_record" }, | 468 | { 3000, 1000, "perf", "perf", "cmd_record" }, |
| 469 | { 2000, 0, "bash", "libc", "malloc" }, | 469 | { 2000, 0, "bash", "libc", "malloc" }, |
| 470 | { 1000, 1000, "bash", "[kernel]", "page_fault" }, | 470 | { 1000, 1000, "bash", "[kernel]", "page_fault" }, |
| 471 | { 1000, 1000, "perf", "[kernel]", "schedule" }, | 471 | { 1000, 1000, "bash", "bash", "xmalloc" }, |
| 472 | { 1000, 0, "perf", "[kernel]", "sys_perf_event_open" }, | ||
| 473 | { 1000, 1000, "perf", "[kernel]", "page_fault" }, | 472 | { 1000, 1000, "perf", "[kernel]", "page_fault" }, |
| 473 | { 1000, 1000, "perf", "[kernel]", "schedule" }, | ||
| 474 | { 1000, 1000, "perf", "libc", "free" }, | 474 | { 1000, 1000, "perf", "libc", "free" }, |
| 475 | { 1000, 1000, "perf", "libc", "malloc" }, | 475 | { 1000, 1000, "perf", "libc", "malloc" }, |
| 476 | { 1000, 1000, "bash", "bash", "xmalloc" }, | 476 | { 1000, 0, "perf", "[kernel]", "sys_perf_event_open" }, |
| 477 | }; | 477 | }; |
| 478 | 478 | ||
| 479 | symbol_conf.use_callchain = false; | 479 | symbol_conf.use_callchain = false; |
| @@ -537,10 +537,13 @@ static int test4(struct perf_evsel *evsel, struct machine *machine) | |||
| 537 | * malloc | 537 | * malloc |
| 538 | * main | 538 | * main |
| 539 | * | 539 | * |
| 540 | * 10.00% 10.00% perf [kernel] [k] schedule | 540 | * 10.00% 10.00% bash bash [.] xmalloc |
| 541 | * | | 541 | * | |
| 542 | * --- schedule | 542 | * --- xmalloc |
| 543 | * run_command | 543 | * malloc |
| 544 | * xmalloc <--- NOTE: there's a cycle | ||
| 545 | * malloc | ||
| 546 | * xmalloc | ||
| 544 | * main | 547 | * main |
| 545 | * | 548 | * |
| 546 | * 10.00% 0.00% perf [kernel] [k] sys_perf_event_open | 549 | * 10.00% 0.00% perf [kernel] [k] sys_perf_event_open |
| @@ -556,6 +559,12 @@ static int test4(struct perf_evsel *evsel, struct machine *machine) | |||
| 556 | * run_command | 559 | * run_command |
| 557 | * main | 560 | * main |
| 558 | * | 561 | * |
| 562 | * 10.00% 10.00% perf [kernel] [k] schedule | ||
| 563 | * | | ||
| 564 | * --- schedule | ||
| 565 | * run_command | ||
| 566 | * main | ||
| 567 | * | ||
| 559 | * 10.00% 10.00% perf libc [.] free | 568 | * 10.00% 10.00% perf libc [.] free |
| 560 | * | | 569 | * | |
| 561 | * --- free | 570 | * --- free |
| @@ -570,15 +579,6 @@ static int test4(struct perf_evsel *evsel, struct machine *machine) | |||
| 570 | * run_command | 579 | * run_command |
| 571 | * main | 580 | * main |
| 572 | * | 581 | * |
| 573 | * 10.00% 10.00% bash bash [.] xmalloc | ||
| 574 | * | | ||
| 575 | * --- xmalloc | ||
| 576 | * malloc | ||
| 577 | * xmalloc <--- NOTE: there's a cycle | ||
| 578 | * malloc | ||
| 579 | * xmalloc | ||
| 580 | * main | ||
| 581 | * | ||
| 582 | */ | 582 | */ |
| 583 | struct result expected[] = { | 583 | struct result expected[] = { |
| 584 | { 7000, 2000, "perf", "perf", "main" }, | 584 | { 7000, 2000, "perf", "perf", "main" }, |
| @@ -587,12 +587,12 @@ static int test4(struct perf_evsel *evsel, struct machine *machine) | |||
| 587 | { 3000, 1000, "perf", "perf", "cmd_record" }, | 587 | { 3000, 1000, "perf", "perf", "cmd_record" }, |
| 588 | { 2000, 0, "bash", "libc", "malloc" }, | 588 | { 2000, 0, "bash", "libc", "malloc" }, |
| 589 | { 1000, 1000, "bash", "[kernel]", "page_fault" }, | 589 | { 1000, 1000, "bash", "[kernel]", "page_fault" }, |
| 590 | { 1000, 1000, "perf", "[kernel]", "schedule" }, | 590 | { 1000, 1000, "bash", "bash", "xmalloc" }, |
| 591 | { 1000, 0, "perf", "[kernel]", "sys_perf_event_open" }, | 591 | { 1000, 0, "perf", "[kernel]", "sys_perf_event_open" }, |
| 592 | { 1000, 1000, "perf", "[kernel]", "page_fault" }, | 592 | { 1000, 1000, "perf", "[kernel]", "page_fault" }, |
| 593 | { 1000, 1000, "perf", "[kernel]", "schedule" }, | ||
| 593 | { 1000, 1000, "perf", "libc", "free" }, | 594 | { 1000, 1000, "perf", "libc", "free" }, |
| 594 | { 1000, 1000, "perf", "libc", "malloc" }, | 595 | { 1000, 1000, "perf", "libc", "malloc" }, |
| 595 | { 1000, 1000, "bash", "bash", "xmalloc" }, | ||
| 596 | }; | 596 | }; |
| 597 | struct callchain_result expected_callchain[] = { | 597 | struct callchain_result expected_callchain[] = { |
| 598 | { | 598 | { |
| @@ -622,9 +622,12 @@ static int test4(struct perf_evsel *evsel, struct machine *machine) | |||
| 622 | { "bash", "main" }, }, | 622 | { "bash", "main" }, }, |
| 623 | }, | 623 | }, |
| 624 | { | 624 | { |
| 625 | 3, { { "[kernel]", "schedule" }, | 625 | 6, { { "bash", "xmalloc" }, |
| 626 | { "perf", "run_command" }, | 626 | { "libc", "malloc" }, |
| 627 | { "perf", "main" }, }, | 627 | { "bash", "xmalloc" }, |
| 628 | { "libc", "malloc" }, | ||
| 629 | { "bash", "xmalloc" }, | ||
| 630 | { "bash", "main" }, }, | ||
| 628 | }, | 631 | }, |
| 629 | { | 632 | { |
| 630 | 3, { { "[kernel]", "sys_perf_event_open" }, | 633 | 3, { { "[kernel]", "sys_perf_event_open" }, |
| @@ -638,6 +641,11 @@ static int test4(struct perf_evsel *evsel, struct machine *machine) | |||
| 638 | { "perf", "main" }, }, | 641 | { "perf", "main" }, }, |
| 639 | }, | 642 | }, |
| 640 | { | 643 | { |
| 644 | 3, { { "[kernel]", "schedule" }, | ||
| 645 | { "perf", "run_command" }, | ||
| 646 | { "perf", "main" }, }, | ||
| 647 | }, | ||
| 648 | { | ||
| 641 | 4, { { "libc", "free" }, | 649 | 4, { { "libc", "free" }, |
| 642 | { "perf", "cmd_record" }, | 650 | { "perf", "cmd_record" }, |
| 643 | { "perf", "run_command" }, | 651 | { "perf", "run_command" }, |
| @@ -649,14 +657,6 @@ static int test4(struct perf_evsel *evsel, struct machine *machine) | |||
| 649 | { "perf", "run_command" }, | 657 | { "perf", "run_command" }, |
| 650 | { "perf", "main" }, }, | 658 | { "perf", "main" }, }, |
| 651 | }, | 659 | }, |
| 652 | { | ||
| 653 | 6, { { "bash", "xmalloc" }, | ||
| 654 | { "libc", "malloc" }, | ||
| 655 | { "bash", "xmalloc" }, | ||
| 656 | { "libc", "malloc" }, | ||
| 657 | { "bash", "xmalloc" }, | ||
| 658 | { "bash", "main" }, }, | ||
| 659 | }, | ||
| 660 | }; | 660 | }; |
| 661 | 661 | ||
| 662 | symbol_conf.use_callchain = true; | 662 | symbol_conf.use_callchain = true; |
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c index dc0d095f318c..482adae3cc44 100644 --- a/tools/perf/ui/hist.c +++ b/tools/perf/ui/hist.c | |||
| @@ -204,6 +204,9 @@ static int __hpp__sort_acc(struct hist_entry *a, struct hist_entry *b, | |||
| 204 | if (ret) | 204 | if (ret) |
| 205 | return ret; | 205 | return ret; |
| 206 | 206 | ||
| 207 | if (a->thread != b->thread || !symbol_conf.use_callchain) | ||
| 208 | return 0; | ||
| 209 | |||
| 207 | ret = b->callchain->max_depth - a->callchain->max_depth; | 210 | ret = b->callchain->max_depth - a->callchain->max_depth; |
| 208 | } | 211 | } |
| 209 | return ret; | 212 | return ret; |
