PAPI 7.1.0.0
Loading...
Searching...
No Matches
papi_decode.c File Reference
Include dependency graph for papi_decode.c:

Go to the source code of this file.

Functions

static void print_help (void)
 
int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 64 of file papi_decode.c.

65{
66 int i, j;
67 int retval;
68 int print_avail_only = 0;
70
71 (void)argc;
72 (void)argv;
73
74 for ( i = 1; i < argc; i++ )
75 if ( argv[i] ) {
76 if ( !strcmp( argv[i], "-a" ) )
77 print_avail_only = PAPI_PRESET_ENUM_AVAIL;
78 else if ( !strcmp( argv[i], "-h" ) ) {
79 print_help( );
80 exit( 1 );
81 } else {
82 print_help( );
83 exit( 1 );
84 }
85 }
86
88 if ( retval != PAPI_VER_CURRENT ) {
89 fprintf(stderr,"Error with PAPI_library_init!\n");
90 return retval;
91 }
92
94 if ( retval != PAPI_OK ) {
95 fprintf(stderr,"Error with PAPI_set_debug\n");
96 return retval;
97 }
98
100 printf
101 ( "name,derived,postfix,short_descr,long_descr,note,[native,...]\n\n" );
102
103 do {
104 if ( PAPI_get_event_info( i, &info ) == PAPI_OK ) {
105 printf( "%s,%s,%s,", info.symbol, info.derived, info.postfix );
106 if ( info.short_descr[0] ) {
107 printf( "\"%s\",", info.short_descr );
108 } else {
109 printf( "," );
110 }
111 if ( info.long_descr[0] ) {
112 printf( "\"%s\",", info.long_descr );
113 } else {
114 printf( "," );
115 }
116 if ( info.note[0] )
117 printf( "\"%s\"", info.note );
118
119 for ( j = 0; j < ( int ) info.count; j++ )
120 printf( ",%s", info.name[j] );
121 printf( "\n" );
122 }
123 } while ( PAPI_enum_event( &i, print_avail_only ) == PAPI_OK );
124
125 return 0;
126}
int i
Enumerate PAPI preset or native events.
Get the event's name and description info.
initialize the PAPI library.
Set the current debug level for error output from PAPI.
#define PAPI_VER_CURRENT
Definition: f90papi.h:54
#define PAPI_OK
Definition: f90papi.h:73
#define PAPI_VERB_ECONT
Definition: f90papi.h:164
#define PAPI_PRESET_MASK
@ PAPI_PRESET_ENUM_AVAIL
Definition: papi.h:490
static void print_help(void)
Definition: papi_decode.c:47
FILE * stderr
int
Definition: sde_internal.h:89
char name[PAPI_MAX_INFO_TERMS][PAPI_2MAX_STR_LEN]
Definition: papi.h:1003
unsigned int count
Definition: papi.h:981
char postfix[PAPI_2MAX_STR_LEN]
Definition: papi.h:992
char note[PAPI_HUGE_STR_LEN]
Definition: papi.h:1007
char short_descr[PAPI_MIN_STR_LEN]
Definition: papi.h:961
char symbol[PAPI_HUGE_STR_LEN]
Definition: papi.h:960
char derived[PAPI_MIN_STR_LEN]
Definition: papi.h:989
char long_descr[PAPI_HUGE_STR_LEN]
Definition: papi.h:963
int retval
Definition: zero_fork.c:53
Here is the call graph for this function:

◆ print_help()

static void print_help ( void  )
static

Definition at line 47 of file papi_decode.c.

48{
49 printf( "This is the PAPI decode utility program.\n" );
50 printf( "It decodes PAPI preset events into csv formatted text.\n" );
51 printf( "By default all presets are decoded.\n" );
52 printf( "The text goes to stdout, but can be piped to a file.\n" );
53 printf( "Such a file can be edited in a text editor or spreadsheet.\n" );
54 printf( "It can also be parsed by PAPI_encode_events.\n" );
55 printf( "Usage:\n\n" );
56 printf( " decode [options]\n\n" );
57 printf( "Options:\n\n" );
58 printf( " -a decode only available PAPI preset events\n" );
59 printf( " -h print this help message\n" );
60 printf( "\n" );
61}
Here is the caller graph for this function: