diff options
author | Lionel Landwerlin <[email protected]> | 2018-10-02 15:41:41 +0100 |
---|---|---|
committer | Lionel Landwerlin <[email protected]> | 2019-04-17 14:10:42 +0100 |
commit | 93dbe52ab04a0061f893aaa4e9fdbb385b8b2fb0 (patch) | |
tree | d29167d6de7d952e6ca3dfa7f7839cba4773db87 /src/intel/perf | |
parent | a646485c28b95ce8a6a61d61c2afaeefcdf439a4 (diff) |
intel/perf: drop counter size field
We can deduct the size from another field, let's just save some space.
Signed-off-by: Lionel Landwerlin <[email protected]>
Reviewed-by: Mark Janes <[email protected]>
Diffstat (limited to 'src/intel/perf')
-rw-r--r-- | src/intel/perf/gen_perf.h | 21 | ||||
-rw-r--r-- | src/intel/perf/gen_perf.py | 3 |
2 files changed, 20 insertions, 4 deletions
diff --git a/src/intel/perf/gen_perf.h b/src/intel/perf/gen_perf.h index 24fbd15cac1..6e7a6d36c15 100644 --- a/src/intel/perf/gen_perf.h +++ b/src/intel/perf/gen_perf.h @@ -106,7 +106,6 @@ struct gen_perf_query_counter { enum gen_perf_counter_data_type data_type; uint64_t raw_max; size_t offset; - size_t size; union { uint64_t (*oa_counter_read_uint64)(struct gen_perf *perf, @@ -193,6 +192,25 @@ struct gen_perf { int (*ioctl)(int, unsigned long, void *); }; +static inline size_t +gen_perf_query_counter_get_size(const struct gen_perf_query_counter *counter) +{ + switch (counter->data_type) { + case GEN_PERF_COUNTER_DATA_TYPE_BOOL32: + return sizeof(uint32_t); + case GEN_PERF_COUNTER_DATA_TYPE_UINT32: + return sizeof(uint32_t); + case GEN_PERF_COUNTER_DATA_TYPE_UINT64: + return sizeof(uint64_t); + case GEN_PERF_COUNTER_DATA_TYPE_FLOAT: + return sizeof(float); + case GEN_PERF_COUNTER_DATA_TYPE_DOUBLE: + return sizeof(double); + default: + unreachable("invalid counter data type"); + } +} + static inline struct gen_perf_query_info * gen_perf_query_append_query_info(struct gen_perf *perf, int max_counters) { @@ -230,7 +248,6 @@ gen_perf_query_info_add_stat_reg(struct gen_perf_query_info *query, counter->desc = description; counter->type = GEN_PERF_COUNTER_TYPE_RAW; counter->data_type = GEN_PERF_COUNTER_DATA_TYPE_UINT64; - counter->size = sizeof(uint64_t); counter->offset = sizeof(uint64_t) * query->n_counters; counter->pipeline_stat.reg = reg; counter->pipeline_stat.numerator = numerator; diff --git a/src/intel/perf/gen_perf.py b/src/intel/perf/gen_perf.py index c41e8f3eb11..f7d0b86b2cf 100644 --- a/src/intel/perf/gen_perf.py +++ b/src/intel/perf/gen_perf.py @@ -381,7 +381,6 @@ def output_counter_report(set, counter, current_offset): current_offset = pot_align(current_offset, sizeof(c_type)) c("counter->offset = " + str(current_offset) + ";\n") - c("counter->size = sizeof(" + c_type + ");\n") if availability: c_outdent(3); @@ -722,7 +721,7 @@ def main(): offset = output_counter_report(set, counter, offset) - c("\nquery->data_size = counter->offset + counter->size;\n") + c("\nquery->data_size = counter->offset + gen_perf_query_counter_get_size(counter);\n") c_outdent(3) c("}"); |