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

Go to the source code of this file.

Macros

#define NUM_EVENTS   1
 
#define NUM_LOOPS   16384
 

Functions

int main (int argc, char **argv)
 

Macro Definition Documentation

◆ NUM_EVENTS

#define NUM_EVENTS   1

Definition at line 16 of file destroy.c.

◆ NUM_LOOPS

#define NUM_LOOPS   16384

Definition at line 17 of file destroy.c.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 19 of file destroy.c.

19  {
20 
21  int retval, i;
22  int EventSet1 = PAPI_NULL;
23  long long values[NUM_EVENTS];
24  int quiet=0;
25 
26  /* Set TESTS_QUIET variable */
27  quiet=tests_quiet( argc, argv );
28 
29  /* Init the PAPI library */
31  if ( retval != PAPI_VER_CURRENT ) {
32  test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
33  }
34 
35  if (!quiet) {
36  printf("Testing to make sure we can destroy eventsets\n");
37  }
38 
39  for(i=0;i<NUM_LOOPS;i++) {
40 
41  /* Initialize the EventSet */
43  if (retval!=PAPI_OK) {
44  test_fail( __FILE__, __LINE__,
45  "PAPI_create_eventset", retval );
46  }
47 
48  /* Add PAPI_TOT_CYC */
49  retval=PAPI_add_named_event(EventSet1,"PAPI_TOT_CYC");
50  if (retval!=PAPI_OK) {
51  if (!quiet) {
52  printf("Trouble adding PAPI_TOT_CYC: %s\n",
54  }
55  test_fail( __FILE__, __LINE__,
56  "adding PAPI_TOT_CYC", retval );
57  }
58 
59  /* Start PAPI */
61  if ( retval != PAPI_OK ) {
62  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
63  }
64 
65  /* Stop PAPI */
67  if ( retval != PAPI_OK ) {
68  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
69  }
70 
71  /* Shutdown the EventSet */
72  retval = PAPI_remove_named_event( EventSet1, "PAPI_TOT_CYC" );
73  if (retval!=PAPI_OK) {
74  test_fail( __FILE__, __LINE__,
75  "PAPI_remove_named_event", retval );
76  }
77 
79  if (retval!=PAPI_OK) {
80  test_fail( __FILE__, __LINE__,
81  "PAPI_destroy_eventset", retval );
82  }
83 
84  }
85 
86  test_pass( __FILE__ );
87 
88  return 0;
89 }
#define PAPI_OK
Definition: fpapi.h:105
int PAPI_stop(int EventSet, long long *values)
Definition: papi.c:2314
#define NUM_EVENTS
Definition: destroy.c:16
void test_pass(const char *filename)
Definition: test_utils.c:432
#define PAPI_VER_CURRENT
Definition: fpapi.h:14
int retval
Definition: zero_fork.c:53
#define NUM_LOOPS
Definition: destroy.c:17
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_destroy_eventset(int *EventSet)
Definition: papi.c:2014
int PAPI_remove_named_event(int EventSet, const char *EventName)
Definition: papi.c:1961
int PAPI_start(int EventSet)
Definition: papi.c:2096
static long long values[NUM_EVENTS]
Definition: init_fini.c:10
int EventSet1
Definition: zero_fork.c:47
int i
Definition: fileop.c:140
Here is the call graph for this function: