Skip to content

Commit

Permalink
performance_monitor: fix issue with freeing bitmap
Browse files Browse the repository at this point in the history
Zephyr's bitarray had a problem when clearing the bit before freeing
it. Not clearing it changes nothing in overall logic so we can just not
do it.
Also fixes and issue with computing bitmap idx.

Signed-off-by: Tobiasz Dryjanski <tobiaszx.dryjanski@intel.com>
  • Loading branch information
tobonex committed Sep 17, 2024
1 parent aee690a commit f7d2315
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/debug/telemetry/performance_monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,8 @@ struct perf_data_item_comp *perf_data_getnext(void)
int perf_data_free(struct perf_data_item_comp * const item)
{
/* find index of item */
int idx = (item - perf_data) / sizeof(*item);
int ret = perf_bitmap_clearbit(&performance_data_bitmap, idx);

if (ret < 0)
return ret;
ret = perf_bitmap_free(&performance_data_bitmap, idx);
int idx = (item - perf_data);
int ret = perf_bitmap_free(&performance_data_bitmap, idx);
if (ret < 0)
return ret;

Expand Down Expand Up @@ -473,10 +469,6 @@ int io_perf_monitor_release_slot(struct io_perf_data_item *item)
k_spin_unlock(&self->lock, key);

/* we assign data items ourselves so neither of those should ever fail */
ret = perf_bitmap_clearbit(&self->io_performance_data_bitmap, idx);
assert(!ret);
if (ret < 0)
return ret;
ret = perf_bitmap_free(&self->io_performance_data_bitmap, idx);
assert(!ret);
return ret;
Expand Down

0 comments on commit f7d2315

Please sign in to comment.