perf util: Factor out sysctl__nmi_watchdog_enabled()
authorKan Liang <kan.liang@linux.intel.com>
Mon, 24 Feb 2020 21:59:22 +0000 (13:59 -0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 10 Mar 2020 17:46:19 +0000 (14:46 -0300)
commit2a14c1bf017f48a17c8c0ba26a22625363e77cc7
tree616467e12bc8df3f3196c7b938498b7f459f8c83
parentf742634ab47f59160a85ddc502418556b21953c2
perf util: Factor out sysctl__nmi_watchdog_enabled()

The NMI watchdog status is required for metric group constraint
examination.  Factor out sysctl__nmi_watchdog_enabled() to retrieve the
NMI watchdog status.

Users may count more than one metric group each time. If so, the NMI
watchdog status may be retrieved several times. To reduce the overhead,
cache the NMI watchdog status.

Replace the NMI watchdog status checking in print_footer() by
sysctl__nmi_watchdog_enabled().

Suggested-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Link: http://lore.kernel.org/lkml/1582581564-184429-4-git-send-email-kan.liang@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/stat-display.c
tools/perf/util/util.c
tools/perf/util/util.h