Merge branch 'for-3.5-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj...
[firefly-linux-kernel-4.4.55.git] / tools / perf / builtin-report.c
index cdae9b2db1cc0ed270e536e6c3b368a353cd780a..8c767c6bca91b7490cb1564da230c7c9021422e6 100644 (file)
@@ -251,13 +251,13 @@ static int perf_report__setup_sample_type(struct perf_report *rep)
 
        if (!(self->sample_type & PERF_SAMPLE_CALLCHAIN)) {
                if (sort__has_parent) {
-                       ui__warning("Selected --sort parent, but no "
+                       ui__error("Selected --sort parent, but no "
                                    "callchain data. Did you call "
                                    "'perf record' without -g?\n");
                        return -EINVAL;
                }
                if (symbol_conf.use_callchain) {
-                       ui__warning("Selected -g but no callchain data. Did "
+                       ui__error("Selected -g but no callchain data. Did "
                                    "you call 'perf record' without -g?\n");
                        return -1;
                }
@@ -266,17 +266,15 @@ static int perf_report__setup_sample_type(struct perf_report *rep)
                   !symbol_conf.use_callchain) {
                        symbol_conf.use_callchain = true;
                        if (callchain_register_param(&callchain_param) < 0) {
-                               ui__warning("Can't register callchain "
-                                           "params.\n");
+                               ui__error("Can't register callchain params.\n");
                                return -EINVAL;
                        }
        }
 
        if (sort__branch_mode == 1) {
                if (!(self->sample_type & PERF_SAMPLE_BRANCH_STACK)) {
-                       fprintf(stderr, "selected -b but no branch data."
-                                       " Did you call perf record without"
-                                       " -b?\n");
+                       ui__error("Selected -b but no branch data. "
+                                 "Did you call perf record without -b?\n");
                        return -1;
                }
        }
@@ -296,12 +294,15 @@ static size_t hists__fprintf_nr_sample_events(struct hists *self,
 {
        size_t ret;
        char unit;
-       unsigned long nr_events = self->stats.nr_events[PERF_RECORD_SAMPLE];
+       unsigned long nr_samples = self->stats.nr_events[PERF_RECORD_SAMPLE];
+       u64 nr_events = self->stats.total_period;
 
-       nr_events = convert_unit(nr_events, &unit);
-       ret = fprintf(fp, "# Events: %lu%c", nr_events, unit);
+       nr_samples = convert_unit(nr_samples, &unit);
+       ret = fprintf(fp, "# Samples: %lu%c", nr_samples, unit);
        if (evname != NULL)
-               ret += fprintf(fp, " %s", evname);
+               ret += fprintf(fp, " of event '%s'", evname);
+
+       ret += fprintf(fp, "\n# Event count (approx.): %" PRIu64, nr_events);
        return ret + fprintf(fp, "\n#\n");
 }
 
@@ -417,7 +418,7 @@ static int __cmd_report(struct perf_report *rep)
        }
 
        if (nr_samples == 0) {
-               ui__warning("The %s file has no samples!\n", session->filename);
+               ui__error("The %s file has no samples!\n", session->filename);
                goto out_delete;
        }
 
@@ -680,14 +681,10 @@ int cmd_report(int argc, const char **argv, const char *prefix __used)
 
        }
 
-       if (strcmp(report.input_name, "-") != 0) {
-               if (report.use_gtk)
-                       perf_gtk_setup_browser(argc, argv, true);
-               else
-                       setup_browser(true);
-       } else {
+       if (strcmp(report.input_name, "-") != 0)
+               setup_browser(true);
+       else
                use_browser = 0;
-       }
 
        /*
         * Only in the newt browser we are doing integrated annotation,