summaryrefslogtreecommitdiff
path: root/lib/igt_core.c
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2019-10-14 18:02:25 +0300
committerVille Syrjälä <ville.syrjala@linux.intel.com>2019-10-18 17:33:08 +0300
commit0035bff08078a444d4572ba2eaf79523dc885857 (patch)
treea1b5af5be8fa144244d13592cec6d7e0e813e31c /lib/igt_core.c
parentbb5735423eaf6fdbf6b2f94ef0b8520e74eab993 (diff)
lib: Add igt_trace()
Add igt_trace() which can be used to inject messages into the kernel ftrace buffer via the trace_marker file. Quite useful when trying to correlate test case activity with kernel tracepoints. v2: Use igt_debugfs_mount() (Chris) Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Diffstat (limited to 'lib/igt_core.c')
-rw-r--r--lib/igt_core.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/igt_core.c b/lib/igt_core.c
index 940913c1..7bd5afa5 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -421,6 +421,26 @@ void igt_kmsg(const char *format, ...)
fclose(file);
}
+void igt_trace(const char *format, ...)
+{
+ char path[128];
+ va_list ap;
+ FILE *file;
+
+ snprintf(path, sizeof(path), "%s/tracing/trace_marker",
+ igt_debugfs_mount());
+
+ file = fopen(path, "w");
+ if (file == NULL)
+ return;
+
+ va_start(ap, format);
+ vfprintf(file, format, ap);
+ va_end(ap);
+
+ fclose(file);
+}
+
#define time_valid(ts) ((ts)->tv_sec || (ts)->tv_nsec)
double igt_time_elapsed(struct timespec *then,