Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] core: add timestamps to logs
@ 2026-05-05 14:46 Andrzej Hajda
  2026-05-05 18:23 ` ✗ Xe.CI.BAT: failure for " Patchwork
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Andrzej Hajda @ 2026-05-05 14:46 UTC (permalink / raw)
  To: igt-dev; +Cc: Kamil Konieczny, Ryszard Knop, Stuart Summers, Andrzej Hajda

IGT tests run often time consuming tasks. Timestamps should simplify
time analysis and matching with kernel logs.
Since IGT is closely connected with the kernel let's use the same format.

Signed-off-by: Andrzej Hajda <andrzej.hajda@intel.com>
---
 lib/igt_core.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/lib/igt_core.c b/lib/igt_core.c
index 4f79c02948ab..e11b181e7a82 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -3227,10 +3227,15 @@ void igt_vlog(const char *domain, enum igt_log_level level, const char *format,
 		formatted_line = strdup(line);
 		if (!formatted_line)
 			goto out;
-	} else if (asprintf(&formatted_line, "(%s:%d) %s%s%s%s: %s", program_name,
-		     getpid(), thread_id, (domain) ? domain : "", (domain) ? "-" : "",
-		     igt_log_level_str[level], line) == -1) {
-		goto out;
+	} else {
+		struct timespec ts;
+
+		igt_gettime(&ts);
+		if (asprintf(&formatted_line, "[%5ld.%06ld] (%s:%d) %s%s%s%s: %s", (long)ts.tv_sec,
+			     ts.tv_nsec / 1000, program_name, getpid(), thread_id,
+			     (domain) ? domain : "", (domain) ? "-" : "", igt_log_level_str[level],
+			     line) == -1)
+			goto out;
 	}
 
 	if (line[strlen(line) - 1] == '\n')

---
base-commit: 8eb6e58f00d39b3bb79ffc501eb020b36c8f8c31
change-id: 20260430-add_timestamps_to_logs-d84fdfd7ef4c

Best regards,
--  
Andrzej Hajda <andrzej.hajda@intel.com>


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-05-06 15:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-05 14:46 [PATCH] core: add timestamps to logs Andrzej Hajda
2026-05-05 18:23 ` ✗ Xe.CI.BAT: failure for " Patchwork
2026-05-05 18:48 ` ✗ i915.CI.BAT: " Patchwork
2026-05-06  2:37 ` ✗ Xe.CI.FULL: " Patchwork
2026-05-06 14:25 ` [PATCH] " Kamil Konieczny
2026-05-06 15:09   ` Hajda, Andrzej

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox