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

Go to the source code of this file.

Functions

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

Variables

int TESTS_QUIET
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 61 of file decode.c.

62 {
63  int i, j;
64  int retval;
65  int print_avail_only = 0;
66  PAPI_event_info_t info;
67 
68  tests_quiet( argc, argv ); /* Set TESTS_QUIET variable */
69  for ( i = 1; i < argc; i++ )
70  if ( argv[i] ) {
71  if ( !strcmp( argv[i], "-a" ) )
72  print_avail_only = PAPI_PRESET_ENUM_AVAIL;
73  else if ( !strcmp( argv[i], "-h" ) ) {
74  print_help( );
75  exit( 1 );
76  } else {
77  print_help( );
78  exit( 1 );
79  }
80  }
81 
83  if ( retval != PAPI_VER_CURRENT )
84  test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
85 
86  if ( !TESTS_QUIET ) {
87  retval = PAPI_set_debug( PAPI_VERB_ECONT );
88  if ( retval != PAPI_OK )
89  test_fail( __FILE__, __LINE__, "PAPI_set_debug", retval );
90  }
91 
92  i = PAPI_PRESET_MASK;
93  printf
94  ( "name,derived,postfix,short_descr,long_descr,note,[native,...]\n\n" );
95 
96  do {
97  if ( PAPI_get_event_info( i, &info ) == PAPI_OK ) {
98  printf( "%s,%s,%s,", info.symbol, info.derived, info.postfix );
99  if ( info.short_descr[0] ) {
100  printf( "\"%s\",", info.short_descr );
101  } else {
102  printf( "," );
103  }
104  if ( info.long_descr[0] ) {
105  printf( "\"%s\",", info.long_descr );
106  } else {
107  printf( "," );
108  }
109  if ( info.note[0] )
110  printf( "\"%s\"", info.note );
111 
112  for ( j = 0; j < ( int ) info.count; j++ )
113  printf( ",%s", info.name[j] );
114  printf( "\n" );
115  }
116  } while ( PAPI_enum_event( &i, print_avail_only ) == PAPI_OK );
117  exit( 1 );
118 }
unsigned int count
Definition: papi.h:982
char long_descr[PAPI_HUGE_STR_LEN]
Definition: papi.h:964
int PAPI_enum_event(int *EventCode, int modifier)
Definition: papi.c:1143
#define PAPI_VERB_ECONT
Definition: fpapi.h:39
char symbol[PAPI_HUGE_STR_LEN]
Definition: papi.h:961
static void print_help(void)
Definition: decode.c:44
return PAPI_OK
Definition: linux-nvml.c:458
tests_quiet(argc, argv)
#define PAPI_PRESET_MASK
char note[PAPI_HUGE_STR_LEN]
Definition: papi.h:1008
#define printf
Definition: papi_test.h:125
int int argc
Definition: iozone.c:1609
int PAPI_get_event_info(int EventCode, PAPI_event_info_t *info)
Definition: papi.c:841
int TESTS_QUIET
Definition: test_utils.c:11
char ** argv
Definition: iozone.c:1610
test_fail(__FILE__, __LINE__,"PAPI_library_init", retval)
int PAPI_library_init(int version)
Definition: papi.c:495
int i
Definition: fileop.c:140
char short_descr[PAPI_MIN_STR_LEN]
Definition: papi.h:962
#define PAPI_VER_CURRENT
Definition: fpapi.h:14
int
Definition: iozone.c:18528
long j
Definition: iozone.c:19135
char derived[PAPI_MIN_STR_LEN]
Definition: papi.h:990
ssize_t retval
Definition: libasync.c:338
char postfix[PAPI_2MAX_STR_LEN]
Definition: papi.h:993
void exit()
int PAPI_set_debug(int level)
Definition: papi.c:3027
char name[PAPI_MAX_INFO_TERMS][PAPI_2MAX_STR_LEN]
Definition: papi.h:1004

Here is the call graph for this function:

static void print_help ( void  )
static

Definition at line 44 of file decode.c.

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

Here is the caller graph for this function:

Variable Documentation

int TESTS_QUIET

Definition at line 11 of file test_utils.c.