59typedef struct command_flags
81 printf(
"This is the PAPI native avail program.\n" );
82 printf(
"It provides availability and detail information for PAPI native events.\n" );
83 printf(
"Usage: %s [options]\n", argv[0] );
84 printf(
"\nOptions:\n" );
85 printf(
" --help, -h print this help message\n" );
86 printf(
" -d display detailed information about native events\n" );
87 printf(
" -e EVENTNAME display detailed information about named native event\n" );
88 printf(
" -i EVENTSTR include only event names that contain EVENTSTR\n" );
89 printf(
" -x EVENTSTR exclude any event names that contain EVENTSTR\n" );
90 printf(
" --noumasks suppress display of Unit Mask information\n" );
91 printf(
"\nProcessor-specific options\n");
92 printf(
" --darr display events supporting Data Address Range Restriction\n" );
93 printf(
" --dear display Data Event Address Register events only\n" );
94 printf(
" --iarr display events supporting Instruction Address Range Restriction\n" );
95 printf(
" --iear display Instruction Event Address Register events only\n" );
96 printf(
" --opcm display events supporting OpCode Matching\n" );
97 printf(
" --nogroups suppress display of Event grouping information\n" );
98 printf(
" --mic <index> display events on the specified Xeon Phi device\n" );
105 return ( ( arg == NULL ) || ( strlen( arg ) == 0 ) || ( arg[0] ==
'-' ) );
119 for (
i = 1;
i < argc;
i++ ) {
120 if ( !strcmp( argv[
i],
"--darr" ) )
122 else if ( !strcmp( argv[
i],
"--dear" ) )
124 else if ( !strcmp( argv[
i],
"--iarr" ) )
126 else if ( !strcmp( argv[
i],
"--iear" ) )
128 else if ( !strcmp( argv[
i],
"--opcm" ) )
130 else if ( !strcmp( argv[
i],
"--noumasks" ) )
132 else if ( !strcmp( argv[
i],
"--nogroups" ) )
134 else if ( !strcmp( argv[
i],
"-d" ) )
136 else if ( !strcmp( argv[
i],
"--mic" ) )
141 printf(
"Specify a device index for --mic\n");
144 f->devidx = strtol(argv[
i], 0, 10);
145 }
else if ( !strcmp( argv[
i],
"-e" ) ) {
150 printf(
"Invalid argument for -e\n");
153 }
else if ( !strcmp( argv[
i],
"-i" ) ) {
158 printf(
"Invalid argument for -i\n");
161 }
else if ( !strcmp( argv[
i],
"-x" ) ) {
166 printf(
"Invalid argument for -x\n");
169 }
else if ( !strcmp( argv[
i],
"-h" ) || !strcmp( argv[
i],
"--help" ) )
172 printf(
"%s is not supported\n", argv[
i] );
187 while ( spaces-- > 0 )
194 unsigned int i, j = 0;
199 printf(
"| %-73s|\n", info->
symbol );
202 printf(
"| %-77s|\n", info->
symbol );
213 i = (
unsigned int ) strlen( str );
217 printf(
"%s\n", str );
227 if ((ptr=strstr(info->
symbol,
":::"))) {
230 }
else if ((ptr=strstr(info->
symbol,
"::"))) {
237 if ( ( pmask = strchr( ptr,
':' ) ) == NULL ) {
240 memmove( info->
symbol, pmask, ( strlen( pmask ) + 1 ) *
sizeof (
char ) );
245 memmove( info->
long_descr, pmask + sizeof (
char ),
246 ( strlen( pmask ) + 1 ) *
sizeof (
char ) );
264 int offload_mode = 0;
272 printf(
"Checking for Intel(R) Xeon Phi(TM) (Target CPU) devices...\n\n");
274#ifdef __INTEL_OFFLOAD
275 num_devices = _Offload_number_of_devices();
277 printf(
"Number of Target devices installed: %d\n\n",num_devices);
279 if (flags.
devidx >= num_devices) {
281 printf(
"Requested device index %d is not available. Specify a device between 0 and %d\n\n",
282 flags.
devidx, num_devices-1);
287 target_idx = flags.
devidx;
288 printf(
"PAPI will list the native events available on device mic%d\n\n", target_idx);
295 else if ( flags.
darr )
297 else if ( flags.
iear )
299 else if ( flags.
iarr )
301 else if ( flags.
opcm )
309#ifdef __INTEL_OFFLOAD
312 #pragma offload target(mic: target_idx) if(offload_mode)
316 fprintf(
stderr,
"Error! PAPI_library_init\n");
322#ifdef __INTEL_OFFLOAD
325 #pragma offload target(mic: target_idx) if(offload_mode)
328 fprintf(
stderr,
"Error! PAPI_set_debug\n");
333#ifdef __INTEL_OFFLOAD
336 #pragma offload target(mic: target_idx) if(offload_mode) nocopy(hwinfo)
342 fprintf(
stderr,
"Error! PAPI_get_hardware_info\n");
351 char *ename = flags.
name;
354 elen = strlen(ename) + 1;
355#ifdef __INTEL_OFFLOAD
358 #pragma offload target(mic: target_idx) if(offload_mode) in(ename:length(elen)) out(i)
363#ifdef __INTEL_OFFLOAD
366 #pragma offload target(mic: target_idx) if(offload_mode) out(info)
373 "Event name:", info.
symbol);
374 printf(
"%-29s|%s|\n",
"Description:", info.
long_descr );
377 if ( !strchr( flags.
name,
':' ) )
379#ifdef __INTEL_OFFLOAD
382 #pragma offload target(mic: target_idx) if(offload_mode) inout(i)
386 printf(
"\nUnit Masks:\n" );
389#ifdef __INTEL_OFFLOAD
392 #pragma offload target(mic: target_idx) if(offload_mode) inout(i, info)
396 printf(
"%-29s|%s|%s|\n",
" Mask Info:",
400#ifdef __INTEL_OFFLOAD
403 #pragma offload target(mic: target_idx) if(offload_mode) inout(i, info)
409 printf(
"Sorry, an event by the name '%s' could not be found.\n",
411 printf(
"Is it typed correctly?\n\n");
419#ifdef __INTEL_OFFLOAD
422 #pragma offload target(mic: target_idx) if(offload_mode)
427 for ( cid = 0; cid < numcmp; cid++ ) {
433#ifdef __INTEL_OFFLOAD
436 #pragma offload target(mic: target_idx) if(offload_mode) out(component)
444 printf(
"===============================================================================\n" );
445 printf(
" Native Events in Component: %s\n",component.
name);
446 printf(
"===============================================================================\n" );
452#ifdef __INTEL_OFFLOAD
455 #pragma offload target(mic: target_idx) if(offload_mode) inout(i)
460 memset( &info, 0,
sizeof ( info ) );
461#ifdef __INTEL_OFFLOAD
464 #pragma offload target(mic: target_idx) if(offload_mode) inout(info)
490 if (info.
units[0]) printf(
"| Units: %-67s|\n",
504#ifdef __INTEL_OFFLOAD
507 #pragma offload target(mic: target_idx) if(offload_mode) inout(k)
515#ifdef __INTEL_OFFLOAD
518 #pragma offload target(mic: target_idx) if(offload_mode) inout(k)
532#ifdef __INTEL_OFFLOAD
535 #pragma offload target(mic: target_idx) if(offload_mode) inout(k)
540#ifdef __INTEL_OFFLOAD
543 #pragma offload target(mic: target_idx) if(offload_mode) inout(info)
549#ifdef __INTEL_OFFLOAD
552 #pragma offload target(mic: target_idx) if(offload_mode) inout(k)
557 printf(
"--------------------------------------------------------------------------------\n" );
560#ifdef __INTEL_OFFLOAD
563 #pragma offload target(mic: target_idx) if(offload_mode) inout(i)
569 printf(
"Total events reported: %d\n", j );
Enumerate PAPI preset or native events for a given component.
Enumerate PAPI preset or native events.
Convert a name to a numeric hardware event code.
get information about a specific software component
Get the event's name and description info.
initialize the PAPI library.
Get the number of components available on the system.
Set the current debug level for error output from PAPI.
#define PAPI_NTV_GROUP_AND_MASK
#define PAPI_NTV_ENUM_IEAR
#define PAPI_NTV_ENUM_UMASKS
#define PAPI_NTV_ENUM_OPCM
#define PAPI_NTV_GROUP_SHIFT
#define PAPI_NTV_ENUM_DEAR
#define PAPI_NTV_ENUM_DARR
#define PAPI_NTV_ENUM_IARR
static void print_help(void)
static int no_str_arg(char *arg)
static int parse_unit_masks(PAPI_event_info_t *info)
static void parse_args(int argc, char **argv, command_flags_t *f)
static void print_event(PAPI_event_info_t *info, int offset)
static void space_pad(char *str, int spaces)
char name[PAPI_MAX_STR_LEN]
char units[PAPI_MIN_STR_LEN]
char symbol[PAPI_HUGE_STR_LEN]
char long_descr[PAPI_HUGE_STR_LEN]