22 int watchdog_detected=0,watchdog_value=0;
25 fff=fopen(
"/proc/sys/kernel/nmi_watchdog",
"r");
27 if (fscanf(
fff,
"%d",&watchdog_value)==1) {
28 if (watchdog_value>0) watchdog_detected=1;
36 return watchdog_detected;
39int main(
int argc,
char **argv ) {
41 int retval,watchdog_active=0;
55 if (watchdog_active<0) {
57 "nmi_watchdog file does not exist\n", 0);
60 if (watchdog_active) {
62 printf(
"\nOn perf_event kernels with the nmi_watchdog enabled\n");
63 printf(
"the watchdog steals an event, but the scheduability code\n");
64 printf(
"is not notified. Thus adding a full complement of events\n");
65 printf(
"seems to pass, but then fails at read time.\n");
66 printf(
"Because of this, PAPI has to do some slow workarounds.\n");
67 printf(
"For best PAPI performance, you may wish to disable\n");
68 printf(
"the watchdog by running (as root)\n");
69 printf(
"\techo \"0\" > /proc/sys/kernel/nmi_watchdog\n\n");
73 "NMI Watchdog Active, enabling slow workarounds", 0 );
initialize the PAPI library.
static int detect_nmi_watchdog(void)
Return codes and api definitions.
int fclose(FILE *__stream)
int tests_quiet(int argc, char **argv)
void PAPI_NORETURN test_fail(const char *file, int line, const char *call, int retval)
void PAPI_NORETURN test_pass(const char *filename)
void test_warn(const char *file, int line, const char *call, int retval)
void PAPI_NORETURN test_skip(const char *file, int line, const char *call, int retval)