PAPI  5.3.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
component.c File Reference
Include dependency graph for component.c:

Go to the source code of this file.

Data Structures

struct  command_flags_t
 

Macros

#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)
 

Macro Definition Documentation

#define EVT_LINE   80

Definition at line 27 of file component.c.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 73 of file component.c.

74 {
75  int retval;
76  const PAPI_hw_info_t *hwinfo = NULL;
77  const PAPI_component_info_t* cmpinfo;
79  int numcmp, cid;
80 
81  tests_quiet( argc, argv ); /* Set TESTS_QUIET variable */
82 
83  /* Initialize before parsing the input arguments */
85  if ( retval != PAPI_VER_CURRENT )
86  test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
87 
88  parse_args( argc, argv, &flags );
89 
90  if ( !TESTS_QUIET ) {
91  retval = PAPI_set_debug( PAPI_VERB_ECONT );
92  if ( retval != PAPI_OK )
93  test_fail( __FILE__, __LINE__, "PAPI_set_debug", retval );
94  }
95 
96  retval =
98  ( "Available components and hardware information.\n", &hwinfo );
99  if ( retval != PAPI_OK )
100  test_fail( __FILE__, __LINE__, "PAPI_get_hardware_info", 2 );
101 
102 
103  /* Compiled-in Components */
104  numcmp = PAPI_num_components( );
105 
106  printf("Compiled-in components:\n");
107  for ( cid = 0; cid < numcmp; cid++ ) {
108  cmpinfo = PAPI_get_component_info( cid );
109 
110  printf( "Name: %-23s %s\n", cmpinfo->name ,cmpinfo->description);
111 
112  if (cmpinfo->disabled) {
113  printf(" \\-> Disabled: %s\n",cmpinfo->disabled_reason);
114  }
115 
116  if ( flags.details ) {
117  printf( "Version:\t\t\t%s\n", cmpinfo->version );
118  printf( "Number of native events:\t%d\n", cmpinfo->num_native_events);
119  printf( "Number of preset events:\t%d\n", cmpinfo->num_preset_events);
120  printf("\n");
121  }
122  }
123 
124  printf("\nActive components:\n");
125  numcmp = PAPI_num_components( );
126 
127  for ( cid = 0; cid < numcmp; cid++ ) {
128  cmpinfo = PAPI_get_component_info( cid );
129  if (cmpinfo->disabled) continue;
130 
131  printf( "Name: %-23s %s\n", cmpinfo->name ,cmpinfo->description);
132  printf( " %-23s Native: %d, Preset: %d, Counters: %d\n\n",
133  " ", cmpinfo->num_native_events, cmpinfo->num_preset_events,
134  cmpinfo->num_cntrs);
135 
136  if ( flags.details ) {
137  printf( "Version:\t\t\t%s\n", cmpinfo->version );
138  printf( "Number of native events:\t%d\n", cmpinfo->num_native_events);
139  printf( "Number of preset events:\t%d\n", cmpinfo->num_preset_events);
140  printf("\n");
141  }
142  }
143 
144 
145  printf
146  ( "\n--------------------------------------------------------------------------------\n" );
147  test_pass( __FILE__, NULL, 0 );
148  exit( 0 );
149 }
char name[PAPI_MAX_STR_LEN]
Definition: papi.h:625
const PAPI_component_info_t * PAPI_get_component_info(int cidx)
Definition: papi.c:803
Hardware info structure.
Definition: papi.h:775
long long flags
Definition: iozone.c:12330
int papi_print_header(char *prompt, const PAPI_hw_info_t **hwinfo)
Definition: test_utils.c:21
int PAPI_num_components(void)
Definition: papi.c:4272
#define PAPI_VERB_ECONT
Definition: fpapi.h:39
return PAPI_OK
Definition: linux-nvml.c:458
tests_quiet(argc, argv)
#define printf
Definition: papi_test.h:125
test_pass(__FILE__, NULL, 0)
int int argc
Definition: iozone.c:1609
int TESTS_QUIET
Definition: test_utils.c:11
char ** argv
Definition: iozone.c:1610
char disabled_reason[PAPI_MAX_STR_LEN]
Definition: papi.h:632
test_fail(__FILE__, __LINE__,"PAPI_library_init", retval)
int PAPI_library_init(int version)
Definition: papi.c:495
#define PAPI_VER_CURRENT
Definition: fpapi.h:14
char description[PAPI_MAX_STR_LEN]
Definition: papi.h:628
static void parse_args(int argc, char **argv, command_flags_t *f)
Definition: component.c:49
char version[PAPI_MIN_STR_LEN]
Definition: papi.h:629
ssize_t retval
Definition: libasync.c:338
void exit()
int PAPI_set_debug(int level)
Definition: papi.c:3027

Here is the call graph for this function:

static void parse_args ( int  argc,
char **  argv,
command_flags_t f 
)
static

Definition at line 49 of file component.c.

50 {
51  int i;
52 
53  /* Look for all currently defined commands */
54  memset( f, 0, sizeof ( command_flags_t ) );
55  for ( i = 1; i < argc; i++ ) {
56  if ( !strcmp( argv[i], "-d" ) ) {
57  f->details = 1;
58  } else if ( !strcmp( argv[i], "-h" ) || !strcmp( argv[i], "--help" ) )
59  f->help = 1;
60  else
61  printf( "%s is not supported\n", argv[i] );
62  }
63 
64  /* if help requested, print and bail */
65  if ( f->help ) {
66  print_help( argv );
67  exit( 1 );
68  }
69 
70 }
memset(eventId, 0, size)
#define printf
Definition: papi_test.h:125
static void print_help(char **argv)
Definition: component.c:38
int int argc
Definition: iozone.c:1609
char ** argv
Definition: iozone.c:1610
int i
Definition: fileop.c:140
void exit()

Here is the call graph for this function:

Here is the caller graph for this function:

static void print_help ( char **  argv)
static

Definition at line 38 of file component.c.

39 {
40  printf( "This is the PAPI component avail program.\n" );
41  printf( "It provides availability of installed PAPI components.\n" );
42  printf( "Usage: %s [options]\n", argv[0] );
43  printf( "Options:\n\n" );
44  printf( " --help, -h print this help message\n" );
45  printf( " -d print detailed information on each component\n" );
46 }
#define printf
Definition: papi_test.h:125
char ** argv
Definition: iozone.c:1610

Here is the caller graph for this function: