get_event_component.c File Reference

Include dependency graph for get_event_component.c:

Go to the source code of this file.

Functions

int main (int argc, char **argv)

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 14 of file get_event_component.c.

00015 {
00016     
00017     int i;
00018     int retval;
00019     PAPI_event_info_t info;
00020     int numcmp, cid, our_cid;
00021     const PAPI_component_info_t* cmpinfo;
00022 
00023     /* Set TESTS_QUIET variable */
00024     tests_quiet( argc, argv );
00025 
00026     /* Init PAPI library */
00027     retval = PAPI_library_init( PAPI_VER_CURRENT );
00028     if ( retval != PAPI_VER_CURRENT ) {
00029        test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
00030     }
00031 
00032     numcmp = PAPI_num_components(  );
00033 
00034 
00035     /* Loop through all components */
00036     for( cid = 0; cid < numcmp; cid++ )
00037     {
00038         cmpinfo = PAPI_get_component_info( cid );
00039 
00040          if (cmpinfo  == NULL)
00041          {
00042             test_fail( __FILE__, __LINE__, "PAPI_get_component_info", 2 );
00043          }
00044 
00045          if (cmpinfo->disabled && !TESTS_QUIET) {
00046            printf( "Name:   %-23s %s\n", cmpinfo->name ,cmpinfo->description);
00047            printf("   \\-> Disabled: %s\n",cmpinfo->disabled_reason);
00048            continue;
00049          }
00050 
00051 
00052        i = 0 | PAPI_NATIVE_MASK;
00053        retval = PAPI_enum_cmp_event( &i, PAPI_ENUM_FIRST, cid );
00054        if (retval!=PAPI_OK) continue;
00055 
00056        do {
00057        if (PAPI_get_event_info( i, &info ) != PAPI_OK) {
00058            if (!TESTS_QUIET) {
00059            printf("Getting information about event: %#x failed\n", i);
00060            }
00061            continue;
00062        }
00063       our_cid=PAPI_get_event_component(i);
00064 
00065       if (our_cid!=cid) {
00066          if (!TESTS_QUIET) {
00067             printf("%d %d %s\n",cid,our_cid,info.symbol);
00068          }
00069              test_fail( __FILE__, __LINE__, "component mismatch", 1 );
00070       }
00071 
00072       if (!TESTS_QUIET) {
00073         printf("%d %d %s\n",cid,our_cid,info.symbol);
00074       }
00075 
00076       
00077        } while ( PAPI_enum_cmp_event( &i, PAPI_ENUM_EVENTS, cid ) == PAPI_OK );
00078 
00079     }
00080 
00081     test_pass( __FILE__, NULL, 0 );
00082    
00083     return 0;
00084 }

Here is the call graph for this function:


Generated on 17 Nov 2016 for PAPI by  doxygen 1.6.1