summaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-timechart.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/builtin-timechart.c')
-rw-r--r--tools/perf/builtin-timechart.c56
1 files changed, 26 insertions, 30 deletions
diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c
index 4bde3fa245d1..e0e822695a29 100644
--- a/tools/perf/builtin-timechart.c
+++ b/tools/perf/builtin-timechart.c
@@ -10,13 +10,11 @@
10 10
11#include <errno.h> 11#include <errno.h>
12#include <inttypes.h> 12#include <inttypes.h>
13#include <traceevent/event-parse.h>
14 13
15#include "builtin.h" 14#include "builtin.h"
16#include "util/color.h" 15#include "util/color.h"
17#include <linux/list.h> 16#include <linux/list.h>
18#include "util/cache.h" 17#include "util/evlist.h" // for struct evsel_str_handler
19#include "util/evlist.h"
20#include "util/evsel.h" 18#include "util/evsel.h"
21#include <linux/kernel.h> 19#include <linux/kernel.h>
22#include <linux/rbtree.h> 20#include <linux/rbtree.h>
@@ -28,6 +26,7 @@
28 26
29#include "perf.h" 27#include "perf.h"
30#include "util/header.h" 28#include "util/header.h"
29#include <subcmd/pager.h>
31#include <subcmd/parse-options.h> 30#include <subcmd/parse-options.h>
32#include "util/parse-events.h" 31#include "util/parse-events.h"
33#include "util/event.h" 32#include "util/event.h"
@@ -545,19 +544,19 @@ exit:
545} 544}
546 545
547typedef int (*tracepoint_handler)(struct timechart *tchart, 546typedef int (*tracepoint_handler)(struct timechart *tchart,
548 struct perf_evsel *evsel, 547 struct evsel *evsel,
549 struct perf_sample *sample, 548 struct perf_sample *sample,
550 const char *backtrace); 549 const char *backtrace);
551 550
552static int process_sample_event(struct perf_tool *tool, 551static int process_sample_event(struct perf_tool *tool,
553 union perf_event *event, 552 union perf_event *event,
554 struct perf_sample *sample, 553 struct perf_sample *sample,
555 struct perf_evsel *evsel, 554 struct evsel *evsel,
556 struct machine *machine) 555 struct machine *machine)
557{ 556{
558 struct timechart *tchart = container_of(tool, struct timechart, tool); 557 struct timechart *tchart = container_of(tool, struct timechart, tool);
559 558
560 if (evsel->attr.sample_type & PERF_SAMPLE_TIME) { 559 if (evsel->core.attr.sample_type & PERF_SAMPLE_TIME) {
561 if (!tchart->first_time || tchart->first_time > sample->time) 560 if (!tchart->first_time || tchart->first_time > sample->time)
562 tchart->first_time = sample->time; 561 tchart->first_time = sample->time;
563 if (tchart->last_time < sample->time) 562 if (tchart->last_time < sample->time)
@@ -575,7 +574,7 @@ static int process_sample_event(struct perf_tool *tool,
575 574
576static int 575static int
577process_sample_cpu_idle(struct timechart *tchart __maybe_unused, 576process_sample_cpu_idle(struct timechart *tchart __maybe_unused,
578 struct perf_evsel *evsel, 577 struct evsel *evsel,
579 struct perf_sample *sample, 578 struct perf_sample *sample,
580 const char *backtrace __maybe_unused) 579 const char *backtrace __maybe_unused)
581{ 580{
@@ -591,7 +590,7 @@ process_sample_cpu_idle(struct timechart *tchart __maybe_unused,
591 590
592static int 591static int
593process_sample_cpu_frequency(struct timechart *tchart, 592process_sample_cpu_frequency(struct timechart *tchart,
594 struct perf_evsel *evsel, 593 struct evsel *evsel,
595 struct perf_sample *sample, 594 struct perf_sample *sample,
596 const char *backtrace __maybe_unused) 595 const char *backtrace __maybe_unused)
597{ 596{
@@ -604,7 +603,7 @@ process_sample_cpu_frequency(struct timechart *tchart,
604 603
605static int 604static int
606process_sample_sched_wakeup(struct timechart *tchart, 605process_sample_sched_wakeup(struct timechart *tchart,
607 struct perf_evsel *evsel, 606 struct evsel *evsel,
608 struct perf_sample *sample, 607 struct perf_sample *sample,
609 const char *backtrace) 608 const char *backtrace)
610{ 609{
@@ -618,7 +617,7 @@ process_sample_sched_wakeup(struct timechart *tchart,
618 617
619static int 618static int
620process_sample_sched_switch(struct timechart *tchart, 619process_sample_sched_switch(struct timechart *tchart,
621 struct perf_evsel *evsel, 620 struct evsel *evsel,
622 struct perf_sample *sample, 621 struct perf_sample *sample,
623 const char *backtrace) 622 const char *backtrace)
624{ 623{
@@ -634,7 +633,7 @@ process_sample_sched_switch(struct timechart *tchart,
634#ifdef SUPPORT_OLD_POWER_EVENTS 633#ifdef SUPPORT_OLD_POWER_EVENTS
635static int 634static int
636process_sample_power_start(struct timechart *tchart __maybe_unused, 635process_sample_power_start(struct timechart *tchart __maybe_unused,
637 struct perf_evsel *evsel, 636 struct evsel *evsel,
638 struct perf_sample *sample, 637 struct perf_sample *sample,
639 const char *backtrace __maybe_unused) 638 const char *backtrace __maybe_unused)
640{ 639{
@@ -647,7 +646,7 @@ process_sample_power_start(struct timechart *tchart __maybe_unused,
647 646
648static int 647static int
649process_sample_power_end(struct timechart *tchart, 648process_sample_power_end(struct timechart *tchart,
650 struct perf_evsel *evsel __maybe_unused, 649 struct evsel *evsel __maybe_unused,
651 struct perf_sample *sample, 650 struct perf_sample *sample,
652 const char *backtrace __maybe_unused) 651 const char *backtrace __maybe_unused)
653{ 652{
@@ -657,7 +656,7 @@ process_sample_power_end(struct timechart *tchart,
657 656
658static int 657static int
659process_sample_power_frequency(struct timechart *tchart, 658process_sample_power_frequency(struct timechart *tchart,
660 struct perf_evsel *evsel, 659 struct evsel *evsel,
661 struct perf_sample *sample, 660 struct perf_sample *sample,
662 const char *backtrace __maybe_unused) 661 const char *backtrace __maybe_unused)
663{ 662{
@@ -840,7 +839,7 @@ static int pid_end_io_sample(struct timechart *tchart, int pid, int type,
840 839
841static int 840static int
842process_enter_read(struct timechart *tchart, 841process_enter_read(struct timechart *tchart,
843 struct perf_evsel *evsel, 842 struct evsel *evsel,
844 struct perf_sample *sample) 843 struct perf_sample *sample)
845{ 844{
846 long fd = perf_evsel__intval(evsel, sample, "fd"); 845 long fd = perf_evsel__intval(evsel, sample, "fd");
@@ -850,7 +849,7 @@ process_enter_read(struct timechart *tchart,
850 849
851static int 850static int
852process_exit_read(struct timechart *tchart, 851process_exit_read(struct timechart *tchart,
853 struct perf_evsel *evsel, 852 struct evsel *evsel,
854 struct perf_sample *sample) 853 struct perf_sample *sample)
855{ 854{
856 long ret = perf_evsel__intval(evsel, sample, "ret"); 855 long ret = perf_evsel__intval(evsel, sample, "ret");
@@ -860,7 +859,7 @@ process_exit_read(struct timechart *tchart,
860 859
861static int 860static int
862process_enter_write(struct timechart *tchart, 861process_enter_write(struct timechart *tchart,
863 struct perf_evsel *evsel, 862 struct evsel *evsel,
864 struct perf_sample *sample) 863 struct perf_sample *sample)
865{ 864{
866 long fd = perf_evsel__intval(evsel, sample, "fd"); 865 long fd = perf_evsel__intval(evsel, sample, "fd");
@@ -870,7 +869,7 @@ process_enter_write(struct timechart *tchart,
870 869
871static int 870static int
872process_exit_write(struct timechart *tchart, 871process_exit_write(struct timechart *tchart,
873 struct perf_evsel *evsel, 872 struct evsel *evsel,
874 struct perf_sample *sample) 873 struct perf_sample *sample)
875{ 874{
876 long ret = perf_evsel__intval(evsel, sample, "ret"); 875 long ret = perf_evsel__intval(evsel, sample, "ret");
@@ -880,7 +879,7 @@ process_exit_write(struct timechart *tchart,
880 879
881static int 880static int
882process_enter_sync(struct timechart *tchart, 881process_enter_sync(struct timechart *tchart,
883 struct perf_evsel *evsel, 882 struct evsel *evsel,
884 struct perf_sample *sample) 883 struct perf_sample *sample)
885{ 884{
886 long fd = perf_evsel__intval(evsel, sample, "fd"); 885 long fd = perf_evsel__intval(evsel, sample, "fd");
@@ -890,7 +889,7 @@ process_enter_sync(struct timechart *tchart,
890 889
891static int 890static int
892process_exit_sync(struct timechart *tchart, 891process_exit_sync(struct timechart *tchart,
893 struct perf_evsel *evsel, 892 struct evsel *evsel,
894 struct perf_sample *sample) 893 struct perf_sample *sample)
895{ 894{
896 long ret = perf_evsel__intval(evsel, sample, "ret"); 895 long ret = perf_evsel__intval(evsel, sample, "ret");
@@ -900,7 +899,7 @@ process_exit_sync(struct timechart *tchart,
900 899
901static int 900static int
902process_enter_tx(struct timechart *tchart, 901process_enter_tx(struct timechart *tchart,
903 struct perf_evsel *evsel, 902 struct evsel *evsel,
904 struct perf_sample *sample) 903 struct perf_sample *sample)
905{ 904{
906 long fd = perf_evsel__intval(evsel, sample, "fd"); 905 long fd = perf_evsel__intval(evsel, sample, "fd");
@@ -910,7 +909,7 @@ process_enter_tx(struct timechart *tchart,
910 909
911static int 910static int
912process_exit_tx(struct timechart *tchart, 911process_exit_tx(struct timechart *tchart,
913 struct perf_evsel *evsel, 912 struct evsel *evsel,
914 struct perf_sample *sample) 913 struct perf_sample *sample)
915{ 914{
916 long ret = perf_evsel__intval(evsel, sample, "ret"); 915 long ret = perf_evsel__intval(evsel, sample, "ret");
@@ -920,7 +919,7 @@ process_exit_tx(struct timechart *tchart,
920 919
921static int 920static int
922process_enter_rx(struct timechart *tchart, 921process_enter_rx(struct timechart *tchart,
923 struct perf_evsel *evsel, 922 struct evsel *evsel,
924 struct perf_sample *sample) 923 struct perf_sample *sample)
925{ 924{
926 long fd = perf_evsel__intval(evsel, sample, "fd"); 925 long fd = perf_evsel__intval(evsel, sample, "fd");
@@ -930,7 +929,7 @@ process_enter_rx(struct timechart *tchart,
930 929
931static int 930static int
932process_exit_rx(struct timechart *tchart, 931process_exit_rx(struct timechart *tchart,
933 struct perf_evsel *evsel, 932 struct evsel *evsel,
934 struct perf_sample *sample) 933 struct perf_sample *sample)
935{ 934{
936 long ret = perf_evsel__intval(evsel, sample, "ret"); 935 long ret = perf_evsel__intval(evsel, sample, "ret");
@@ -940,7 +939,7 @@ process_exit_rx(struct timechart *tchart,
940 939
941static int 940static int
942process_enter_poll(struct timechart *tchart, 941process_enter_poll(struct timechart *tchart,
943 struct perf_evsel *evsel, 942 struct evsel *evsel,
944 struct perf_sample *sample) 943 struct perf_sample *sample)
945{ 944{
946 long fd = perf_evsel__intval(evsel, sample, "fd"); 945 long fd = perf_evsel__intval(evsel, sample, "fd");
@@ -950,7 +949,7 @@ process_enter_poll(struct timechart *tchart,
950 949
951static int 950static int
952process_exit_poll(struct timechart *tchart, 951process_exit_poll(struct timechart *tchart,
953 struct perf_evsel *evsel, 952 struct evsel *evsel,
954 struct perf_sample *sample) 953 struct perf_sample *sample)
955{ 954{
956 long ret = perf_evsel__intval(evsel, sample, "ret"); 955 long ret = perf_evsel__intval(evsel, sample, "ret");
@@ -1518,10 +1517,7 @@ static int process_header(struct perf_file_section *section __maybe_unused,
1518 if (!tchart->topology) 1517 if (!tchart->topology)
1519 break; 1518 break;
1520 1519
1521 if (svg_build_topology_map(ph->env.sibling_cores, 1520 if (svg_build_topology_map(&ph->env))
1522 ph->env.nr_sibling_cores,
1523 ph->env.sibling_threads,
1524 ph->env.nr_sibling_threads))
1525 fprintf(stderr, "problem building topology\n"); 1521 fprintf(stderr, "problem building topology\n");
1526 break; 1522 break;
1527 1523
@@ -1534,7 +1530,7 @@ static int process_header(struct perf_file_section *section __maybe_unused,
1534 1530
1535static int __cmd_timechart(struct timechart *tchart, const char *output_name) 1531static int __cmd_timechart(struct timechart *tchart, const char *output_name)
1536{ 1532{
1537 const struct perf_evsel_str_handler power_tracepoints[] = { 1533 const struct evsel_str_handler power_tracepoints[] = {
1538 { "power:cpu_idle", process_sample_cpu_idle }, 1534 { "power:cpu_idle", process_sample_cpu_idle },
1539 { "power:cpu_frequency", process_sample_cpu_frequency }, 1535 { "power:cpu_frequency", process_sample_cpu_frequency },
1540 { "sched:sched_wakeup", process_sample_sched_wakeup }, 1536 { "sched:sched_wakeup", process_sample_sched_wakeup },