Skip to content

Commit

Permalink
Fix off-by-one in userspace metric writer
Browse files Browse the repository at this point in the history
Index 0 in the counter_collection is reserved for the metric leader.
However userspace metrics dont have a metric leader, so start counting
the events from 1 instead of 0
  • Loading branch information
cvonelm committed Oct 20, 2023
1 parent 14506b3 commit bc6efdd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/perf/counter/userspace/writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ bool Writer::handle(std::vector<UserspaceReadFormat>& data)

for (std::size_t i = 0; i < counter_buffer_.size(); i++)
{
values[i] = counter_buffer_[i] * counter_collection_.get_scale(i);
values[i] = counter_buffer_[i] * counter_collection_.get_scale(i + 1);
}

writer_.write(metric_event_);
Expand Down

0 comments on commit bc6efdd

Please sign in to comment.