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

Go to the source code of this file.

Functions

void mintest_init (void)
 
void mintest_dowork (void)
 
int main (int argc, char **argv)
 

Variables

long long local_var
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 20 of file Minimal_Test.c.

20 {
21 int ret, Eventset = PAPI_NULL;
22 long long counter_values[1];
23
24 (void)argc;
25 (void)argv;
26
28
29 // --- Setup PAPI
31 test_fail( __FILE__, __LINE__, "PAPI_library_init", ret );
32 exit(-1);
33 }
34
35 if((ret=PAPI_create_eventset(&Eventset)) != PAPI_OK){
36 test_fail( __FILE__, __LINE__, "PAPI_create_eventset", ret );
37 exit(-1);
38 }
39
40 if((ret=PAPI_add_named_event(Eventset, "sde:::Min Example Code::Example Event")) != PAPI_OK){
41 test_fail( __FILE__, __LINE__, "PAPI_add_named_event", ret );
42 exit(-1);
43 }
44
45 // --- Start PAPI
46 if((ret=PAPI_start(Eventset)) != PAPI_OK){
47 test_fail( __FILE__, __LINE__, "PAPI_start", ret );
48 exit(-1);
49 }
50
52
53 // --- Stop PAPI
54 if((ret=PAPI_stop(Eventset, counter_values)) != PAPI_OK){
55 test_fail( __FILE__, __LINE__, "PAPI_stop", ret );
56 exit(-1);
57 }
58
59 if( counter_values[0] == 7 ){
60 test_pass(__FILE__);
61 }else{
62 test_fail( __FILE__, __LINE__, "SDE counter values are wrong!", ret );
63 }
64
65 return 0;
66}
void mintest_dowork(void)
Definition: Minimal_Test.c:16
void mintest_init(void)
Definition: Minimal_Test.c:10
add PAPI preset or native hardware event by name to an EventSet
Create a new empty PAPI EventSet.
initialize the PAPI library.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
#define PAPI_VER_CURRENT
Definition: f90papi.h:54
#define PAPI_OK
Definition: f90papi.h:73
#define PAPI_NULL
Definition: f90papi.h:78
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
Here is the call graph for this function:

◆ mintest_dowork()

void mintest_dowork ( void  )

Definition at line 16 of file Minimal_Test.c.

16 {
17 local_var += 7;
18}
long long local_var
Definition: Minimal_Test.c:8
Here is the caller graph for this function:

◆ mintest_init()

void mintest_init ( void  )

Definition at line 10 of file Minimal_Test.c.

10 {
11 local_var =0;
12 papi_handle_t handle = papi_sde_init("Min Example Code");
14}
static papi_handle_t handle
Definition: Gamum.c:21
papi_handle_t papi_sde_init(const char *name_of_library)
Definition: sde_lib.c:119
int papi_sde_register_counter(papi_handle_t handle, const char *event_name, int cntr_mode, int cntr_type, void *counter)
Definition: sde_lib.c:276
void * papi_handle_t
Definition: sde_lib.h:100
#define PAPI_SDE_long_long
Definition: sde_lib.h:28
#define PAPI_SDE_RO
Definition: sde_lib.h:23
#define PAPI_SDE_DELTA
Definition: sde_lib.h:25
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ local_var

long long local_var

Definition at line 8 of file Minimal_Test.c.