[igt-dev] [PATCH i-g-t v2 22/28] tools/i915-perf: printout CPU clock used

Umesh Nerlige Ramappa umesh.nerlige.ramappa at intel.com
Thu Oct 27 20:55:29 UTC 2022


From: Lionel Landwerlin <lionel.g.landwerlin at intel.com>

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa at intel.com>
---
 tools/i915-perf/i915_perf_recorder.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/tools/i915-perf/i915_perf_recorder.c b/tools/i915-perf/i915_perf_recorder.c
index 72011c87..f8f9b737 100644
--- a/tools/i915-perf/i915_perf_recorder.c
+++ b/tools/i915-perf/i915_perf_recorder.c
@@ -588,6 +588,17 @@ static uint64_t timespec_diff(struct timespec *begin,
 
 static clock_t correlation_clock_id = CLOCK_MONOTONIC;
 
+static const char *
+get_correlation_clock_name(clock_t clock_id)
+{
+  switch (clock_id) {
+  case CLOCK_BOOTTIME:      return "bootime";
+  case CLOCK_MONOTONIC:     return "monotonic";
+  case CLOCK_MONOTONIC_RAW: return "monotonic_raw";
+  default:                  return "*unknown*";
+  }
+}
+
 static bool
 get_correlation_timestamps(struct intel_perf_record_timestamp_correlation *corr, int drm_fd)
 {
@@ -1069,6 +1080,9 @@ main(int argc, char *argv[])
 		goto fail;
 	}
 
+	fprintf(stdout, "Using correlation clock: %s\n",
+		get_correlation_clock_name(correlation_clock_id));
+
 	ctx.oa_exponent = oa_exponent_for_period(ctx.oa_timestamp_frequency, perf_period);
 	fprintf(stdout, "Opening perf stream with metric_id=%"PRIu64" oa_exponent=%u oa_format=%u\n",
 		ctx.metric_set->perf_oa_metrics_set, ctx.oa_exponent,
-- 
2.25.1



More information about the igt-dev mailing list