]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - tools/perf/builtin-report.c
shmem: avoid maybe-uninitialized warning
[linux.git] / tools / perf / builtin-report.c
index 6e88460cd13d3d65ad54f18470a1e8d7e445b06d..d2afbe4a240dbc5c90168ff15a60405fa324bf8f 100644 (file)
@@ -36,7 +36,7 @@
 #include "util/hist.h"
 #include "util/data.h"
 #include "arch/common.h"
-
+#include "util/time-utils.h"
 #include "util/auxtrace.h"
 
 #include <dlfcn.h>
@@ -59,6 +59,8 @@ struct report {
        const char              *pretty_printing_style;
        const char              *cpu_list;
        const char              *symbol_filter_str;
+       const char              *time_str;
+       struct perf_time_interval ptime;
        float                   min_percent;
        u64                     nr_entries;
        u64                     queue_size;
@@ -158,6 +160,9 @@ static int process_sample_event(struct perf_tool *tool,
        };
        int ret = 0;
 
+       if (perf_time__skip_sample(&rep->ptime, sample->time))
+               return 0;
+
        if (machine__resolve(machine, &al, sample) < 0) {
                pr_debug("problem processing %d event, skipping it.\n",
                         event->header.type);
@@ -207,11 +212,14 @@ static int process_read_event(struct perf_tool *tool,
 
        if (rep->show_threads) {
                const char *name = evsel ? perf_evsel__name(evsel) : "unknown";
-               perf_read_values_add_value(&rep->show_threads_values,
+               int err = perf_read_values_add_value(&rep->show_threads_values,
                                           event->read.pid, event->read.tid,
                                           event->read.id,
                                           name,
                                           event->read.value);
+
+               if (err)
+                       return err;
        }
 
        dump_printf(": %d %d %s %" PRIu64 "\n", event->read.pid, event->read.tid,
@@ -539,8 +547,11 @@ static int __cmd_report(struct report *rep)
                }
        }
 
-       if (rep->show_threads)
-               perf_read_values_init(&rep->show_threads_values);
+       if (rep->show_threads) {
+               ret = perf_read_values_init(&rep->show_threads_values);
+               if (ret)
+                       return ret;
+       }
 
        ret = report__setup_sample_type(rep);
        if (ret) {
@@ -824,6 +835,8 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
        OPT_CALLBACK_DEFAULT(0, "stdio-color", NULL, "mode",
                             "'always' (default), 'never' or 'auto' only applicable to --stdio mode",
                             stdio__config_color, "always"),
+       OPT_STRING(0, "time", &report.time_str, "str",
+                  "Time span of interest (start,stop)"),
        OPT_END()
        };
        struct perf_data_file file = {
@@ -905,6 +918,9 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
        if (itrace_synth_opts.last_branch)
                has_br_stack = true;
 
+       if (has_br_stack && branch_call_mode)
+               symbol_conf.show_branchflag_count = true;
+
        /*
         * Branch mode is a tristate:
         * -1 means default, so decide based on the file having branch data.
@@ -1006,6 +1022,11 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
        if (symbol__init(&session->header.env) < 0)
                goto error;
 
+       if (perf_time__parse_str(&report.ptime, report.time_str) != 0) {
+               pr_err("Invalid time string\n");
+               return -EINVAL;
+       }
+
        sort__setup_elide(stdout);
 
        ret = __cmd_report(&report);