On Fri, Aug 05, 2011 at 10:24:17PM +0800, Pierre-Louis Bossart wrote:
> > there're multiple pthreads in pulseuadio, which makes reading a bit
> > confuse.
> > this patch can print each pthread's id.
> 
> Wouldn't it be easier to understand if the thread name was used? We
> typically rely on thread names to understand what goes on with
> ftrace/pytimechart, I would think this is similar here. I would rather see a
> log with "alsa-sink" rather than "PID 6779", it'd also make log comparison
> and analysis easier.
> -Pierre

How about the patch something like below? :) It displays the thread name
instead of thread id.

> 
> _______________________________________________
> pulseaudio-discuss mailing list
> pulseaudio-discuss@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
>From 25659dfbd3fa8a77bd9d015235817595a2fe1ac1 Mon Sep 17 00:00:00 2001
From: Lu Guanqun <guanqun...@intel.com>
Date: Mon, 8 Aug 2011 10:24:13 +0800
Subject: [PATCH] log: add thread name

This patch displays thread name in the log, that would be more descriptive.
It improves Xingchao (xingchao.w...@intel.com)'s patch which shows thread id.

Signed-off-by: Lu Guanqun <guanqun...@intel.com>
---
 src/pulsecore/log.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/pulsecore/log.c b/src/pulsecore/log.c
index 1303814..a5a9162 100644
--- a/src/pulsecore/log.c
+++ b/src/pulsecore/log.c
@@ -302,9 +302,9 @@ void pa_log_levelv_meta(
     pa_vsnprintf(text, sizeof(text), format, ap);
 
     if ((_flags & PA_LOG_PRINT_META) && file && line > 0 && func)
-        pa_snprintf(location, sizeof(location), "[%s:%i %s()] ", file, line, 
func);
+        pa_snprintf(location, sizeof(location), "[%s][%s:%i %s()] ", 
pa_thread_get_name(pa_thread_self()), file, line, func);
     else if ((_flags & (PA_LOG_PRINT_META|PA_LOG_PRINT_FILE)) && file)
-        pa_snprintf(location, sizeof(location), "%s: ", 
pa_path_get_filename(file));
+        pa_snprintf(location, sizeof(location), "[%s]%s: ", 
pa_thread_get_name(pa_thread_self()), pa_path_get_filename(file));
     else
         location[0] = 0;
 
-- 
1.7.6

_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss

Reply via email to