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

Go to the source code of this file.

Macros

#define MY_EPSILON   0.0001
 
#define BRNG()
 

Functions

void cclib_init (void)
 
void cclib_do_work (void)
 
void cclib_do_more_work (void)
 
papi_handle_t papi_sde_hook_list_events (papi_sde_fptr_struct_t *fptr_struct)
 

Variables

volatile int result
 
volatile unsigned int b
 
volatile unsigned int z1
 
volatile unsigned int z2
 
volatile unsigned int z3
 
volatile unsigned int z4
 
static const char * event_names [1]
 
void * cntr_handle
 

Macro Definition Documentation

◆ BRNG

#define BRNG ( )
Value:
{\
b = ((z1 << 6) ^ z1) >> 13;\
z1 = ((z1 & 4294967294U) << 18) ^ b;\
b = ((z2 << 2) ^ z2) >> 27;\
z2 = ((z2 & 4294967288U) << 2) ^ b;\
b = ((z3 << 13) ^ z3) >> 21;\
z3 = ((z3 & 4294967280U) << 7) ^ b;\
b = ((z4 << 3) ^ z4) >> 12;\
z4 = ((z4 & 4294967168U) << 13) ^ b;\
z1++;\
result = z1 ^ z2 ^ z3 ^ z4;\
}
volatile int result
volatile unsigned int z1
volatile unsigned int b
volatile unsigned int z2
volatile unsigned int z3
volatile unsigned int z4

Definition at line 9 of file Lib_With_Created_Counter.c.

◆ MY_EPSILON

#define MY_EPSILON   0.0001

Definition at line 7 of file Lib_With_Created_Counter.c.

Function Documentation

◆ cclib_do_more_work()

void cclib_do_more_work ( void  )

Definition at line 66 of file Lib_With_Created_Counter.c.

66 {
67 int i;
68
69 for(i=0; i<500*1000; i++){
70 BRNG();
71 double r = (1.0*result)/(1.0*INT_MAX);
72 if( r < MY_EPSILON && r > -MY_EPSILON ){
74 }
75 // Do some usefull work here
76 if( !(i%20) )
77 (void)usleep(1);
78 }
79
80 return;
81}
#define MY_EPSILON
void * cntr_handle
#define BRNG()
int i
int papi_sde_inc_counter(papi_handle_t cntr_handle, long long int increment)
Definition: sde_lib.c:637
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cclib_do_work()

void cclib_do_work ( void  )

Definition at line 49 of file Lib_With_Created_Counter.c.

49 {
50 int i;
51
52 for(i=0; i<100*1000; i++){
53 BRNG();
54 double r = (1.0*result)/(1.0*INT_MAX);
55 if( r < MY_EPSILON && r > -MY_EPSILON ){
57 }
58 // Do some usefull work here
59 if( !(i%100) )
60 (void)usleep(1);
61 }
62
63 return;
64}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cclib_init()

void cclib_init ( void  )

Definition at line 35 of file Lib_With_Created_Counter.c.

35 {
36 papi_handle_t sde_handle;
37
38 sde_handle = papi_sde_init("Lib_With_CC");
40
41 z1=42;
42 z2=420;
43 z3=42000;
44 z4=424242;
45
46 return;
47}
static const char * event_names[1]
papi_handle_t papi_sde_init(const char *name_of_library)
Definition: sde_lib.c:119
int papi_sde_create_counter(papi_handle_t handle, const char *event_name, int cntr_mode, void **cntr_handle)
Definition: sde_lib.c:576
void * papi_handle_t
Definition: sde_lib.h:100
#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:

◆ papi_sde_hook_list_events()

papi_handle_t papi_sde_hook_list_events ( papi_sde_fptr_struct_t fptr_struct)

Definition at line 86 of file Lib_With_Created_Counter.c.

86 {
87 papi_handle_t sde_handle;
88 sde_handle = fptr_struct->init("Lib_With_CC");
89 fptr_struct->create_counter(sde_handle, event_names[0], PAPI_SDE_DELTA, &cntr_handle);
90 fptr_struct->describe_counter(sde_handle, event_names[0], "Number of times the random value was less than 0.0001");
91 return sde_handle;
92}
int(* describe_counter)(papi_handle_t handle, const char *event_name, const char *event_description)
Definition: sde_lib.h:108
papi_handle_t(* init)(const char *lib_name)
Definition: sde_lib.h:103
int(* create_counter)(papi_handle_t handle, const char *event_name, int cntr_type, void **cntr_handle)
Definition: sde_lib.h:110

Variable Documentation

◆ b

volatile unsigned int b

Definition at line 22 of file Lib_With_Created_Counter.c.

◆ cntr_handle

void* cntr_handle

Definition at line 28 of file Lib_With_Created_Counter.c.

◆ event_names

const char* event_names[1]
static
Initial value:
= {
"epsilon_count"
}

Definition at line 24 of file Lib_With_Created_Counter.c.

◆ result

volatile int result

Definition at line 21 of file Lib_With_Created_Counter.c.

◆ z1

volatile unsigned int z1

Definition at line 22 of file Lib_With_Created_Counter.c.

◆ z2

volatile unsigned int z2

Definition at line 22 of file Lib_With_Created_Counter.c.

◆ z3

volatile unsigned int z3

Definition at line 22 of file Lib_With_Created_Counter.c.

◆ z4

volatile unsigned int z4

Definition at line 22 of file Lib_With_Created_Counter.c.