Check the evsel->attr.inherit_stat bit and show warning message if it's
missing and -T/--threads option was given:

  $ perf report -T
  Error: perf.data file has no per-thread stat data.
         Did you run 'perf record' with -s option?

Suggested-by: David Ahern <dsah...@gmail.com>
Signed-off-by: Namhyung Kim <namhy...@kernel.org>
---
Move error message before header info message

 tools/perf/builtin-report.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 6ac2c7a01a63..343cca2a2779 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -833,6 +833,19 @@ repeat:
                }
        }
 
+       if (report.show_threads) {
+               struct perf_evsel *evsel;
+
+               evlist__for_each(session->evlist, evsel) {
+                       if (!evsel->attr.inherit_stat) {
+                               pr_err("Error: %s file has no per-thread stat 
data.\n"
+                                      "       Did you run 'perf record' with 
-s option?\n",
+                                       input_name);
+                               goto error;
+                       }
+               }
+       }
+
        if (strcmp(input_name, "-") != 0)
                setup_browser(true);
        else
-- 
2.4.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to