nmi_watchdog.c File Reference

Include dependency graph for nmi_watchdog.c:

Go to the source code of this file.

Functions

int detect_nmi_watchdog (void)
int main (int argc, char **argv)

Function Documentation

int detect_nmi_watchdog ( void   ) 

Definition at line 17 of file nmi_watchdog.c.

00017                               {
00018 
00019   int watchdog_detected=0,watchdog_value=0;
00020   FILE *fff;
00021 
00022   fff=fopen("/proc/sys/kernel/nmi_watchdog","r");
00023   if (fff!=NULL) {
00024     if (fscanf(fff,"%d",&watchdog_value)==1) {
00025        if (watchdog_value>0) watchdog_detected=1;
00026     }
00027     fclose(fff);
00028   }
00029   else {
00030     watchdog_detected=-1;
00031   }
00032 
00033   return watchdog_detected;
00034 }

Here is the caller graph for this function:

int main ( int  argc,
char **  argv 
)

Definition at line 36 of file nmi_watchdog.c.

00036                                   {
00037 
00038   int retval,watchdog_active=0;
00039   
00040   /* Set TESTS_QUIET variable */
00041   tests_quiet( argc, argv );    
00042 
00043   /* Init the PAPI library */
00044   retval = PAPI_library_init( PAPI_VER_CURRENT );
00045   if ( retval != PAPI_VER_CURRENT ) {
00046      test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
00047   }
00048 
00049   watchdog_active=detect_nmi_watchdog();
00050 
00051   if (watchdog_active<0) {
00052     test_skip( __FILE__, __LINE__, "nmi_watchdog file does not exist\n", 0);
00053   }
00054 
00055   if (watchdog_active) {
00056     if (!TESTS_QUIET) {
00057       printf("\nOn perf_event kernels with the nmi_watchdog enabled\n");
00058       printf("the watchdog steals an event, but the scheduability code\n");
00059       printf("is not notified.  Thus adding a full complement of events\n");
00060       printf("seems to pass, but then fails at read time.\n");
00061       printf("Because of this, PAPI has to do some slow workarounds.\n");
00062       printf("For best PAPI performance, you may wish to disable\n");
00063       printf("the watchdog by running (as root)\n");
00064       printf("\techo \"0\" > /proc/sys/kernel/nmi_watchdog\n\n");
00065     }
00066 
00067      test_warn( __FILE__, __LINE__, "NMI Watchdog Active, enabling slow workarounds", 0 );
00068   }
00069     
00070   test_pass( __FILE__, NULL, 0 );
00071     
00072   return 0;
00073 }

Here is the call graph for this function:


Generated on 8 Sep 2016 for PAPI by  doxygen 1.6.1