mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 06:58:05 +02:00
pan/perf: Support reading derived counters
Also pull out pan_perf_counter_read_raw into the header to help inlining into the generated equation functions added afterwards.
This commit is contained in:
parent
7887f4e7b5
commit
5edbcca82b
2 changed files with 25 additions and 13 deletions
|
|
@ -21,19 +21,10 @@ int64_t
|
|||
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);
|
||||
STATIC_ASSERT((int)PAN_KMOD_PERF_CAT_MEMSYS == (int)PAN_PERF_COUNTER_CAT_MEMSYS);
|
||||
STATIC_ASSERT((int)PAN_KMOD_PERF_CAT_SHADER == (int)PAN_PERF_COUNTER_CAT_SHADER);
|
||||
|
||||
assert(perf->session->data != NULL);
|
||||
|
||||
const uint32_t offset = perf->mem_layout.category[counter->category].offset +
|
||||
perf->mem_layout.block_stride * block +
|
||||
perf->mem_layout.counter_stride * counter->offset;
|
||||
|
||||
uint8_t *val_ptr = ((uint8_t *)perf->session->data) + offset;
|
||||
return pan_kmod_perf_load_counter(perf->session, val_ptr);
|
||||
if (counter->derived != NULL)
|
||||
return counter->derived(perf, perf->derived_configs, block);
|
||||
else
|
||||
return pan_perf_counter_read_raw(perf, counter->category, counter->offset, block);
|
||||
}
|
||||
|
||||
int64_t
|
||||
|
|
|
|||
|
|
@ -98,6 +98,27 @@ struct pan_perf {
|
|||
double derived_configs[PAN_PERF_DERIVED_CONFIG_LAST + 1];
|
||||
};
|
||||
|
||||
static inline
|
||||
int64_t pan_perf_counter_read_raw(const struct pan_perf *perf,
|
||||
enum pan_perf_counter_categories cat,
|
||||
uint8_t counter_index,
|
||||
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);
|
||||
STATIC_ASSERT((int)PAN_KMOD_PERF_CAT_MEMSYS == (int)PAN_PERF_COUNTER_CAT_MEMSYS);
|
||||
STATIC_ASSERT((int)PAN_KMOD_PERF_CAT_SHADER == (int)PAN_PERF_COUNTER_CAT_SHADER);
|
||||
|
||||
assert(perf->session->data != NULL);
|
||||
|
||||
const uint32_t offset = perf->mem_layout.category[cat].offset +
|
||||
perf->mem_layout.block_stride * block +
|
||||
perf->mem_layout.counter_stride * counter_index;
|
||||
|
||||
uint8_t *val_ptr = ((uint8_t *)perf->session->data) + offset;
|
||||
return pan_kmod_perf_load_counter(perf->session, val_ptr);
|
||||
}
|
||||
|
||||
int64_t pan_perf_counter_read(const struct pan_perf *perf,
|
||||
const struct pan_perf_counter *counter,
|
||||
uint8_t block);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue