libperf: Add 'mask' to struct perf_mmap
[linux-2.6-microblaze.git] / tools / perf / builtin-timechart.c
index 4bde3fa..9e84fae 100644 (file)
 
 #include <errno.h>
 #include <inttypes.h>
-#include <traceevent/event-parse.h>
 
 #include "builtin.h"
 #include "util/color.h"
 #include <linux/list.h>
-#include "util/cache.h"
-#include "util/evlist.h"
+#include "util/evlist.h" // for struct evsel_str_handler
 #include "util/evsel.h"
 #include <linux/kernel.h>
 #include <linux/rbtree.h>
@@ -28,6 +26,7 @@
 
 #include "perf.h"
 #include "util/header.h"
+#include <subcmd/pager.h>
 #include <subcmd/parse-options.h>
 #include "util/parse-events.h"
 #include "util/event.h"
@@ -36,6 +35,7 @@
 #include "util/tool.h"
 #include "util/data.h"
 #include "util/debug.h"
+#include <linux/err.h>
 
 #ifdef LACKS_OPEN_MEMSTREAM_PROTOTYPE
 FILE *open_memstream(char **ptr, size_t *sizeloc);
@@ -545,19 +545,19 @@ exit:
 }
 
 typedef int (*tracepoint_handler)(struct timechart *tchart,
-                                 struct perf_evsel *evsel,
+                                 struct evsel *evsel,
                                  struct perf_sample *sample,
                                  const char *backtrace);
 
 static int process_sample_event(struct perf_tool *tool,
                                union perf_event *event,
                                struct perf_sample *sample,
-                               struct perf_evsel *evsel,
+                               struct evsel *evsel,
                                struct machine *machine)
 {
        struct timechart *tchart = container_of(tool, struct timechart, tool);
 
-       if (evsel->attr.sample_type & PERF_SAMPLE_TIME) {
+       if (evsel->core.attr.sample_type & PERF_SAMPLE_TIME) {
                if (!tchart->first_time || tchart->first_time > sample->time)
                        tchart->first_time = sample->time;
                if (tchart->last_time < sample->time)
@@ -575,7 +575,7 @@ static int process_sample_event(struct perf_tool *tool,
 
 static int
 process_sample_cpu_idle(struct timechart *tchart __maybe_unused,
-                       struct perf_evsel *evsel,
+                       struct evsel *evsel,
                        struct perf_sample *sample,
                        const char *backtrace __maybe_unused)
 {
@@ -591,7 +591,7 @@ process_sample_cpu_idle(struct timechart *tchart __maybe_unused,
 
 static int
 process_sample_cpu_frequency(struct timechart *tchart,
-                            struct perf_evsel *evsel,
+                            struct evsel *evsel,
                             struct perf_sample *sample,
                             const char *backtrace __maybe_unused)
 {
@@ -604,7 +604,7 @@ process_sample_cpu_frequency(struct timechart *tchart,
 
 static int
 process_sample_sched_wakeup(struct timechart *tchart,
-                           struct perf_evsel *evsel,
+                           struct evsel *evsel,
                            struct perf_sample *sample,
                            const char *backtrace)
 {
@@ -618,7 +618,7 @@ process_sample_sched_wakeup(struct timechart *tchart,
 
 static int
 process_sample_sched_switch(struct timechart *tchart,
-                           struct perf_evsel *evsel,
+                           struct evsel *evsel,
                            struct perf_sample *sample,
                            const char *backtrace)
 {
@@ -634,7 +634,7 @@ process_sample_sched_switch(struct timechart *tchart,
 #ifdef SUPPORT_OLD_POWER_EVENTS
 static int
 process_sample_power_start(struct timechart *tchart __maybe_unused,
-                          struct perf_evsel *evsel,
+                          struct evsel *evsel,
                           struct perf_sample *sample,
                           const char *backtrace __maybe_unused)
 {
@@ -647,7 +647,7 @@ process_sample_power_start(struct timechart *tchart __maybe_unused,
 
 static int
 process_sample_power_end(struct timechart *tchart,
-                        struct perf_evsel *evsel __maybe_unused,
+                        struct evsel *evsel __maybe_unused,
                         struct perf_sample *sample,
                         const char *backtrace __maybe_unused)
 {
@@ -657,7 +657,7 @@ process_sample_power_end(struct timechart *tchart,
 
 static int
 process_sample_power_frequency(struct timechart *tchart,
-                              struct perf_evsel *evsel,
+                              struct evsel *evsel,
                               struct perf_sample *sample,
                               const char *backtrace __maybe_unused)
 {
@@ -840,7 +840,7 @@ static int pid_end_io_sample(struct timechart *tchart, int pid, int type,
 
 static int
 process_enter_read(struct timechart *tchart,
-                  struct perf_evsel *evsel,
+                  struct evsel *evsel,
                   struct perf_sample *sample)
 {
        long fd = perf_evsel__intval(evsel, sample, "fd");
@@ -850,7 +850,7 @@ process_enter_read(struct timechart *tchart,
 
 static int
 process_exit_read(struct timechart *tchart,
-                 struct perf_evsel *evsel,
+                 struct evsel *evsel,
                  struct perf_sample *sample)
 {
        long ret = perf_evsel__intval(evsel, sample, "ret");
@@ -860,7 +860,7 @@ process_exit_read(struct timechart *tchart,
 
 static int
 process_enter_write(struct timechart *tchart,
-                   struct perf_evsel *evsel,
+                   struct evsel *evsel,
                    struct perf_sample *sample)
 {
        long fd = perf_evsel__intval(evsel, sample, "fd");
@@ -870,7 +870,7 @@ process_enter_write(struct timechart *tchart,
 
 static int
 process_exit_write(struct timechart *tchart,
-                  struct perf_evsel *evsel,
+                  struct evsel *evsel,
                   struct perf_sample *sample)
 {
        long ret = perf_evsel__intval(evsel, sample, "ret");
@@ -880,7 +880,7 @@ process_exit_write(struct timechart *tchart,
 
 static int
 process_enter_sync(struct timechart *tchart,
-                  struct perf_evsel *evsel,
+                  struct evsel *evsel,
                   struct perf_sample *sample)
 {
        long fd = perf_evsel__intval(evsel, sample, "fd");
@@ -890,7 +890,7 @@ process_enter_sync(struct timechart *tchart,
 
 static int
 process_exit_sync(struct timechart *tchart,
-                 struct perf_evsel *evsel,
+                 struct evsel *evsel,
                  struct perf_sample *sample)
 {
        long ret = perf_evsel__intval(evsel, sample, "ret");
@@ -900,7 +900,7 @@ process_exit_sync(struct timechart *tchart,
 
 static int
 process_enter_tx(struct timechart *tchart,
-                struct perf_evsel *evsel,
+                struct evsel *evsel,
                 struct perf_sample *sample)
 {
        long fd = perf_evsel__intval(evsel, sample, "fd");
@@ -910,7 +910,7 @@ process_enter_tx(struct timechart *tchart,
 
 static int
 process_exit_tx(struct timechart *tchart,
-               struct perf_evsel *evsel,
+               struct evsel *evsel,
                struct perf_sample *sample)
 {
        long ret = perf_evsel__intval(evsel, sample, "ret");
@@ -920,7 +920,7 @@ process_exit_tx(struct timechart *tchart,
 
 static int
 process_enter_rx(struct timechart *tchart,
-                struct perf_evsel *evsel,
+                struct evsel *evsel,
                 struct perf_sample *sample)
 {
        long fd = perf_evsel__intval(evsel, sample, "fd");
@@ -930,7 +930,7 @@ process_enter_rx(struct timechart *tchart,
 
 static int
 process_exit_rx(struct timechart *tchart,
-               struct perf_evsel *evsel,
+               struct evsel *evsel,
                struct perf_sample *sample)
 {
        long ret = perf_evsel__intval(evsel, sample, "ret");
@@ -940,7 +940,7 @@ process_exit_rx(struct timechart *tchart,
 
 static int
 process_enter_poll(struct timechart *tchart,
-                  struct perf_evsel *evsel,
+                  struct evsel *evsel,
                   struct perf_sample *sample)
 {
        long fd = perf_evsel__intval(evsel, sample, "fd");
@@ -950,7 +950,7 @@ process_enter_poll(struct timechart *tchart,
 
 static int
 process_exit_poll(struct timechart *tchart,
-                 struct perf_evsel *evsel,
+                 struct evsel *evsel,
                  struct perf_sample *sample)
 {
        long ret = perf_evsel__intval(evsel, sample, "ret");
@@ -1518,10 +1518,7 @@ static int process_header(struct perf_file_section *section __maybe_unused,
                if (!tchart->topology)
                        break;
 
-               if (svg_build_topology_map(ph->env.sibling_cores,
-                                          ph->env.nr_sibling_cores,
-                                          ph->env.sibling_threads,
-                                          ph->env.nr_sibling_threads))
+               if (svg_build_topology_map(&ph->env))
                        fprintf(stderr, "problem building topology\n");
                break;
 
@@ -1534,7 +1531,7 @@ static int process_header(struct perf_file_section *section __maybe_unused,
 
 static int __cmd_timechart(struct timechart *tchart, const char *output_name)
 {
-       const struct perf_evsel_str_handler power_tracepoints[] = {
+       const struct evsel_str_handler power_tracepoints[] = {
                { "power:cpu_idle",             process_sample_cpu_idle },
                { "power:cpu_frequency",        process_sample_cpu_frequency },
                { "sched:sched_wakeup",         process_sample_sched_wakeup },
@@ -1605,8 +1602,8 @@ static int __cmd_timechart(struct timechart *tchart, const char *output_name)
                                                         &tchart->tool);
        int ret = -EINVAL;
 
-       if (session == NULL)
-               return -1;
+       if (IS_ERR(session))
+               return PTR_ERR(session);
 
        symbol__init(&session->header.env);