PAPI 7.1.0.0
Loading...
Searching...
No Matches
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 */
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}
int i
add PAPI preset or native hardware event by name to an EventSet
Create a new empty PAPI EventSet.
Empty and destroy an EventSet.
initialize the PAPI library.
removes a named hardware event from a PAPI event set.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
Returns a string describing the PAPI error code.
#define NUM_LOOPS
Definition: destroy.c:17
#define NUM_EVENTS
Definition: destroy.c:16
#define PAPI_VER_CURRENT
Definition: f90papi.h:54
#define PAPI_OK
Definition: f90papi.h:73
#define PAPI_NULL
Definition: f90papi.h:78
static long long values[NUM_EVENTS]
Definition: init_fini.c:10
int tests_quiet(int argc, char **argv)
Definition: test_utils.c:376
void PAPI_NORETURN test_fail(const char *file, int line, const char *call, int retval)
Definition: test_utils.c:491
void PAPI_NORETURN test_pass(const char *filename)
Definition: test_utils.c:432
int quiet
Definition: rapl_overflow.c:19
int EventSet1
Definition: zero_fork.c:47
int retval
Definition: zero_fork.c:53
Here is the call graph for this function: