aboutsummaryrefslogtreecommitdiffstats
path: root/src/intel
diff options
context:
space:
mode:
authorLionel Landwerlin <[email protected]>2018-11-28 15:10:09 +0000
committerLionel Landwerlin <[email protected]>2019-10-23 05:41:15 +0000
commit5ba6d9941b5dda95b88b924ac51133f36bd0f653 (patch)
treee5a41f9673f4fde78d6d41a79c16c737c2abdf15 /src/intel
parenta2a1873a8289157490876acc4ea2f36886817690 (diff)
intel/perf: add mdapi writes for register perf counters
Those are not part of the OA reports. Signed-off-by: Lionel Landwerlin <[email protected]> Reviewed-by: Rafael Antognolli <[email protected]>
Diffstat (limited to 'src/intel')
-rw-r--r--src/intel/perf/gen_perf_mdapi.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/intel/perf/gen_perf_mdapi.h b/src/intel/perf/gen_perf_mdapi.h
index 9747198be95..c0e8d811c1d 100644
--- a/src/intel/perf/gen_perf_mdapi.h
+++ b/src/intel/perf/gen_perf_mdapi.h
@@ -134,6 +134,42 @@ int gen_perf_query_result_write_mdapi(void *data, uint32_t data_size,
const struct gen_perf_query_result *result,
uint64_t freq_start, uint64_t freq_end);
+static inline void gen_perf_query_mdapi_write_perfcntr(void *data, uint32_t data_size,
+ const struct gen_device_info *devinfo,
+ const uint64_t *begin_perf_cntrs,
+ const uint64_t *end_perf_cntrs)
+{
+ /* Only bits 0:43 of the 64bit registers contains the value. */
+ const uint64_t mask = (1ull << 44) - 1;
+
+ switch (devinfo->gen) {
+ case 8: {
+ if (data_size < sizeof(struct gen8_mdapi_metrics))
+ return;
+ struct gen8_mdapi_metrics *mdapi_data = data;
+ mdapi_data->PerfCounter1 =
+ (end_perf_cntrs[0] & mask) - (begin_perf_cntrs[0] & mask);
+ mdapi_data->PerfCounter2 =
+ (end_perf_cntrs[1] & mask) - (begin_perf_cntrs[1] & mask);
+ break;
+ }
+ case 9:
+ case 10:
+ case 11: {
+ if (data_size < sizeof(struct gen9_mdapi_metrics))
+ return;
+ struct gen9_mdapi_metrics *mdapi_data = data;
+ mdapi_data->PerfCounter1 =
+ (end_perf_cntrs[0] & mask) - (begin_perf_cntrs[0] & mask);
+ mdapi_data->PerfCounter2 =
+ (end_perf_cntrs[1] & mask) - (begin_perf_cntrs[1] & mask);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
static inline void gen_perf_query_mdapi_write_marker(void *data, uint32_t data_size,
const struct gen_device_info *devinfo,
uint64_t value)