|
PAPI
5.0.1.0
|

Go to the source code of this file.
Data Structures | |
| struct | command_flags_t |
Defines | |
| #define | EVT_LINE 80 |
Functions | |
| static void | print_help (char **argv) |
| static void | parse_args (int argc, char **argv, command_flags_t *f) |
| int | main (int argc, char **argv) |
| #define EVT_LINE 80 |
Definition at line 27 of file component.c.
| int main | ( | int | argc, |
| char ** | argv | ||
| ) |
Definition at line 73 of file component.c.
{
int retval;
const PAPI_hw_info_t *hwinfo = NULL;
const PAPI_component_info_t* cmpinfo;
command_flags_t flags;
int numcmp, cid;
tests_quiet( argc, argv ); /* Set TESTS_QUIET variable */
/* Initialize before parsing the input arguments */
retval = PAPI_library_init( PAPI_VER_CURRENT );
if ( retval != PAPI_VER_CURRENT )
test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
parse_args( argc, argv, &flags );
if ( !TESTS_QUIET ) {
retval = PAPI_set_debug( PAPI_VERB_ECONT );
if ( retval != PAPI_OK )
test_fail( __FILE__, __LINE__, "PAPI_set_debug", retval );
}
retval =
papi_print_header
( "Available components and hardware information.\n", &hwinfo );
if ( retval != PAPI_OK )
test_fail( __FILE__, __LINE__, "PAPI_get_hardware_info", 2 );
/* Compiled-in Components */
numcmp = PAPI_num_components( );
printf("Compiled-in components:\n");
for ( cid = 0; cid < numcmp; cid++ ) {
cmpinfo = PAPI_get_component_info( cid );
printf( "Name: %-23s %s\n", cmpinfo->name ,cmpinfo->description);
if (cmpinfo->disabled) {
printf(" \\-> Disabled: %s\n",cmpinfo->disabled_reason);
}
if ( flags.details ) {
printf( "Version:\t\t\t%s\n", cmpinfo->version );
printf( "Number of native events:\t%d\n", cmpinfo->num_native_events);
printf( "Number of preset events:\t%d\n", cmpinfo->num_preset_events);
printf("\n");
}
}
printf("\nActive components:\n");
numcmp = PAPI_num_components( );
for ( cid = 0; cid < numcmp; cid++ ) {
cmpinfo = PAPI_get_component_info( cid );
if (cmpinfo->disabled) continue;
printf( "Name: %-23s %s\n", cmpinfo->name ,cmpinfo->description);
printf( " %-23s Native: %d, Preset: %d, Counters: %d\n\n",
" ", cmpinfo->num_native_events, cmpinfo->num_preset_events,
cmpinfo->num_cntrs);
if ( flags.details ) {
printf( "Version:\t\t\t%s\n", cmpinfo->version );
printf( "Number of native events:\t%d\n", cmpinfo->num_native_events);
printf( "Number of preset events:\t%d\n", cmpinfo->num_preset_events);
printf("\n");
}
}
printf
( "\n--------------------------------------------------------------------------------\n" );
test_pass( __FILE__, NULL, 0 );
exit( 0 );
}

| static void parse_args | ( | int | argc, |
| char ** | argv, | ||
| command_flags_t * | f | ||
| ) | [static] |
Definition at line 49 of file component.c.
{
int i;
/* Look for all currently defined commands */
memset( f, 0, sizeof ( command_flags_t ) );
for ( i = 1; i < argc; i++ ) {
if ( !strcmp( argv[i], "-d" ) ) {
f->details = 1;
} else if ( strstr( argv[i], "-h" ) )
f->help = 1;
else
printf( "%s is not supported\n", argv[i] );
}
/* if help requested, print and bail */
if ( f->help ) {
print_help( argv );
exit( 1 );
}
}


| static void print_help | ( | char ** | argv | ) | [static] |
Definition at line 38 of file component.c.
{
printf( "This is the PAPI component avail program.\n" );
printf( "It provides availability of installed PAPI components.\n" );
printf( "Usage: %s [options]\n", argv[0] );
printf( "Options:\n\n" );
printf( " --help, -h print this help message\n" );
printf( " -d print detailed information on each component\n" );
}
