PAPI 7.1.0.0
Loading...
Searching...
No Matches
Gamum.c
Go to the documentation of this file.
1#include <stdio.h>
2#include <stdint.h>
3#include <stdlib.h>
4#include "sde_lib.h"
5
6// API functions (FORTRAN 77 friendly).
8void gamum_init_(void);
9void gamum_unreg_(void);
10void gamum_do_work_(void);
11
12// The following counter is a global variable that can be directly
13// modified by programs linking with this library.
14long long int gamum_cnt_i1;
15
16// The following counters are hidden to programs linking with
17// this library, so they can not be directly modified.
18static double cnt_d1, cnt_d2, cnt_d3, cnt_d4, cnt_d5;
19static long long int cnt_i2, cnt_i3;
20static double cnt_rm1, cnt_rm2;
22static void *cntr_handle;
23
24// For internal use only.
26
27static const char *event_names[2] = {
28 "event_with_characters____ __up______to_______60_bytes",
29 "event_with_very_long_name_which_is_meant_to_exceed_128_bytes_or_in_other_words_the_size_of_two_cache_lines_so_we_see_if_it_makes_a_difference_in_performance"
30};
31
32
33void gamum_init_(void){
34 cnt_d1 = cnt_d2 = cnt_d3 = cnt_d4 = cnt_d5 = 1;
35 gamum_cnt_i1 = cnt_i2 = 0;
36 papi_sde_fptr_struct_t fptr_struct;
37
38 POPULATE_SDE_FPTR_STRUCT( fptr_struct );
39 (void)gamum_papi_sde_hook_list_events(&fptr_struct);
40
41 return;
42}
43
45 return gamum_papi_sde_hook_list_events(fptr_struct);
46}
47
49 handle = fptr_struct->init("Gamum");
52 fptr_struct->add_counter_to_group(handle, "ev1", "group0", PAPI_SDE_SUM);
56 fptr_struct->add_counter_to_group(handle, "ev4", "group0", PAPI_SDE_SUM);
61
62 fptr_struct->create_counter(handle, "papi_counter", PAPI_SDE_RO|PAPI_SDE_INSTANT, &cntr_handle );
63
65
66 return handle;
67}
68
69void gamum_unreg_(void){
72}
73
74void gamum_do_work_(void){
75 cnt_d1 += 0.1;
76 cnt_d2 += 0.111;
77 cnt_d3 += 0.2;
78 cnt_d4 += 0.222;
79 cnt_d5 += 0.3;
80 gamum_cnt_i1 += 6;
81 cnt_i2 += 101;
82 cnt_i3 += 33;
85}
static long long int cnt_i3
Definition: Gamum.c:19
static papi_handle_t gamum_papi_sde_hook_list_events(papi_sde_fptr_struct_t *fptr_struct)
Definition: Gamum.c:48
static void * cntr_handle
Definition: Gamum.c:22
void gamum_init_(void)
Definition: Gamum.c:33
static double cnt_d1
Definition: Gamum.c:18
papi_handle_t papi_sde_hook_list_events(papi_sde_fptr_struct_t *fptr_struct)
Definition: Gamum.c:44
static double cnt_d5
Definition: Gamum.c:18
void gamum_do_work_(void)
Definition: Gamum.c:74
static double cnt_rm2
Definition: Gamum.c:20
static double cnt_rm1
Definition: Gamum.c:20
static long long int cnt_i2
Definition: Gamum.c:19
static const char * event_names[2]
Definition: Gamum.c:27
static double cnt_d3
Definition: Gamum.c:18
static double cnt_d4
Definition: Gamum.c:18
static papi_handle_t handle
Definition: Gamum.c:21
void gamum_unreg_(void)
Definition: Gamum.c:69
long long int gamum_cnt_i1
Definition: Gamum.c:14
static double cnt_d2
Definition: Gamum.c:18
int papi_sde_unregister_counter(papi_handle_t handle, const char *event_name)
Definition: sde_lib.c:342
void * papi_sde_get_counter_handle(void *handle, const char *event_name)
Definition: sde_lib.c:1016
int papi_sde_inc_counter(papi_handle_t cntr_handle, long long int increment)
Definition: sde_lib.c:637
SDE prototypes and macros.
#define PAPI_SDE_double
Definition: sde_lib.h:30
#define POPULATE_SDE_FPTR_STRUCT(_A_)
Definition: sde_lib.h:148
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_INSTANT
Definition: sde_lib.h:26
#define PAPI_SDE_SUM
Definition: sde_lib.h:33
#define PAPI_SDE_DELTA
Definition: sde_lib.h:25
papi_handle_t(* init)(const char *lib_name)
Definition: sde_lib.h:103
int(* register_counter)(papi_handle_t handle, const char *event_name, int mode, int type, void *counter)
Definition: sde_lib.h:105
int(* create_counter)(papi_handle_t handle, const char *event_name, int cntr_type, void **cntr_handle)
Definition: sde_lib.h:110
int(* add_counter_to_group)(papi_handle_t handle, const char *event_name, const char *group_name, uint32_t group_flags)
Definition: sde_lib.h:109