intel/perf: report query split for mdapi
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Mon, 16 Dec 2019 13:42:55 +0000 (15:42 +0200)
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>
Thu, 16 Jan 2020 13:29:40 +0000 (15:29 +0200)
Also forgotten in the initial implementation.

v2: Report begin timestamp scaled by the timestamp frequency (Windows
    behavior)

v3: Rename split to disjoint to match GL terminology (Tapani)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: <mesa-stable@lists.freedesktop.org>
Acked-by: Tapani Pälli <tapani.palli@intel.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3112>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3112>

src/intel/perf/gen_perf.c
src/intel/perf/gen_perf.h
src/intel/perf/gen_perf_mdapi.c

index fa6afb418073a2f1011adbec111305a0d85f77ac..421dfb8db5252c484fd5ced93e3a5a97b3d5a2cf 100644 (file)
@@ -2372,6 +2372,12 @@ accumulate_oa_reports(struct gen_perf_context *perf_ctx,
                gen_perf_query_result_accumulate(&query->oa.result,
                                                 query->queryinfo,
                                                 last, report);
+            } else {
+               /* We're not adding the delta because we've identified it's not
+                * for the context we filter for. We can consider that the
+                * query was split.
+                */
+               query->oa.result.query_disjoint = true;
             }
 
             last = report;
index 28df75c5bb1661b6b134127da64a9aff8cecc32b..b0af49ffb2cf5359be422ae5aa309eeddb4fcff6 100644 (file)
@@ -118,6 +118,11 @@ struct gen_perf_query_result {
     * Timestamp of the query.
     */
    uint64_t begin_timestamp;
+
+   /**
+    * Whether the query was interrupted by another workload (aka preemption).
+    */
+   bool query_disjoint;
 };
 
 struct gen_perf_query_counter {
index 0f35671930f7c8affd7f4e73957bb5b8f013967f..4c70d1f02070c606b238090971fee3ad7d9de5a2 100644 (file)
@@ -54,6 +54,7 @@ gen_perf_query_result_write_mdapi(void *data, uint32_t data_size,
          gen_device_info_timebase_scale(devinfo, result->accumulator[0]);
       mdapi_data->CoreFrequency = freq_end;
       mdapi_data->CoreFrequencyChanged = freq_end != freq_start;
+      mdapi_data->SplitOccured = result->query_disjoint;
       return sizeof(*mdapi_data);
    }
    case 8: {
@@ -73,7 +74,8 @@ gen_perf_query_result_write_mdapi(void *data, uint32_t data_size,
       mdapi_data->ReportsCount = result->reports_accumulated;
       mdapi_data->TotalTime =
          gen_device_info_timebase_scale(devinfo, result->accumulator[0]);
-      mdapi_data->BeginTimestamp = result->begin_timestamp;
+      mdapi_data->BeginTimestamp =
+         gen_device_info_timebase_scale(devinfo, result->begin_timestamp);
       mdapi_data->GPUTicks = result->accumulator[1];
       mdapi_data->CoreFrequency = freq_end;
       mdapi_data->CoreFrequencyChanged = freq_end != freq_start;
@@ -81,6 +83,7 @@ gen_perf_query_result_write_mdapi(void *data, uint32_t data_size,
          (result->slice_frequency[0] + result->slice_frequency[1]) / 2ULL;
       mdapi_data->UnsliceFrequency =
          (result->unslice_frequency[0] + result->unslice_frequency[1]) / 2ULL;
+      mdapi_data->SplitOccured = result->query_disjoint;
       return sizeof(*mdapi_data);
    }
    case 9:
@@ -102,7 +105,8 @@ gen_perf_query_result_write_mdapi(void *data, uint32_t data_size,
       mdapi_data->ReportsCount = result->reports_accumulated;
       mdapi_data->TotalTime =
          gen_device_info_timebase_scale(devinfo, result->accumulator[0]);
-      mdapi_data->BeginTimestamp = result->begin_timestamp;
+      mdapi_data->BeginTimestamp =
+         gen_device_info_timebase_scale(devinfo, result->begin_timestamp);
       mdapi_data->GPUTicks = result->accumulator[1];
       mdapi_data->CoreFrequency = freq_end;
       mdapi_data->CoreFrequencyChanged = freq_end != freq_start;
@@ -110,6 +114,7 @@ gen_perf_query_result_write_mdapi(void *data, uint32_t data_size,
          (result->slice_frequency[0] + result->slice_frequency[1]) / 2ULL;
       mdapi_data->UnsliceFrequency =
          (result->unslice_frequency[0] + result->unslice_frequency[1]) / 2ULL;
+      mdapi_data->SplitOccured = result->query_disjoint;
       return sizeof(*mdapi_data);
    }
    default: