pan/perf: Rename pan_perf_counter_read[_raw] functions

_raw no longer takes the "raw" offsets as arguments so the name doesn't
make sense anymore. The old non "_raw" function actually sums over
blocks instead of just reading the passed counter.

This commits fixes the naming of those two functions so they match what
the functions do.
This commit is contained in:
Christoph Pillmayer 2026-04-13 11:13:59 +02:00
parent 77f46dfb5a
commit 3a1dadf038
4 changed files with 13 additions and 13 deletions

View file

@ -174,7 +174,7 @@ PanfrostPerf::create_available_counters() const
auto &pan_driver = PanfrostDriver::into(d);
struct pan_perf *perf = static_cast<struct pan_perf *>(
pan_driver.perf->get_subinstance());
return pan_perf_counter_read_raw(perf, cinfo, block_idx);
return pan_perf_counter_read(perf, cinfo, block_idx);
});
group.counters.push_back(counter.id);

View file

@ -18,8 +18,8 @@
#include <pan_perf_metrics.h>
int64_t
pan_perf_counter_read_raw(const struct pan_perf *perf,
const struct pan_perf_counter *counter, uint8_t block)
pan_perf_counter_read(const struct pan_perf *perf,
const struct pan_perf_counter *counter, uint8_t block)
{
STATIC_ASSERT((int)PAN_KMOD_PERF_CAT_FRONTEND == (int)PAN_PERF_COUNTER_CAT_FRONTEND);
STATIC_ASSERT((int)PAN_KMOD_PERF_CAT_TILER == (int)PAN_PERF_COUNTER_CAT_TILER);
@ -38,17 +38,17 @@ pan_perf_counter_read_raw(const struct pan_perf *perf,
}
int64_t
pan_perf_counter_read(const struct pan_perf_counter *counter,
const struct pan_perf *perf)
pan_perf_counter_read_block_sum(const struct pan_perf_counter *counter,
const struct pan_perf *perf)
{
int64_t ret = pan_perf_counter_read_raw(perf, counter, 0);
int64_t ret = pan_perf_counter_read(perf, counter, 0);
/* If counter belongs to shader core, sum values for all cores. */
if (counter->category_index == PAN_PERF_COUNTER_CAT_SHADER) {
uint32_t n_cores =
perf->mem_layout.category[PAN_PERF_COUNTER_CAT_SHADER].n_blocks;
for (uint32_t core = 1; core < n_cores; ++core) {
ret += pan_perf_counter_read_raw(perf, counter, core);
ret += pan_perf_counter_read(perf, counter, core);
assert(ret >= 0 && "counter sum should not overflow");
}
}

View file

@ -78,12 +78,12 @@ struct pan_perf {
struct pan_kmod_perf_buffer_layout mem_layout;
};
int64_t pan_perf_counter_read_raw(const struct pan_perf *perf,
const struct pan_perf_counter *counter,
uint8_t block);
int64_t pan_perf_counter_read(const struct pan_perf *perf,
const struct pan_perf_counter *counter,
uint8_t block);
int64_t pan_perf_counter_read(const struct pan_perf_counter *counter,
const struct pan_perf *perf);
int64_t pan_perf_counter_read_block_sum(const struct pan_perf_counter *counter,
const struct pan_perf *perf);
void pan_perf_init(struct pan_perf *perf, int fd);

View file

@ -45,7 +45,7 @@ main(void)
for (unsigned j = 0; j < cat->n_counters; ++j) {
const struct pan_perf_counter *ctr = &cat->counters[j];
int64_t val = pan_perf_counter_read(ctr, perf);
int64_t val = pan_perf_counter_read_block_sum(ctr, perf);
printf("%s (%s): %ld\n", ctr->name, ctr->symbol_name, val);
}