|
PAPI
5.0.1.0
|

Go to the source code of this file.
Functions | |
| int | main (int argc, char **argv) |
| List all appio events codes and names. | |
| int main | ( | int | argc, |
| char ** | argv | ||
| ) |
test case for the appio component
Definition at line 19 of file appio_list_events.c.
{
int retval,cid,numcmp;
int total_events=0;
int code;
char event_name[PAPI_MAX_STR_LEN];
int r;
const PAPI_component_info_t *cmpinfo = NULL;
/* Set TESTS_QUIET variable */
tests_quiet( argc, argv );
/* PAPI Initialization */
retval = PAPI_library_init( PAPI_VER_CURRENT );
if ( retval != PAPI_VER_CURRENT ) {
test_fail(__FILE__, __LINE__,"PAPI_library_init failed\n",retval);
}
if (!TESTS_QUIET) {
printf("Listing all appio events\n");
}
numcmp = PAPI_num_components();
for(cid=0; cid<numcmp; cid++) {
if ( (cmpinfo = PAPI_get_component_info(cid)) == NULL) {
test_fail(__FILE__, __LINE__,"PAPI_get_component_info failed\n",-1);
}
if ( strstr(cmpinfo->name, "appio") == NULL) {
continue;
}
if (!TESTS_QUIET) {
printf("Component %d (%d) - %d events - %s\n",
cid, cmpinfo->CmpIdx,
cmpinfo->num_native_events, cmpinfo->name);
}
code = PAPI_NATIVE_MASK;
r = PAPI_enum_cmp_event( &code, PAPI_ENUM_FIRST, cid );
while ( r == PAPI_OK ) {
retval = PAPI_event_code_to_name( code, event_name );
if ( retval != PAPI_OK ) {
test_fail( __FILE__, __LINE__, "PAPI_event_code_to_name", retval );
}
if (!TESTS_QUIET) {
printf("0x%x %s\n", code, event_name);
}
total_events++;
r = PAPI_enum_cmp_event( &code, PAPI_ENUM_EVENTS, cid );
}
}
if (total_events==0) {
test_skip(__FILE__,__LINE__,"No appio events found", 0);
}
test_pass( __FILE__, NULL, 0 );
return 0;
}
