PAPI 7.1.0.0
Loading...
Searching...
No Matches
sde_lib_misc.c
Go to the documentation of this file.
1
13#include "sde_lib_internal.h"
14
15static int aggregate_value_in_group(long long int *data, long long int *rslt, int cntr_type, int group_flags);
16static inline int cast_and_store(void *data, long long int previous_value, void *rslt_ptr, int cntr_type);
17static inline int free_counter_resources(sde_counter_t *counter);
18
20int _sde_debug = 0;
21
22static papisde_library_desc_t *find_library_by_name(const char *library_name, papisde_control_t *gctl);
23static void insert_library_handle(papisde_library_desc_t *lib_handle, papisde_control_t *gctl);
24
25
26/*************************************************************************/
27/* Utility Functions. */
28/*************************************************************************/
29
34papisde_control_t *sdei_get_global_struct(void){
35 // Allocate the global control structure, unless it has already been allocated by another library
36 // or the application code calling PAPI_name_to_code() for an SDE.
38 SDEDBG("sdei_get_global_struct(): global SDE control struct is being allocated.\n");
39 _papisde_global_control = (papisde_control_t *)calloc( 1, sizeof( papisde_control_t ) );
40 }
42}
43
44
45
46
53papisde_library_desc_t *find_library_by_name(const char *library_name, papisde_control_t *gctl){
54
55 if( (NULL == gctl) || (NULL == library_name) )
56 return NULL;
57
58 papisde_library_desc_t *tmp_lib = gctl->lib_list_head;
59 // Check to see if this library has already been initialized.
60 while(NULL != tmp_lib){
61 char *tmp_name = tmp_lib->libraryName;
62 SDEDBG("Checking library: '%s' against registered library: '%s'\n", library_name, tmp_lib->libraryName);
63 // If we find the same library already registered, we do not create a new entry.
64 if( (NULL != tmp_name) && !strcmp(tmp_name, library_name) )
65 return tmp_lib;
66
67 tmp_lib = tmp_lib->next;
68 }
69
70 return NULL;
71}
72
79void insert_library_handle(papisde_library_desc_t *lib_handle, papisde_control_t *gctl){
80 SDEDBG("insert_library_handle(): inserting new handle for library: '%s'\n",lib_handle->libraryName);
81 lib_handle->next = gctl->lib_list_head;
82 gctl->lib_list_head = lib_handle;
83
84 return;
85}
86
87
88// Initialize library handle, or return the existing one if already
89// initialized. This function is _not_ thread safe, so it needs to be called
90// from within regions protected by sde_lock()/sde_unlock().
91papi_handle_t do_sde_init(const char *name_of_library, papisde_control_t *gctl){
92
93 papisde_library_desc_t *tmp_lib;
94
95 SDEDBG("Registering library: '%s'\n",name_of_library);
96
97 // If the library is already initialized, return the handle to it
98 tmp_lib = find_library_by_name(name_of_library, gctl);
99 if( NULL != tmp_lib ){
100 return tmp_lib;
101 }
102
103 // If the library is not already initialized, then initialize it.
104 tmp_lib = ( papisde_library_desc_t* ) calloc( 1, sizeof( papisde_library_desc_t ) );
105 tmp_lib->libraryName = strdup(name_of_library);
106
107 insert_library_handle(tmp_lib, gctl);
108
109 return tmp_lib;
110}
111
112sde_counter_t *allocate_and_insert( papisde_control_t *gctl, papisde_library_desc_t* lib_handle, const char* name, uint32_t uniq_id, int cntr_mode, int cntr_type, enum CNTR_CLASS cntr_class, cntr_class_specific_t cntr_union ){
113
114 // make sure to calloc() the structure, so all the fields which we do not explicitly set remain zero.
115 sde_counter_t *item = (sde_counter_t *)calloc(1, sizeof(sde_counter_t));
116 if( NULL == item )
117 return NULL;
118
119 item->u = cntr_union;
120 item->cntr_class = cntr_class;
121 item->cntr_type = cntr_type;
122 item->cntr_mode = cntr_mode;
123 item->glb_uniq_id = uniq_id;
124 item->name = strdup( name );
125 item->description = strdup( name );
126 item->which_lib = lib_handle;
127
128 (void)ht_insert(lib_handle->lib_counters, ht_hash_name(name), item);
129 (void)ht_insert(gctl->all_reg_counters, ht_hash_id(uniq_id), item);
130
131 return item;
132}
133
134void
135sdei_counting_set_to_list( void *cset_handle, cset_list_object_t **list_head )
136{
137 sde_counter_t *tmp_cset;
138
139 if( NULL == list_head )
140 return;
141
142 tmp_cset = (sde_counter_t *)cset_handle;
143 if( (NULL == tmp_cset) || !IS_CNTR_CSET(tmp_cset) || (NULL == tmp_cset->u.cntr_cset.data) ){
144 SDE_ERROR("sdei_counting_set_to_list(): 'cset_handle' is clobbered.");
145 return;
146 }
147
148 *list_head = cset_to_list(tmp_cset->u.cntr_cset.data);
149
150 return;
151}
152
153// This function modifies data structures, BUT its callers are responsible for aquiring a lock, so it
154// is always called in an atomic fashion and thus should not acquire a lock. Actually, locking inside
155// this function will cause a deadlock.
156int sdei_setup_counter_internals( papi_handle_t handle, const char *event_name, int cntr_mode, int cntr_type, enum CNTR_CLASS cntr_class, cntr_class_specific_t cntr_union )
157{
158 papisde_library_desc_t *lib_handle;
159 sde_counter_t *tmp_item;
160 uint32_t counter_uniq_id;
161 char *full_event_name;
162 int ret_val = SDE_OK;
163 int needs_overflow = 0;
164
165 lib_handle = (papisde_library_desc_t *) handle;
166 if( (NULL == lib_handle) || (NULL == lib_handle->libraryName) ){
167 SDE_ERROR("sdei_setup_counter_internals(): 'handle' is clobbered. Unable to register counter.");
168 return SDE_EINVAL;
169 }
170
171 size_t str_len = strlen(lib_handle->libraryName)+strlen(event_name)+2+1; // +2 for "::" and +1 for '\0'
172 full_event_name = (char *)malloc(str_len*sizeof(char));
173 snprintf(full_event_name, str_len, "%s::%s", lib_handle->libraryName, event_name);
174
175 SDEDBG("%s: Counter: '%s' will be added in library: %s.\n", __FILE__, full_event_name, lib_handle->libraryName);
176
177 if( !is_instant(cntr_mode) && !is_delta(cntr_mode) ){
178 SDE_ERROR("Unknown mode %d. SDE counter mode must be either Instant or Delta.",cntr_mode);
179 free(full_event_name);
180 return SDE_ECMP;
181 }
182
183 // Look if the event is already registered.
184 tmp_item = ht_lookup_by_name(lib_handle->lib_counters, full_event_name);
185
186 if( NULL != tmp_item ){
187 if( !IS_CNTR_PLACEHOLDER(tmp_item) ){
188 // If it is registered and it is _not_ a placeholder then ignore it silently.
189 SDEDBG("%s: Counter: '%s' was already in library: %s.\n", __FILE__, full_event_name, lib_handle->libraryName);
190 free(full_event_name);
191 return SDE_OK;
192 }
193 // If we are here, then it IS a placeholder, so check if we need to start overflowing.
194 if( tmp_item->overflow && ( (CNTR_CLASS_REGISTERED == cntr_class) || (CNTR_CLASS_CB == cntr_class) ) ){
195 needs_overflow = 1;
196 }
197
198 // Since the counter is a placeholder update the mode, the type, and the union that contains the 'data'.
199 SDEDBG("%s: Updating placeholder for counter: '%s' in library: %s.\n", __FILE__, full_event_name, lib_handle->libraryName);
200
201 tmp_item->u = cntr_union;
202 tmp_item->cntr_class = cntr_class;
203 tmp_item->cntr_mode = cntr_mode;
204 tmp_item->cntr_type = cntr_type;
205 free(full_event_name);
206
207 return SDE_OK;
208 }
209
210 // If neither the event, nor a placeholder exists, then use the current
211 // number of registered events as the index of the new one, and increment it.
212 papisde_control_t *gctl = sdei_get_global_struct();
213 counter_uniq_id = gctl->num_reg_events++;
214 gctl->num_live_events++;
215
216 SDEDBG("%s: Counter %s has unique ID = %d\n", __FILE__, full_event_name, counter_uniq_id);
217
218 tmp_item = allocate_and_insert( gctl, lib_handle, full_event_name, counter_uniq_id, cntr_mode, cntr_type, cntr_class, cntr_union );
219
220 if(NULL == tmp_item) {
221 SDEDBG("%s: Counter not inserted in SDE %s\n", __FILE__, lib_handle->libraryName);
222 free(full_event_name);
223 return SDE_ECMP;
224 }
225
226 free(full_event_name);
227
228 // Check if we need to worry about overflow (cases r[4-6])
229 if( needs_overflow ){
230 ret_val = sdei_set_timer_for_overflow();
231 }
232
233 return ret_val;
234}
235
236int sdei_inc_ref_count(sde_counter_t *counter){
237 papisde_list_entry_t *curr;
238 if( NULL == counter )
239 return SDE_OK;
240
241 // If the counter is a group, recursivelly increment the ref_count of all its children.
242 if(CNTR_CLASS_GROUP == counter->cntr_class){
243 curr = counter->u.cntr_group.group_head;
244 do{
245 sde_counter_t *tmp_cntr = curr->item;
246 // recursively increment the ref_count of all the elements in the group.
247 int ret_val = sdei_inc_ref_count(tmp_cntr);
248 if( SDE_OK != ret_val )
249 return ret_val;
250 curr = curr->next;
251 }while(NULL != curr);
252 }
253
254 // Increment the ref_count of the counter itself, INCLUDING the case where the counter is a group.
255 (counter->ref_count)++;
256
257 return SDE_OK;
258}
259
260int sdei_delete_counter(papisde_library_desc_t* lib_handle, const char* name) {
261 sde_counter_t *tmp_item;
262 papisde_control_t *gctl;
263 uint32_t item_uniq_id;
264 int ret_val = SDE_OK;
265
266 gctl = sdei_get_global_struct();
267
268 // Look for the counter entry in the hash-table of the library
269 tmp_item = ht_lookup_by_name(lib_handle->lib_counters, name);
270 if( NULL == tmp_item ){
271 ret_val = SDE_EINVAL;
272 goto fn_exit;
273 }
274
275 if( CNTR_CLASS_GROUP == tmp_item->cntr_class ){
276 papisde_list_entry_t *curr, *prev;
277 // If we are dealing with a goup, then we need to recurse down all its children and
278 // delete them (this might mean free them, or just decrement their ref_count).
279 curr = tmp_item->u.cntr_group.group_head;
280 prev = curr;
281 while(NULL != curr){
282 int counter_is_dead = 0;
283 sde_counter_t *tmp_cntr = curr->item;
284 if( NULL == tmp_cntr ){
285 ret_val = SDE_EMISC;
286 goto fn_exit;
287 }
288
289 // If this counter is going to be freed, we need to remove it from this group.
290 if( 0 == tmp_cntr->ref_count )
291 counter_is_dead = 1;
292
293 // recursively delete all the elements of the group.
294 int ret_val = sdei_delete_counter(lib_handle, tmp_cntr->name);
295 if( SDE_OK != ret_val )
296 goto fn_exit;
297
298 if( counter_is_dead ){
299 if( curr == tmp_item->u.cntr_group.group_head ){
300 // if we were removing with the head, change the head, we can't free() it.
301 tmp_item->u.cntr_group.group_head = curr->next;
302 prev = curr->next;
303 curr = curr->next;
304 }else{
305 // if we are removing an element, first bridge the previous to the next.
306 prev->next = curr->next;
307 free(curr);
308 curr = prev->next;
309 }
310 }else{
311 // if we are not removing anything, just move the pointers.
312 prev = curr;
313 curr = curr->next;
314 }
315 }
316 }
317
318 item_uniq_id = tmp_item->glb_uniq_id;
319
320 // If the reference count is not zero, then we don't remove it from the hash tables
321 if( 0 == tmp_item->ref_count ){
322 // Delete the entry from the library hash-table (which hashes by name)
323 tmp_item = ht_delete(lib_handle->lib_counters, ht_hash_name(name), item_uniq_id);
324 if( NULL == tmp_item ){
325 ret_val = SDE_EMISC;
326 goto fn_exit;
327 }
328
329 // Delete the entry from the global hash-table (which hashes by id) and free the memory
330 // occupied by the counter (not the hash-table entry 'papisde_list_entry_t', the 'sde_counter_t')
331 tmp_item = ht_delete(gctl->all_reg_counters, ht_hash_id(item_uniq_id), item_uniq_id);
332 if( NULL == tmp_item ){
333 ret_val = SDE_EMISC;
334 goto fn_exit;
335 }
336
337 // We free the counter only once, although it is in two hash-tables,
338 // because it is the same structure that is pointed to by both hash-tables.
339 free_counter_resources(tmp_item);
340
341 // Decrement the number of live events.
342 (gctl->num_live_events)--;
343 }else{
344 (tmp_item->ref_count)--;
345 }
346
347fn_exit:
348 return ret_val;
349}
350
351int free_counter_resources(sde_counter_t *counter){
352 int i, ret_val = SDE_OK;
353
354 if( NULL == counter )
355 return SDE_OK;
356
357 if( 0 == counter->ref_count ){
358 switch(counter->cntr_class){
360 SDEDBG(" + Freeing Created Counter Data.\n");
361 free(counter->u.cntr_basic.data);
362 break;
364 SDEDBG(" + Freeing Recorder Data.\n");
365 free(counter->u.cntr_recorder.data->sorted_buffer);
366 for(i=0; i<EXP_CONTAINER_ENTRIES; i++){
367 free(counter->u.cntr_recorder.data->ptr_array[i]);
368 }
369 free(counter->u.cntr_recorder.data);
370 break;
371 case CNTR_CLASS_CSET:
372 SDEDBG(" + Freeing CountingSet Data.\n");
373 ret_val = cset_delete(counter->u.cntr_cset.data);
374 break;
375 }
376
377 SDEDBG(" -> Freeing Counter '%s'.\n",counter->name);
378 free(counter->name);
379 free(counter->description);
380 free(counter);
381 }
382
383 return ret_val;
384}
385
389int
390sdei_read_counter_group( sde_counter_t *counter, long long int *rslt_ptr ){
391 papisde_list_entry_t *curr;
392 long long int final_value = 0;
393
394 if( NULL == counter ){
395 SDE_ERROR("sdei_read_counter_group(): Counter parameter is NULL.\n");
396 return SDE_EINVAL;
397 }
398
399 if( !IS_CNTR_GROUP(counter) ){
400 SDE_ERROR("sdei_read_counter_group(): Counter '%s' is not a counter group.\n",counter->name);
401 return SDE_EINVAL;
402 }
403 curr = counter->u.cntr_group.group_head;
404
405 do{
406 long long int tmp_value = 0;
407 int ret_val;
408
409 sde_counter_t *tmp_cntr = curr->item;
410 if( NULL == tmp_cntr ){
411 SDE_ERROR("sdei_read_counter_group(): List of counters in counter group '%s' is clobbered.\n",counter->name);
412 return SDE_EINVAL;
413 }
414
415 int read_succesfully = 1;
416 // We can _not_ have a recorder inside a group.
417 if( IS_CNTR_RECORDER(tmp_cntr) || IS_CNTR_CSET(tmp_cntr) || IS_CNTR_PLACEHOLDER(tmp_cntr) ){
418 SDE_ERROR("sdei_read_counter_group(): Counter group contains counter: %s with class: %d.\n",tmp_cntr->name, tmp_cntr->cntr_class);
419 }else{
420 // We allow counter groups to contain other counter groups recursively.
421 if( IS_CNTR_GROUP(tmp_cntr) ){
422 ret_val = sdei_read_counter_group( tmp_cntr, &tmp_value );
423 if( ret_val != SDE_OK ){
424 // If something went wrong with one counter group, ignore it silently.
425 read_succesfully = 0;
426 }
427 }else{ // If we are here it means that we are trying to read a real counter.
428 ret_val = sdei_read_and_update_data_value( tmp_cntr, tmp_cntr->previous_data, &tmp_value );
429 if( SDE_OK != ret_val ){
430 SDE_ERROR("sdei_read_counter_group(): Error occured when reading counter: %s.\n",tmp_cntr->name);
431 read_succesfully = 0;
432 }
433 }
434
435 if( read_succesfully )
436 aggregate_value_in_group(&tmp_value, &final_value, tmp_cntr->cntr_type, counter->u.cntr_group.group_flags);
437 }
438
439 curr = curr->next;
440 }while(NULL != curr);
441
442 *rslt_ptr = final_value;
443 return SDE_OK;
444}
445
446
447/* both "rslt" and "data" are local variables that this component stored after promoting to 64 bits. */
448#define _SDE_AGGREGATE( _TYPE, _RSLT_TYPE ) do{\
449 switch(group_flags){\
450 case PAPI_SDE_SUM:\
451 *(_RSLT_TYPE *)rslt = (_RSLT_TYPE) ((_TYPE)(*(_RSLT_TYPE *)rslt) + (_TYPE)(*((_RSLT_TYPE *)data)) );\
452 break;\
453 case PAPI_SDE_MAX:\
454 if( *(_RSLT_TYPE *)rslt < *((_RSLT_TYPE *)data) )\
455 *(_RSLT_TYPE *)rslt = *((_RSLT_TYPE *)data);\
456 break;\
457 case PAPI_SDE_MIN:\
458 if( *(_RSLT_TYPE *)rslt > *((_RSLT_TYPE *)data) )\
459 *(_RSLT_TYPE *)rslt = *((_RSLT_TYPE *)data);\
460 break;\
461 default:\
462 SDEDBG("Unsupported counter group flag: %d\n",group_flags);\
463 return -1;\
464 } \
465 }while(0)
466
467static int aggregate_value_in_group(long long int *data, long long int *rslt, int cntr_type, int group_flags){
468 switch(cntr_type){
470 _SDE_AGGREGATE(long long int, long long int);
471 return SDE_OK;
472 case PAPI_SDE_int:
473 // We need to cast the result to "long long" so it is expanded to 64bit to take up all the space
474 _SDE_AGGREGATE(int, long long int);
475 return SDE_OK;
476 case PAPI_SDE_double:
477 _SDE_AGGREGATE(double, double);
478 return SDE_OK;
479 case PAPI_SDE_float:
480 // We need to cast the result to "double" so it is expanded to 64bit to take up all the space
481 _SDE_AGGREGATE(float, double);
482 return SDE_OK;
483 default:
484 SDEDBG("Unsupported counter type: %d\n",cntr_type);
485 return -1;
486 }
487}
488
489int
490sdei_read_and_update_data_value( sde_counter_t *counter, long long int previous_value, long long int *rslt_ptr ) {
491 int ret_val;
492 long long int tmp_int;
493 void *tmp_data;
494
495 char *event_name = counter->name;
496
497 if( IS_CNTR_BASIC(counter) ){
498 SDEDBG("Reading %s by accessing data pointer.\n", event_name);
499 tmp_data = counter->u.cntr_basic.data;
500 }else if( IS_CNTR_CALLBACK(counter) ){
501 SDEDBG("Reading %s by calling registered function pointer.\n", event_name);
502 tmp_int = counter->u.cntr_cb.callback(counter->u.cntr_cb.param);
503 tmp_data = &tmp_int;
504 }else{
505 SDEDBG("sdei_read_and_update_data_value(): Event %s has neither a variable nor a function pointer associated with it.\n", event_name);
506 return -1;
507 }
508
509 if( is_instant(counter->cntr_mode) ){
510 /* Instant counter means that we don't subtract the previous value (which we read at PAPI_Start()) */
511 previous_value = 0;
512 } else if( is_delta(counter->cntr_mode) ){
513 /* Do nothing here, this is the default mode */
514 } else{
515 SDEDBG("Unsupported mode (%d) for event: %s\n",counter->cntr_mode, event_name);
516 return -1;
517 }
518
519 ret_val = cast_and_store(tmp_data, previous_value, rslt_ptr, counter->cntr_type);
520 return ret_val;
521}
522
523static inline int
524cast_and_store(void *data, long long int previous_value, void *rslt_ptr, int cntr_type){
525 void *tmp_ptr;
526
527 switch(cntr_type){
529 *(long long int *)rslt_ptr = *((long long int *)data) - previous_value;
530 SDEDBG(" value LL=%lld (%lld-%lld)\n", *(long long int *)rslt_ptr, *((long long int *)data), previous_value);
531 return SDE_OK;
532 case PAPI_SDE_int:
533 // We need to cast the result to "long long" so it is expanded to 64bit to take up all the space
534 *(long long int *)rslt_ptr = (long long int) (*((int *)data) - (int)previous_value);
535 SDEDBG(" value LD=%lld (%d-%d)\n", *(long long int *)rslt_ptr, *((int *)data), (int)previous_value);
536 return SDE_OK;
537 case PAPI_SDE_double:
538 tmp_ptr = &previous_value;
539 *(double *)rslt_ptr = (*((double *)data) - *((double *)tmp_ptr));
540 SDEDBG(" value LF=%lf (%lf-%lf)\n", *(double *)rslt_ptr, *((double *)data), *((double *)tmp_ptr));
541 return SDE_OK;
542 case PAPI_SDE_float:
543 // We need to cast the result to "double" so it is expanded to 64bit to take up all the space
544 tmp_ptr = &previous_value;
545 *(double *)rslt_ptr = (double)(*((float *)data) - (float)(*((double *)tmp_ptr)) );
546 SDEDBG(" value F=%lf (%f-%f)\n", *(double *)rslt_ptr, *((float *)data), (float)(*((double *)tmp_ptr)) );
547 return SDE_OK;
548 default:
549 SDEDBG("Unsupported counter type: %d\n",cntr_type);
550 return -1;
551 }
552
553}
554
555int
556sdei_hardware_write( sde_counter_t *counter, long long int new_value ){
557 double tmp_double;
558 void *tmp_ptr;
559
560 switch(counter->cntr_type){
562 *((long long int *)(counter->u.cntr_basic.data)) = new_value;
563 break;
564 case PAPI_SDE_int:
565 *((int *)(counter->u.cntr_basic.data)) = (int)new_value;
566 break;
567 case PAPI_SDE_double:
568 tmp_ptr = &new_value;
569 tmp_double = *((double *)tmp_ptr);
570 *((double *)(counter->u.cntr_basic.data)) = tmp_double;
571 break;
572 case PAPI_SDE_float:
573 // The pointer has to be 64bit. We can cast the variable to safely convert between bit-widths later on.
574 tmp_ptr = &new_value;
575 tmp_double = *((double *)tmp_ptr);
576 *((float *)(counter->u.cntr_basic.data)) = (float)tmp_double;
577 break;
578 default:
579 SDEDBG("Unsupported counter type: %d\n",counter->cntr_type);
580 return -1;
581 }
582
583 return SDE_OK;
584}
static papi_handle_t handle
Definition: Gamum.c:21
int i
char event_name[2][PAPI_MAX_STR_LEN]
Definition: data_range.c:29
const char * name
Definition: rocs.c:225
int
Definition: sde_internal.h:89
papisde_control_t * _papisde_global_control
Definition: sde_lib.c:37
int sdei_set_timer_for_overflow(void)
Definition: sde_lib.c:60
#define PAPI_SDE_double
Definition: sde_lib.h:30
void * papi_handle_t
Definition: sde_lib.h:100
#define SDE_EMISC
Definition: sde_lib.h:44
#define PAPI_SDE_float
Definition: sde_lib.h:31
#define PAPI_SDE_long_long
Definition: sde_lib.h:28
#define SDE_ECMP
Definition: sde_lib.h:42
#define SDE_EINVAL
Definition: sde_lib.h:40
static void SDE_ERROR(const char *format,...)
Definition: sde_lib.h:60
#define SDEDBG(format, args...)
Definition: sde_lib.h:58
#define PAPI_SDE_int
Definition: sde_lib.h:29
#define SDE_OK
Definition: sde_lib.h:39
int cset_delete(cset_hash_table_t *hash_ptr)
uint32_t ht_hash_name(const char *str)
void ht_insert(papisde_list_entry_t *hash_table, int ht_key, sde_counter_t *sde_counter)
sde_counter_t * ht_delete(papisde_list_entry_t *hash_table, int ht_key, uint32_t uniq_id)
sde_counter_t * ht_lookup_by_name(papisde_list_entry_t *hash_table, const char *name)
uint32_t ht_hash_id(uint32_t uniq_id)
cset_list_object_t * cset_to_list(cset_hash_table_t *hash_ptr)
#define IS_CNTR_CSET(_CNT)
#define IS_CNTR_BASIC(_CNT)
CNTR_CLASS
@ CNTR_CLASS_GROUP
@ CNTR_CLASS_CREATED
@ CNTR_CLASS_CSET
@ CNTR_CLASS_CB
@ CNTR_CLASS_REGISTERED
@ CNTR_CLASS_RECORDER
#define IS_CNTR_RECORDER(_CNT)
#define IS_CNTR_PLACEHOLDER(_CNT)
#define IS_CNTR_GROUP(_CNT)
#define EXP_CONTAINER_ENTRIES
#define is_delta(_X_)
#define is_instant(_X_)
#define IS_CNTR_CALLBACK(_CNT)
int sdei_setup_counter_internals(papi_handle_t handle, const char *event_name, int cntr_mode, int cntr_type, enum CNTR_CLASS cntr_class, cntr_class_specific_t cntr_union)
Definition: sde_lib_misc.c:156
int sdei_read_and_update_data_value(sde_counter_t *counter, long long int previous_value, long long int *rslt_ptr)
Definition: sde_lib_misc.c:490
int _sde_be_verbose
Definition: sde_lib_misc.c:19
static papisde_library_desc_t * find_library_by_name(const char *library_name, papisde_control_t *gctl)
Definition: sde_lib_misc.c:53
void sdei_counting_set_to_list(void *cset_handle, cset_list_object_t **list_head)
Definition: sde_lib_misc.c:135
static int free_counter_resources(sde_counter_t *counter)
Definition: sde_lib_misc.c:351
papi_handle_t do_sde_init(const char *name_of_library, papisde_control_t *gctl)
Definition: sde_lib_misc.c:91
sde_counter_t * allocate_and_insert(papisde_control_t *gctl, papisde_library_desc_t *lib_handle, const char *name, uint32_t uniq_id, int cntr_mode, int cntr_type, enum CNTR_CLASS cntr_class, cntr_class_specific_t cntr_union)
Definition: sde_lib_misc.c:112
static int cast_and_store(void *data, long long int previous_value, void *rslt_ptr, int cntr_type)
Definition: sde_lib_misc.c:524
int sdei_inc_ref_count(sde_counter_t *counter)
Definition: sde_lib_misc.c:236
static void insert_library_handle(papisde_library_desc_t *lib_handle, papisde_control_t *gctl)
Definition: sde_lib_misc.c:79
#define _SDE_AGGREGATE(_TYPE, _RSLT_TYPE)
Definition: sde_lib_misc.c:448
int _sde_debug
Definition: sde_lib_misc.c:20
int sdei_read_counter_group(sde_counter_t *counter, long long int *rslt_ptr)
Definition: sde_lib_misc.c:390
int sdei_delete_counter(papisde_library_desc_t *lib_handle, const char *name)
Definition: sde_lib_misc.c:260
int sdei_hardware_write(sde_counter_t *counter, long long int new_value)
Definition: sde_lib_misc.c:556
static int aggregate_value_in_group(long long int *data, long long int *rslt, int cntr_type, int group_flags)
Definition: sde_lib_misc.c:467
papisde_control_t * sdei_get_global_struct(void)
Definition: sde_lib_misc.c:34