perf report: Fix -T/--threads option to work again
[firefly-linux-kernel-4.4.55.git] / tools / perf / builtin-report.c
index 52f74e1367e9c041020ce54f34beba07a56b3453..b63aeda719be0c7604da5229e1a3a0ec33253400 100644 (file)
@@ -304,7 +304,7 @@ static size_t hists__fprintf_nr_sample_events(struct hists *hists, struct report
 
        if (rep->mem_mode) {
                ret += fprintf(fp, "\n# Total weight : %" PRIu64, nr_events);
-               ret += fprintf(fp, "\n# Sort order   : %s", sort_order);
+               ret += fprintf(fp, "\n# Sort order   : %s", sort_order ? : default_mem_sort_order);
        } else
                ret += fprintf(fp, "\n# Event count (approx.): %" PRIu64, nr_events);
        return ret + fprintf(fp, "\n#\n");
@@ -329,7 +329,7 @@ static int perf_evlist__tty_browse_hists(struct perf_evlist *evlist,
                fprintf(stdout, "\n\n");
        }
 
-       if (sort_order == default_sort_order &&
+       if (sort_order == NULL &&
            parent_pattern == default_parent_pattern) {
                fprintf(stdout, "#\n# (%s)\n#\n", help);
 
@@ -347,7 +347,7 @@ static int perf_evlist__tty_browse_hists(struct perf_evlist *evlist,
 static void report__warn_kptr_restrict(const struct report *rep)
 {
        struct map *kernel_map = rep->session->machines.host.vmlinux_maps[MAP__FUNCTION];
-       struct kmap *kernel_kmap = map__kmap(kernel_map);
+       struct kmap *kernel_kmap = kernel_map ? map__kmap(kernel_map) : NULL;
 
        if (kernel_map == NULL ||
            (kernel_map->dso->hit &&
@@ -669,6 +669,10 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
                   "only consider symbols in these dsos"),
        OPT_STRING('c', "comms", &symbol_conf.comm_list_str, "comm[,comm...]",
                   "only consider symbols in these comms"),
+       OPT_STRING(0, "pid", &symbol_conf.pid_list_str, "pid[,pid...]",
+                  "only consider symbols in these pids"),
+       OPT_STRING(0, "tid", &symbol_conf.tid_list_str, "tid[,tid...]",
+                  "only consider symbols in these tids"),
        OPT_STRING('S', "symbols", &symbol_conf.sym_list_str, "symbol[,symbol...]",
                   "only consider these symbols"),
        OPT_STRING(0, "symbol-filter", &report.symbol_filter_str, "filter",
@@ -676,7 +680,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
        OPT_STRING('w', "column-widths", &symbol_conf.col_width_list_str,
                   "width[,width...]",
                   "don't try to adjust column width, use these fixed values"),
-       OPT_STRING('t', "field-separator", &symbol_conf.field_sep, "separator",
+       OPT_STRING_NOEMPTY('t', "field-separator", &symbol_conf.field_sep, "separator",
                   "separator for columns, no spaces will be added between "
                   "columns '.' is reserved."),
        OPT_BOOLEAN('U', "hide-unresolved", &report.hide_unresolved,