intel/perf: add mdapi maker helper
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Sat, 9 Jun 2018 22:20:10 +0000 (23:20 +0100)
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>
Wed, 23 Oct 2019 05:41:14 +0000 (05:41 +0000)
A simple utility to put the marker at the right location.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
src/intel/perf/gen_perf_mdapi.h

index 3c3aec2c64eb4a9712b1284223b7ba405fd1544f..9747198be956ef8bd4d390872793fe1fd679bd2b 100644 (file)
@@ -26,6 +26,8 @@
 
 #include <stdint.h>
 
+#include "dev/gen_device_info.h"
+
 struct gen_device_info;
 struct gen_perf_query_result;
 
@@ -132,4 +134,30 @@ 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_marker(void *data, uint32_t data_size,
+                                                     const struct gen_device_info *devinfo,
+                                                     uint64_t value)
+{
+   switch (devinfo->gen) {
+   case 8: {
+      if (data_size < sizeof(struct gen8_mdapi_metrics))
+         return;
+      struct gen8_mdapi_metrics *mdapi_data = data;
+      mdapi_data->MarkerUser = value;
+      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->MarkerUser = value;
+      break;
+   }
+   default:
+      break;
+   }
+}
+
 #endif /* GEN_PERF_MDAPI_H */