PAPI 7.1.0.0
Loading...
Searching...
No Matches
PAPI_state.c File Reference
Include dependency graph for PAPI_state.c:

Go to the source code of this file.

Macros

#define ERROR_RETURN(retval)   { fprintf(stderr, "Error %d %s:line %d: \n", retval,__FILE__,__LINE__); exit(retval); }
 

Functions

int main ()
 
int printstate (int status)
 

Macro Definition Documentation

◆ ERROR_RETURN

#define ERROR_RETURN (   retval)    { fprintf(stderr, "Error %d %s:line %d: \n", retval,__FILE__,__LINE__); exit(retval); }

Definition at line 12 of file PAPI_state.c.

Function Documentation

◆ main()

int main ( )

Definition at line 15 of file PAPI_state.c.

16{
17
18 int retval;
19 int status = 0;
20 int EventSet = PAPI_NULL;
21
22 /****************************************************************************
23 * This part initializes the library and compares the version number of the *
24 * header file, to the version of the library, if these don't match then it *
25 * is likely that PAPI won't work correctly.If there is an error, retval *
26 * keeps track of the version number. *
27 ****************************************************************************/
28
30 {
31 printf("Library initialization error! \n");
32 exit(-1);
33 }
34
35 /*Creating the Eventset */
38
39 /* Add Total Instructions Executed to our EventSet */
42
43 if ((retval=PAPI_state(EventSet, &status)) != PAPI_OK)
45
46 printstate(status);
47
48 /* Start counting */
51
52 if (PAPI_state(EventSet, &status) != PAPI_OK)
54
55 printstate(status);
56
57 /* free the resources used by PAPI */
59
60 exit(0);
61}
#define ERROR_RETURN(retval)
Definition: PAPI_state.c:12
int printstate(int status)
Definition: PAPI_state.c:63
add PAPI preset or native hardware event to an event set
Create a new empty PAPI EventSet.
initialize the PAPI library.
Finish using PAPI and free all related resources.
Start counting hardware events in an event set.
Return the counting state of an EventSet.
#define PAPI_VER_CURRENT
Definition: f90papi.h:54
#define PAPI_OK
Definition: f90papi.h:73
#define PAPI_NULL
Definition: f90papi.h:78
#define PAPI_TOT_INS
Definition: f90papi.h:317
static int EventSet
Definition: init_fini.c:8
int retval
Definition: zero_fork.c:53
Here is the call graph for this function:

◆ printstate()

int printstate ( int  status)

Definition at line 63 of file PAPI_state.c.

64{
65 if(status & PAPI_STOPPED)
66 printf("Eventset is currently stopped or inactive \n");
67 if(status & PAPI_RUNNING)
68 printf("Eventset is currently running \n");
69 if(status & PAPI_PAUSED)
70 printf("Eventset is currently Paused \n");
71 if(status & PAPI_NOT_INIT)
72 printf(" Eventset defined but not initialized \n");
73 if(status & PAPI_OVERFLOWING)
74 printf(" Eventset has overflowing enabled \n");
75 if(status & PAPI_PROFILING)
76 printf(" Eventset has profiling enabled \n");
77 if(status & PAPI_MULTIPLEXING)
78 printf(" Eventset has multiplexing enabled \n");
79 return 0;
80}
#define PAPI_PROFILING
Definition: f90papi.h:150
#define PAPI_PAUSED
Definition: f90papi.h:25
#define PAPI_MULTIPLEXING
Definition: f90papi.h:148
#define PAPI_RUNNING
Definition: f90papi.h:165
#define PAPI_NOT_INIT
Definition: f90papi.h:82
#define PAPI_OVERFLOWING
Definition: f90papi.h:240
#define PAPI_STOPPED
Definition: f90papi.h:158
Here is the caller graph for this function: