perf stat: Only print NMI watchdog hint when enabled
authorAndi Kleen <ak@linux.intel.com>
Tue, 23 May 2017 01:00:16 +0000 (18:00 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 2 Jun 2017 14:15:34 +0000 (11:15 -0300)
Only print the NMI watchdog hint when that watchdog it actually enabled.

This avoids printing these unnecessarily.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Link: http://lkml.kernel.org/n/tip-lnw7edxnqsphkmeew857wz1i@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-stat.c

index a935b502373253217d6f43680e6b88a6ab143bfe..ad9324d1daf9f29a990a0d8f903563873ac91ef9 100644 (file)
@@ -1578,6 +1578,7 @@ static void print_header(int argc, const char **argv)
 static void print_footer(void)
 {
        FILE *output = stat_config.output;
+       int n;
 
        if (!null_run)
                fprintf(output, "\n");
@@ -1590,7 +1591,9 @@ static void print_footer(void)
        }
        fprintf(output, "\n\n");
 
-       if (print_free_counters_hint)
+       if (print_free_counters_hint &&
+           sysctl__read_int("kernel/nmi_watchdog", &n) >= 0 &&
+           n > 0)
                fprintf(output,
 "Some events weren't counted. Try disabling the NMI watchdog:\n"
 "      echo 0 > /proc/sys/kernel/nmi_watchdog\n"