PAPI  5.7.0.0
broken_events.c File Reference
Include dependency graph for broken_events.c:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 14 of file broken_events.c.

14  {
15 
16  int retval;
17 
18  int EventSet = PAPI_NULL;
19  int quiet=0;
20  char user_event[4096];
21  long long values[1];
22 
23  /* Set TESTS_QUIET variable */
24  quiet=tests_quiet( argc, argv );
25 
26  /* Init the PAPI library */
28  if ( retval != PAPI_VER_CURRENT ) {
29  test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
30  }
31 
32  if (get_invalid_event_name(user_event,4096)==NULL) {
33  if (!quiet) {
34  printf("No sample invalid event defined for this architecture\n");
35  }
36  test_skip( __FILE__, __LINE__, "No event", 0);
37  }
38 
40  if (retval != PAPI_OK) {
41  test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
42  }
43 
44  retval = PAPI_add_named_event(EventSet, user_event);
45  if (retval != PAPI_OK) {
46  if ( !quiet ) {
47  fprintf(stderr,"Correctly failed adding invalid event %s %s\n",user_event,PAPI_strerror(retval));
48  }
49  test_pass(__FILE__);
50 
51  }
52 
54 
56 
57  if (!quiet) {
58  printf("Read result: %lld\n",values[0]);
59  }
60 
61  test_fail( __FILE__, __LINE__,"Added comma separated event somehow",0);
62 
63  return 0;
64 }
#define PAPI_OK
Definition: fpapi.h:105
int PAPI_stop(int EventSet, long long *values)
Definition: papi.c:2314
void test_pass(const char *filename)
Definition: test_utils.c:432
#define PAPI_VER_CURRENT
Definition: fpapi.h:14
int EventSet
int retval
Definition: zero_fork.c:53
void test_skip(const char *file, int line, const char *call, int retval)
Definition: test_utils.c:561
int PAPI_add_named_event(int EventSet, const char *EventName)
Definition: papi.c:1876
int PAPI_library_init(int version)
Definition: papi.c:500
int quiet
Definition: rapl_overflow.c:18
#define PAPI_NULL
Definition: fpapi.h:13
int PAPI_create_eventset(int *EventSet)
Definition: papi.c:1464
char * PAPI_strerror(int errorCode)
Definition: papi.c:4603
int tests_quiet(int argc, char **argv)
Definition: test_utils.c:376
void test_fail(const char *file, int line, const char *call, int retval)
Definition: test_utils.c:468
int PAPI_start(int EventSet)
Definition: papi.c:2096
static long long values[NUM_EVENTS]
Definition: init_fini.c:10
char * get_invalid_event_name(char *event, int size)
Here is the call graph for this function: