[pulseaudio-discuss] [PATCH 04/25] printout pthread id number in pulseaudio log

wangxingchao2011 at gmail.com wangxingchao2011 at gmail.com
Fri Aug 5 10:21:28 PDT 2011


From: xingchao <xingchao.wang at intel.com>

there're multiple pthreads in pulseuadio, which makes reading a bit confuse.
this patch can print each pthread's id.
---
 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 b12cbf0..3d8710a 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), "[pid:%lu][ptid:%u][%s:%i %s()] ",(unsigned long)getpid(), (unsigned int)pthread_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), "[pid:%lu][ptid:%u]%s: ", (unsigned long)getpid(),(unsigned int)pthread_self(),pa_path_get_filename(file));
     else
         location[0] = 0;
 
-- 
1.7.1



More information about the pulseaudio-discuss mailing list