HPCToolkit
papi-c-extended-info.c
Go to the documentation of this file.
1 #include <stdbool.h>
2 #include <stddef.h>
3 #include "papi-c-extended-info.h"
4 #include <papi.h>
5 
6 #include <messages/messages.h>
7 
9 
10 void
12 {
14  registered_sync_components = info;
15 }
16 
17 void
18 no_action(void)
19 {
20 }
21 
22 void
24 {
25  int ret = PAPI_create_eventset(ev_s);
26  TMSG(PAPI,"PAPI_create_eventset = %d, eventSet = %d", ret, *ev_s);
27  if (ret != PAPI_OK) {
28  hpcrun_abort("Failure: PAPI_create_eventset.Return code = %d ==> %s",
29  ret, PAPI_strerror(ret));
30  }
31 }
32 
33 int
34 std_add_event(int ev_s, int ev)
35 {
36  return PAPI_add_event(ev_s, ev);
37 }
38 
41 {
42  const char* name = PAPI_get_component_info(cidx)->name;
43 
44  TMSG(PAPI, "looking for sync get_event_set for component idx=%d(%s)", cidx, name);
45  for(sync_info_list_t* item=registered_sync_components; item; item = item->next) {
46  if (item->pred(name)) return item->get_event_set;
47  }
48  return std_get_event_set;
49 }
50 
53 {
54  const char* name = PAPI_get_component_info(cidx)->name;
55 
56  TMSG(PAPI, "looking for sync add_event for component idx=%d(%s)", cidx, name);
57  for(sync_info_list_t* item=registered_sync_components; item; item = item->next) {
58  if (item->pred(name)) return item->add_event;
59  }
60  return std_add_event;
61 }
62 
65 {
66  const char* name = PAPI_get_component_info(cidx)->name;
67 
68  TMSG(PAPI, "looking for sync finalize_event_set for component idx=%d(%s)", cidx, name);
69  for(sync_info_list_t* item=registered_sync_components; item; item = item->next) {
70  if (item->pred(name)) return item->finalize_event_set;
71  }
72  return no_action;
73 }
74 
75 bool
77 {
78  const char* name = PAPI_get_component_info(cidx)->name;
79 
80  TMSG(PAPI, "checking component idx %d (name %s) to see if it is synchronous", cidx, name);
81  for(sync_info_list_t* item=registered_sync_components; item; item = item->next) {
82  if (item->pred(name)) {
83  TMSG(PAPI, "Component %s IS a synchronous component", name);
84  return true;
85  }
86  }
87  return false;
88 }
89 
92 {
93  const char* name = PAPI_get_component_info(cidx)->name;
94 
95  TMSG(PAPI, "looking for sync setup for component idx=%d(%s)", cidx, name);
96  for(sync_info_list_t* item=registered_sync_components; item; item = item->next) {
97  if (item->pred(name)) return item->sync_setup;
98  }
99  return no_action;
100 }
101 
104 {
105  const char* name = PAPI_get_component_info(cidx)->name;
106 
107  TMSG(PAPI, "looking for sync teardown for component idx=%d(%s)", cidx, name);
108  for(sync_info_list_t* item=registered_sync_components; item; item = item->next) {
109  if (item->pred(name)) return item->sync_teardown;
110  }
111  return no_action;
112 }
113 
116 {
117  const char* name = PAPI_get_component_info(cidx)->name;
118 
119  TMSG(PAPI, "looking for sync start for component idx=%d(%s)", cidx, name);
120  for(sync_info_list_t* item=registered_sync_components; item; item = item->next) {
121  if (item->pred(name)) return item->sync_start;
122  }
123  return no_action;
124 }
125 
128 {
129  const char* name = PAPI_get_component_info(cidx)->name;
130 
131  TMSG(PAPI, "looking for sync stop for component idx=%d(%s)", cidx, name);
132  for(sync_info_list_t* item=registered_sync_components; item; item = item->next) {
133  if (item->pred(name)) return item->sync_stop;
134  }
135  return no_action;
136 }
stop_proc_t sync_stop_for_component(int cidx)
get_event_set_proc_t component_get_event_set(int cidx)
struct sync_info_list_t * next
add_event_proc_t component_add_event_proc(int cidx)
void(* start_proc_t)(void)
void(* setup_proc_t)(void)
finalize_event_set_proc_t component_finalize_event_set(int cidx)
teardown_proc_t sync_teardown_for_component(int cidx)
#define hpcrun_abort(...)
Definition: messages.h:102
bool component_uses_sync_samples(int cidx)
void papi_c_sync_register(sync_info_list_t *info)
void no_action(void)
int(* add_event_proc_t)(int ev_s, int evcode)
void(* finalize_event_set_proc_t)(void)
void(* stop_proc_t)(void)
void std_get_event_set(int *ev_s)
static sync_info_list_t * registered_sync_components
#define TMSG(f,...)
Definition: messages.h:93
#define NULL
Definition: ElfHelper.cpp:85
void(* get_event_set_proc_t)(int *ev_s)
void(* teardown_proc_t)(void)
int std_add_event(int ev_s, int ev)
setup_proc_t sync_setup_for_component(int cidx)
start_proc_t sync_start_for_component(int cidx)