Go to the source code of this file.
|
| int | cuptiu_event_table_create (int sizeof_rec, cuptiu_event_table_t **pevt_table) |
| |
| int | cuptiu_event_table_create_init_capacity (int capacity, int sizeof_rec, cuptiu_event_table_t **pevt_table) |
| |
| void | cuptiu_event_table_destroy (cuptiu_event_table_t **pevt_table) |
| |
| int | cuptiu_event_table_insert_record (cuptiu_event_table_t *evt_table, const char *evt_name, unsigned int evt_code, int evt_pos) |
| |
| int | cuptiu_event_table_select_by_idx (cuptiu_event_table_t *src, int count, int *idcs, cuptiu_event_table_t **pevt_names) |
| |
| int | cuptiu_event_table_find_name (cuptiu_event_table_t *evt_table, const char *evt_name, cuptiu_event_t **found_rec) |
| |
| int | cuptiu_event_table_get_item (cuptiu_event_table_t *evt_table, int evt_idx, cuptiu_event_t **record) |
| |
| int | cuptiu_files_search_in_path (const char *file_name, const char *search_path, char **file_paths) |
| |
◆ CUPTIU_MAX_FILES
| #define CUPTIU_MAX_FILES 100 |
◆ cuptiu_event_table_create()
Definition at line 42 of file cupti_utils.c.
43{
45}
#define ADDED_EVENTS_INITIAL_CAPACITY
int cuptiu_event_table_create_init_capacity(int capacity, int sizeof_rec, cuptiu_event_table_t **pevt_table)
◆ cuptiu_event_table_create_init_capacity()
Definition at line 16 of file cupti_utils.c.
17{
19 if (evt_table == NULL) {
20 goto fn_fail;
21 }
26 if (evt_table->
evts == NULL) {
28 ERRDBG(
"Error allocating memory for dynamic event table.\n");
29 goto fn_fail;
30 }
33 goto fn_fail;
34 }
35 *pevt_table = evt_table;
37fn_fail:
38 *pevt_table = NULL;
40}
static int htable_init(void **handle)
void cuptiu_event_table_destroy(cuptiu_event_table_t **pevt_table)
#define ERRDBG(format, args...)
#define papi_calloc(a, b)
◆ cuptiu_event_table_destroy()
Definition at line 159 of file cupti_utils.c.
160{
162 if (evt_table == NULL)
163 return;
164 if (evt_table->
evts) {
166 evt_table->
evts = NULL;
167 }
171 }
173 *pevt_table = NULL;
174}
static int htable_shutdown(void *handle)
◆ cuptiu_event_table_find_name()
Definition at line 147 of file cupti_utils.c.
148{
149 int papi_errno;
153 *found_rec = evt_rec;
155 }
157}
static int htable_find(void *handle, const char *key, void **out)
char * evt_name(evstock *stock, int index)
◆ cuptiu_event_table_get_item()
Definition at line 47 of file cupti_utils.c.
48{
49 if (evt_idx >= (
int) evt_table->
count) {
50 *record = NULL;
52 }
53 if (evt_idx == -1) {
54 evt_idx = evt_table->
count - 1;
55 }
58}
◆ cuptiu_event_table_insert_record()
Definition at line 88 of file cupti_utils.c.
89{
91
92
96 goto fn_exit;
97 }
98 }
99
104
107 }
109fn_exit:
110 return papi_errno;
111}
static int htable_insert(void *handle, const char *key, void *in)
static int reallocate_array(cuptiu_event_table_t *evt_table)
char name[PAPI_2MAX_STR_LEN]
◆ cuptiu_event_table_select_by_idx()
Definition at line 113 of file cupti_utils.c.
114{
116 if (count <= 0 || count > (
int) src->
count) {
118 goto fn_fail;
119 }
123 goto fn_fail;
124 }
131 goto fn_fail;
132 }
136 goto fn_fail;
137 }
138 }
139 *pevt_names = target;
140fn_exit:
141 return papi_errno;
142fn_fail:
143 *pevt_names = NULL;
144 goto fn_exit;
145}
int cuptiu_event_table_get_item(cuptiu_event_table_t *evt_table, int evt_idx, cuptiu_event_t **record)
int cuptiu_event_table_insert_record(cuptiu_event_table_t *evt_table, const char *evt_name, unsigned int evt_code, int evt_pos)
◆ cuptiu_files_search_in_path()
| int cuptiu_files_search_in_path |
( |
const char * |
file_name, |
|
|
const char * |
search_path, |
|
|
char ** |
file_paths |
|
) |
| |
Definition at line 176 of file cupti_utils.c.
177{
178 char path[PATH_MAX];
179 char command[PATH_MAX];
180 snprintf(command, PATH_MAX, "find %s -name %s", search_path, file_name);
181
183 fp = popen(command,
"r");
185 ERRDBG(
"Failed to run system command find using popen.\n");
186 return -1;
187 }
188
190 while (fgets(path, PATH_MAX,
fp) != NULL) {
191 path[strcspn(path, "\n")] = 0;
192 file_paths[
count] = strdup(path);
195 break;
196 }
197 }
198
201 ERRDBG(
"%s not found in path PAPI_CUDA_ROOT.\n", file_name);
202 }
204}