Skip to content

Commit

Permalink
SDE_LIB: Allow PAPI_reset() to reset a CountingSet.
Browse files Browse the repository at this point in the history
  • Loading branch information
adanalis committed Mar 28, 2024
1 parent 40df2b4 commit 0e58f20
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/sde_lib/sde_lib_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,14 @@ sdei_read_and_update_data_value( sde_counter_t *counter, long long int previous_
SDEDBG("Reading %s by calling registered function pointer.\n", event_name);
tmp_int = counter->u.cntr_cb.callback(counter->u.cntr_cb.param);
tmp_data = &tmp_int;
}else if( IS_CNTR_CSET(counter) ){
if( 0 == previous_value ){
SDEDBG("Resetting CountingSet %s by freeing all the elements it contains.\n", event_name);
return cset_delete(counter->u.cntr_cset.data);
}else{
SDEDBG("sdei_read_and_update_data_value(): Event %s is a CountingSet, so it may only be reset by this function.\n", event_name);
return -1;
}
}else{
SDEDBG("sdei_read_and_update_data_value(): Event %s has neither a variable nor a function pointer associated with it.\n", event_name);
return -1;
Expand Down
2 changes: 1 addition & 1 deletion src/sde_lib/sde_lib_ti.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ sde_ti_reset_counter( uint32_t counter_id ){
}

sde_counter_t *counter = ht_lookup_by_id(gctl->all_reg_counters, counter_id);
if( (NULL == counter) || (!IS_CNTR_BASIC(counter) && !IS_CNTR_CALLBACK(counter)) ){
if( (NULL == counter) || (!IS_CNTR_BASIC(counter) && !IS_CNTR_CALLBACK(counter) && !IS_CNTR_CSET(counter)) ){
SDEDBG("sde_ti_reset_counter(): SDE with id %d is clobbered, or a type which does not support resetting.\n",counter_id);
// We allow tools to call this function even if the counter type does not support
// reseting, so we do not return an error if this is the case.
Expand Down

0 comments on commit 0e58f20

Please sign in to comment.