public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Kamil Konieczny <kamil.konieczny@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 3/7] lib/igt_core: add prefix to logging
Date: Fri,  2 Dec 2022 21:57:01 +0100	[thread overview]
Message-ID: <20221202205705.58879-4-kamil.konieczny@linux.intel.com> (raw)
In-Reply-To: <20221202205705.58879-1-kamil.konieczny@linux.intel.com>

Allow to store prefix for logs and print it before any message.
This will allow to diagnose on wich GPU occurred problems when
tested on multi-GPU machines.

Signed-off-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
---
 lib/igt_core.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/igt_core.c b/lib/igt_core.c
index 68ae7289..65b7be64 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -348,6 +348,8 @@ static struct {
 	uint8_t start, end;
 } log_buffer;
 static pthread_mutex_t log_buffer_mutex = PTHREAD_MUTEX_INITIALIZER;
+#define LOG_PREFIX_SIZE 32
+char log_prefix[LOG_PREFIX_SIZE] = { 0 };
 
 GKeyFile *igt_key_file;
 
@@ -3105,8 +3107,12 @@ void igt_vlog(const char *domain, enum igt_log_level level, const char *format,
 	program_name = command_str;
 #endif
 
-	if (asprintf(&thread_id, "[thread:%d] ", gettid()) == -1)
-		thread_id = NULL;
+	if (igt_thread_is_main()) {
+		thread_id = strdup(log_prefix);
+	} else {
+		if (asprintf(&thread_id, "%s[thread:%d] ", log_prefix, gettid()) == -1)
+			thread_id = NULL;
+	}
 
 	if (!thread_id)
 		return;
-- 
2.34.1

  parent reply	other threads:[~2022-12-02 20:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20221202205705.58879-1-kamil.konieczny@linux.intel.com>
2022-12-02 20:57 ` [igt-dev] [PATCH i-g-t 2/7] lib/igt_core: store GPU string or opened device name Kamil Konieczny
2022-12-07 10:32   ` Petri Latvala
2022-12-02 20:57 ` Kamil Konieczny [this message]
2022-12-05  6:12   ` [igt-dev] [PATCH i-g-t 3/7] lib/igt_core: add prefix to logging Mauro Carvalho Chehab
2022-12-02 20:57 ` [igt-dev] [PATCH i-g-t 4/7] lib/tests/igt_fork: add tests for igt_multi_fork Kamil Konieczny
2022-12-05  6:15   ` Mauro Carvalho Chehab
2022-12-02 20:57 ` [igt-dev] [PATCH i-g-t 6/7] tests/i915/gem_exec_gttfill: add new subtest multigpu-basic Kamil Konieczny
2022-12-05  6:28   ` Mauro Carvalho Chehab
2022-12-02 20:57 ` [igt-dev] [PATCH i-g-t 7/7] tests/i915/gem_close_race: add multiGPU subtests Kamil Konieczny
2022-12-05  6:30   ` Mauro Carvalho Chehab
2022-12-02 21:38 ` [igt-dev] ✗ Fi.CI.BAT: failure for Add few multi-GPU subtests with the help of igt_multi_fork macro Patchwork
2022-12-05 14:33   ` Kamil Konieczny
     [not found] ` <20221202205705.58879-6-kamil.konieczny@linux.intel.com>
2022-12-05  6:10   ` [igt-dev] [PATCH i-g-t 5/7] tests/i915/gem_basic: add multigpu-create-close subtest Mauro Carvalho Chehab
     [not found] ` <20221202205705.58879-2-kamil.konieczny@linux.intel.com>
2022-12-05  6:32   ` [igt-dev] [PATCH i-g-t 1/7] lib/igt_core: add igt_multi_fork for parallel tests Mauro Carvalho Chehab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221202205705.58879-4-kamil.konieczny@linux.intel.com \
    --to=kamil.konieczny@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox