GNU Linux-libre 4.14.266-gnu1
[releases.git] / tools / perf / arch / x86 / util / group.c
1 // SPDX-License-Identifier: GPL-2.0
2 #include <stdio.h>
3 #include "api/fs/fs.h"
4 #include "util/group.h"
5
6 /*
7  * Check whether we can use a group for top down.
8  * Without a group may get bad results due to multiplexing.
9  */
10 bool arch_topdown_check_group(bool *warn)
11 {
12         int n;
13
14         if (sysctl__read_int("kernel/nmi_watchdog", &n) < 0)
15                 return false;
16         if (n > 0) {
17                 *warn = true;
18                 return false;
19         }
20         return true;
21 }
22
23 void arch_topdown_group_warn(void)
24 {
25         fprintf(stderr,
26                 "nmi_watchdog enabled with topdown. May give wrong results.\n"
27                 "Disable with echo 0 > /proc/sys/kernel/nmi_watchdog\n");
28 }