14#define ADDED_EVENTS_INITIAL_CAPACITY 64
19 if (evt_table == NULL) {
26 if (evt_table->
evts == NULL) {
28 ERRDBG(
"Error allocating memory for dynamic event table.\n");
35 *pevt_table = evt_table;
49 if (evt_idx >= (
int) evt_table->
count) {
54 evt_idx = evt_table->
count - 1;
65 if (evt_table == NULL) {
66 ERRDBG(
"Failed to expand event_table array.\n");
116 if (count <= 0 || count > (
int) src->
count) {
139 *pevt_names = target;
153 *found_rec = evt_rec;
162 if (evt_table == NULL)
164 if (evt_table->
evts) {
166 evt_table->
evts = NULL;
179 char command[PATH_MAX];
180 snprintf(command, PATH_MAX,
"find %s -name %s", search_path, file_name);
183 fp = popen(command,
"r");
185 ERRDBG(
"Failed to run system command find using popen.\n");
190 while (fgets(path, PATH_MAX,
fp) != NULL) {
191 path[strcspn(path,
"\n")] = 0;
192 file_paths[
count] = strdup(path);
201 ERRDBG(
"%s not found in path PAPI_CUDA_ROOT.\n", file_name);
static int htable_insert(void *handle, const char *key, void *in)
static int htable_shutdown(void *handle)
static int htable_find(void *handle, const char *key, void **out)
static int htable_init(void **handle)
#define ADDED_EVENTS_INITIAL_CAPACITY
void cuptiu_event_table_destroy(cuptiu_event_table_t **pevt_table)
int cuptiu_event_table_get_item(cuptiu_event_table_t *evt_table, int evt_idx, cuptiu_event_t **record)
int cuptiu_event_table_create_init_capacity(int capacity, int sizeof_rec, cuptiu_event_table_t **pevt_table)
int cuptiu_event_table_select_by_idx(cuptiu_event_table_t *src, int count, int *idcs, cuptiu_event_table_t **pevt_names)
int cuptiu_files_search_in_path(const char *file_name, const char *search_path, char **file_paths)
int cuptiu_event_table_insert_record(cuptiu_event_table_t *evt_table, const char *evt_name, unsigned int evt_code, int evt_pos)
static int reallocate_array(cuptiu_event_table_t *evt_table)
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_create(int sizeof_rec, cuptiu_event_table_t **pevt_table)
char * evt_name(evstock *stock, int index)
#define ERRDBG(format, args...)
#define papi_calloc(a, b)
#define papi_realloc(a, b)
char name[PAPI_2MAX_STR_LEN]