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

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Variables

int TESTS_QUIET
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 22 of file describe.c.

23 {
24  int EventSet = PAPI_NULL;
25  int retval;
26  long long g1[2];
27  int eventcode = PAPI_TOT_INS;
28  char eventname[PAPI_MAX_STR_LEN];
29  PAPI_event_info_t info, info1, info2;
30 
31  tests_quiet( argc, argv ); /* Set TESTS_QUIET variable */
32 
33  if ( ( retval =
35  test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
36 
37 
38  if ( ( retval = PAPI_create_eventset( &EventSet ) ) != PAPI_OK )
39  test_fail( __FILE__, __LINE__, "PAPI_create_eventset", retval );
40 
41  if ( ( retval = PAPI_query_event( eventcode ) ) != PAPI_OK )
42  test_fail( __FILE__, __LINE__, "PAPI_query_event(PAPI_TOT_INS)",
43  retval );
44 
45  if ( ( retval = PAPI_add_event( EventSet, eventcode ) ) != PAPI_OK )
46  test_fail( __FILE__, __LINE__, "PAPI_add_event(PAPI_TOT_INS)", retval );
47 
48  if ( ( retval = PAPI_start( EventSet ) ) != PAPI_OK )
49  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
50 
51  if ( ( retval = PAPI_stop( EventSet, g1 ) ) != PAPI_OK )
52  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
53 
54  /* Case 0, no info, should fail */
55  eventname[0] = '\0';
56  eventcode = 0;
57 /*
58  if ( ( retval = PAPI_describe_event(eventname,(int *)&eventcode,eventdesc) ) == PAPI_OK)
59  test_fail(__FILE__,__LINE__,"PAPI_describe_event",retval);
60 */
61  if ( ( retval = PAPI_get_event_info( eventcode, &info ) ) == PAPI_OK )
62  test_fail( __FILE__, __LINE__, "PAPI_get_event_info", retval );
63 
64  /* Case 1, fill in name field. */
65  eventcode = PAPI_TOT_INS;
66  eventname[0] = '\0';
67 /*
68  if ( ( retval = PAPI_describe_event(eventname,(int *)&eventcode,eventdesc) ) != PAPI_OK)
69  test_fail(__FILE__,__LINE__,"PAPI_describe_event",retval);
70 */
71  if ( ( retval = PAPI_get_event_info( eventcode, &info1 ) ) != PAPI_OK )
72  test_fail( __FILE__, __LINE__, "PAPI_get_event_info", retval );
73 
74  if ( strcmp( info1.symbol, "PAPI_TOT_INS" ) != 0 )
75  test_fail( __FILE__, __LINE__,
76  "PAPI_get_event_info symbol value is bogus", retval );
77  if ( strlen( info1.long_descr ) == 0 )
78  test_fail( __FILE__, __LINE__,
79  "PAPI_get_event_info long_descr value is bogus", retval );
80 
81  eventcode = 0;
82 
83  /* Case 2, fill in code field. */
84 /*
85  if ( ( retval = PAPI_describe_event(eventname,(int *)&eventcode,eventdesc) ) != PAPI_OK)
86  test_fail(__FILE__,__LINE__,"PAPI_describe_event",retval);
87 */
88  strcpy( eventname, info1.symbol );
89  if ( ( retval =
90  PAPI_event_name_to_code( eventname,
91  ( int * ) &eventcode ) ) != PAPI_OK )
92  test_fail( __FILE__, __LINE__, "PAPI_event_name_to_code", retval );
93 
94  if ( eventcode != PAPI_TOT_INS )
95  test_fail( __FILE__, __LINE__,
96  "PAPI_event_name_to_code code value is bogus", retval );
97 
98  if ( ( retval = PAPI_get_event_info( eventcode, &info2 ) ) != PAPI_OK )
99  test_fail( __FILE__, __LINE__, "PAPI_get_event_info", retval );
100 
101  if ( strcmp( info2.symbol, "PAPI_TOT_INS" ) != 0 )
102  test_fail( __FILE__, __LINE__,
103  "PAPI_get_event_info symbol value is bogus", retval );
104  if ( strlen( info2.long_descr ) == 0 )
105  test_fail( __FILE__, __LINE__,
106  "PAPI_get_event_info long_descr value is bogus", retval );
107 
108  test_pass( __FILE__, NULL, 0 );
109  exit( 1 );
110 }
int PAPI_stop(int EventSet, long long *values)
Definition: papi.c:2225
int PAPI_add_event(int EventSet, int EventCode)
Definition: papi.c:1597
#define PAPI_NULL
Definition: fpapi.h:13
#define PAPI_MAX_STR_LEN
Definition: fpapi.h:43
#define PAPI_TOT_INS
Definition: fpapi.h:185
char long_descr[PAPI_HUGE_STR_LEN]
Definition: papi.h:964
char symbol[PAPI_HUGE_STR_LEN]
Definition: papi.h:961
return PAPI_OK
Definition: linux-nvml.c:458
tests_quiet(argc, argv)
test_pass(__FILE__, NULL, 0)
int int argc
Definition: iozone.c:1609
int PAPI_get_event_info(int EventCode, PAPI_event_info_t *info)
Definition: papi.c:841
char ** argv
Definition: iozone.c:1610
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
int PAPI_create_eventset(int *EventSet)
Definition: papi.c:1399
strcpy(filename, default_filename)
int PAPI_event_name_to_code(char *in, int *out)
Definition: papi.c:1003
int PAPI_query_event(int EventCode)
Definition: papi.c:695
int EventSet
int PAPI_start(int EventSet)
Definition: papi.c:2019
ssize_t retval
Definition: libasync.c:338
void exit()

Here is the call graph for this function:

Variable Documentation

int TESTS_QUIET

Definition at line 11 of file test_utils.c.