PAPI  5.0.1.0
get_event_component.c
Go to the documentation of this file.
00001 /*
00002  * File:    get_event_component.c
00003  * Author:  Vince Weaver
00004  *          vweaver1@eecs.utk.edu
00005  */
00006 
00007 /*
00008   This test makes sure PAPI_get_event_component() works
00009 */
00010 
00011 #include "papi_test.h"
00012 
00013 int
00014 main( int argc, char **argv )
00015 {
00016     
00017     int i;
00018     int retval;
00019     PAPI_event_info_t info;
00020     int numcmp, cid, our_cid;
00021 
00022     /* Set TESTS_QUIET variable */
00023     tests_quiet( argc, argv );
00024 
00025     /* Init PAPI library */
00026     retval = PAPI_library_init( PAPI_VER_CURRENT );
00027     if ( retval != PAPI_VER_CURRENT ) {
00028        test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
00029     }
00030 
00031     numcmp = PAPI_num_components(  );
00032 
00033 
00034     /* Loop through all components */
00035     for( cid = 0; cid < numcmp; cid++ ) {
00036 
00037        i = 0 | PAPI_NATIVE_MASK;
00038        retval = PAPI_enum_cmp_event( &i, PAPI_ENUM_FIRST, cid );
00039 
00040        do {
00041           retval = PAPI_get_event_info( i, &info );
00042       our_cid=PAPI_get_event_component(i);
00043 
00044       if (our_cid!=cid) {
00045              test_fail( __FILE__, __LINE__, "component mismatch", 1 );
00046       }
00047 
00048       if (!TESTS_QUIET) {
00049         printf("%d %d %s\n",cid,our_cid,info.symbol);
00050       }
00051 
00052       
00053        } while ( PAPI_enum_cmp_event( &i, PAPI_ENUM_EVENTS, cid ) == PAPI_OK );
00054 
00055     }
00056 
00057     test_pass( __FILE__, NULL, 0 );
00058    
00059     return 0;
00060 }
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines