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

2011-09-12 Thread Colin Guthrie
'Twas brillig, and Maarten Bosmans at 12/09/11 09:37 did gyre and gimble:
> 2011/9/1 Colin Guthrie :
 2) If we can eliminate this information from the main thread (empty
 brackets or just remove it altogether), that would reduce most of the
 log size increased by this patch.
>>>
>>> On point 2, do you mean "[pulseaudio] " should be better changed to
>>> "[] " or "" instead? I agree it's annoying to see lots of
>>> "pulseaudio" messages on the log.
>>>
>>> I can help to make our debugging life easier. :)
> 
> This still needs to be done.

Yup, it's in my branch for post-1.0 stuff. I didn't want to mess about
with thread related stuff until it's had a bit more testing.

>> Just so that work is not duplicated, this is the patch I currently have
>> in my "pending" tree for after we reopen master for general feature
>> improvements again.
> 
> What's up with the first hunk of thread.h?

It's very advanced C code. You wouldn't understand... it's not a typo...
honest. :p

(will remove it from my tree! - thanks for noticing).

> This approach is quite messy, with all the PA_INVALID_INDEX. I'd
> rather see the prototypes of pa_thread_* unchanged and just do a
> pa_sprintf_malloc in the calling code, where necessary.

Well would you do that all the time and pass in a non-const char* or
would you require the caller to free? If so then it's a little more work
for the caller to implement and thus it may not get done consistently.
At least if it's in the API it's quite consistent. I do agree tho', this
doing it client side would be more flexible overall, so I'm not against it.

I won't touch this patch until after 1.0, so feel free to make it super
awesome in the mean time :D

Col


-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]

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


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

2011-09-12 Thread Maarten Bosmans
2011/9/1 Colin Guthrie :
>>> 2) If we can eliminate this information from the main thread (empty
>>> brackets or just remove it altogether), that would reduce most of the
>>> log size increased by this patch.
>>
>> On point 2, do you mean "[pulseaudio] " should be better changed to
>> "[] " or "" instead? I agree it's annoying to see lots of
>> "pulseaudio" messages on the log.
>>
>> I can help to make our debugging life easier. :)

This still needs to be done.

> Just so that work is not duplicated, this is the patch I currently have
> in my "pending" tree for after we reopen master for general feature
> improvements again.

What's up with the first hunk of thread.h?

This approach is quite messy, with all the PA_INVALID_INDEX. I'd
rather see the prototypes of pa_thread_* unchanged and just do a
pa_sprintf_malloc in the calling code, where necessary.

> Col

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


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

2011-09-01 Thread Colin Guthrie
'Twas brillig, and Lu Guanqun at 01/09/11 03:16 did gyre and gimble:
> On Thu, Sep 01, 2011 at 09:53:34AM +0800, David Henningsson wrote:
>>> Hi Col,
>>>
>>> Do you think it's better to invoke pa_thread_new("alsa-sink 0", func, u)
>>> or adding another index after the plain name? (e.g.
>>> pa_thread_new("alsa-sink", index, func, u))
>>>
>>
>> Having seen this in action for a while I'd say I like the idea in
>> general, but I have a few things to wish for if possible:
> 
> Hi David,
> 
> Thanks for your suggestions.
> 
>>
>> 1) Yes, having "alsa-sink 0" (for whatever 0 means, sink index, module
>> index) is helpful, e g when you have four soundcards and get an
>> "Underrun from ALSA!" message and don't know what card that is. My
>> favorite would be if you can get the ALSA shortname in (e g "alsa-sink
>> SB" or "alsa-sink Headset") but I don't know if that's easy enough to do.
>>
>> 2) If we can eliminate this information from the main thread (empty
>> brackets or just remove it altogether), that would reduce most of the
>> log size increased by this patch.
> 
> On point 2, do you mean "[pulseaudio] " should be better changed to
> "[] " or "" instead? I agree it's annoying to see lots of
> "pulseaudio" messages on the log.
> 
> I can help to make our debugging life easier. :)

Just so that work is not duplicated, this is the patch I currently have
in my "pending" tree for after we reopen master for general feature
improvements again.

Col



-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]
>From 31d6aaeaadc6712b4f8c46152541f8168ca53fdc Mon Sep 17 00:00:00 2001
From: Colin Guthrie 
Date: Tue, 9 Aug 2011 15:52:57 +0200
Subject: [PATCH] thread: Add an optional index to the thread names.

This just allows us to differentiate between sinks/sources when
multiple alsa-sinks are loaded.
---
 src/modules/alsa/alsa-sink.c|2 +-
 src/modules/alsa/alsa-source.c  |2 +-
 src/modules/bluetooth/module-bluetooth-device.c |2 +-
 src/modules/jack/module-jack-sink.c |2 +-
 src/modules/jack/module-jack-source.c   |2 +-
 src/modules/macosx/module-coreaudio-device.c|2 +-
 src/modules/module-combine-sink.c   |2 +-
 src/modules/module-esound-sink.c|2 +-
 src/modules/module-null-sink.c  |2 +-
 src/modules/module-null-source.c|2 +-
 src/modules/module-pipe-sink.c  |2 +-
 src/modules/module-pipe-source.c|2 +-
 src/modules/module-sine-source.c|2 +-
 src/modules/module-solaris.c|2 +-
 src/modules/module-tunnel.c |   14 +-
 src/modules/module-waveout.c|2 +-
 src/modules/oss/module-oss.c|2 +-
 src/modules/raop/module-raop-sink.c |2 +-
 src/pulse/thread-mainloop.c |2 +-
 src/pulsecore/lock-autospawn.c  |2 +-
 src/pulsecore/thread-posix.c|   18 +-
 src/pulsecore/thread-win32.c|4 ++--
 src/pulsecore/thread.h  |6 +++---
 src/tests/asyncmsgq-test.c  |2 +-
 src/tests/asyncq-test.c |4 ++--
 src/tests/flist-test.c  |2 +-
 src/tests/lock-autospawn-test.c |8 
 src/tests/once-test.c   |2 +-
 src/tests/rtstutter.c   |2 +-
 src/tests/thread-test.c |2 +-
 30 files changed, 57 insertions(+), 45 deletions(-)

diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 2394455..c8ff27b 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -2224,7 +2224,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
 
 pa_alsa_dump(PA_LOG_DEBUG, u->pcm_handle);
 
-if (!(u->thread = pa_thread_new("alsa-sink", thread_func, u))) {
+if (!(u->thread = pa_thread_new("alsa-sink", u->sink->index, thread_func, u))) {
 pa_log("Failed to create thread.");
 goto fail;
 }
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index fa8d892..fb90dc8 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -1916,7 +1916,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
 
 pa_alsa_dump(PA_LOG_DEBUG, u->pcm_handle);
 
-if (!(u->thread = pa_thread_new("alsa-source", thread_func, u))) {
+if (!(u->thread = pa_thread_new("alsa-source", u->source->index, thread_func, u))) {
 pa_log("Failed to 

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

2011-08-31 Thread Lu Guanqun
On Thu, Sep 01, 2011 at 09:53:34AM +0800, David Henningsson wrote:
> > Hi Col,
> > 
> > Do you think it's better to invoke pa_thread_new("alsa-sink 0", func, u)
> > or adding another index after the plain name? (e.g.
> > pa_thread_new("alsa-sink", index, func, u))
> > 
> 
> Having seen this in action for a while I'd say I like the idea in
> general, but I have a few things to wish for if possible:

Hi David,

Thanks for your suggestions.

> 
> 1) Yes, having "alsa-sink 0" (for whatever 0 means, sink index, module
> index) is helpful, e g when you have four soundcards and get an
> "Underrun from ALSA!" message and don't know what card that is. My
> favorite would be if you can get the ALSA shortname in (e g "alsa-sink
> SB" or "alsa-sink Headset") but I don't know if that's easy enough to do.
> 
> 2) If we can eliminate this information from the main thread (empty
> brackets or just remove it altogether), that would reduce most of the
> log size increased by this patch.

On point 2, do you mean "[pulseaudio] " should be better changed to
"[] " or "" instead? I agree it's annoying to see lots of
"pulseaudio" messages on the log.

I can help to make our debugging life easier. :)

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


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

2011-08-31 Thread David Henningsson
2011-08-08 08:55, Lu Guanqun skrev:
> On Sat, Aug 06, 2011 at 07:10:16PM +0800, Colin Guthrie wrote:
>> 'Twas brillig, and Pierre-Louis Bossart at 05/08/11 16:24 did gyre and
>> gimble:
 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.
>>
>> Yup I agree (in an ideal world we'd name the thread by sink index too...
>> (i.e. "alsa-sink 0")
> 
> Hi Col,
> 
> Do you think it's better to invoke pa_thread_new("alsa-sink 0", func, u)
> or adding another index after the plain name? (e.g.
> pa_thread_new("alsa-sink", index, func, u))
> 

Having seen this in action for a while I'd say I like the idea in
general, but I have a few things to wish for if possible:

1) Yes, having "alsa-sink 0" (for whatever 0 means, sink index, module
index) is helpful, e g when you have four soundcards and get an
"Underrun from ALSA!" message and don't know what card that is. My
favorite would be if you can get the ALSA shortname in (e g "alsa-sink
SB" or "alsa-sink Headset") but I don't know if that's easy enough to do.

2) If we can eliminate this information from the main thread (empty
brackets or just remove it altogether), that would reduce most of the
log size increased by this patch.

-- 
David Henningsson, Canonical Ltd.
http://launchpad.net/~diwic
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


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

2011-08-09 Thread Colin Guthrie
'Twas brillig, and Pierre-Louis Bossart at 08/08/11 18:22 did gyre and
gimble:
>>> Do you think it's better to invoke pa_thread_new("alsa-sink 0", func,
>> u)
>>> or adding another index after the plain name? (e.g.
>>> pa_thread_new("alsa-sink", index, func, u))
>>
>> I've not looked at the code, but if we know the sink index by this
>> stage
>> (I'm not sure we do?) then yes that could be helpful.
>>
>> Pierre will probably know if this is practically useful tho'. I suppose
>> in most cases testing and probing will be done with only one sink
>> anyway
>> so there is no doubt which one owns the thread :p
> 
> I like the second option better. Ideally the index should match the sink
> index to that you can query with pactl which sink is really being used. The
> index in itself isn't terribly useful if it depends on the
> configuration/profiles.

Just for fun, I've implemented this approach. If there is some crazy
situation when multiple alsa sinks are used (perhaps involving bluetooth
connecting to an alsa sink which I know is supported), then this could
be useful.

Col

-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]

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


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

2011-08-08 Thread Pierre-Louis Bossart
> > Do you think it's better to invoke pa_thread_new("alsa-sink 0", func,
> u)
> > or adding another index after the plain name? (e.g.
> > pa_thread_new("alsa-sink", index, func, u))
> 
> I've not looked at the code, but if we know the sink index by this
> stage
> (I'm not sure we do?) then yes that could be helpful.
> 
> Pierre will probably know if this is practically useful tho'. I suppose
> in most cases testing and probing will be done with only one sink
> anyway
> so there is no doubt which one owns the thread :p

I like the second option better. Ideally the index should match the sink
index to that you can query with pactl which sink is really being used. The
index in itself isn't terribly useful if it depends on the
configuration/profiles.

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


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

2011-08-08 Thread Pierre-Louis Bossart
> How about the patch something like below? :) It displays the thread
> name instead of thread id.

Looks good. You may want to add a space for the last [%s]%s for
readability/parsing

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


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

2011-08-08 Thread Lu Guanqun
On Mon, Aug 08, 2011 at 03:38:48PM +0800, Colin Guthrie wrote:
> 'Twas brillig, and Lu Guanqun at 08/08/11 08:55 did gyre and gimble:
> > On Sat, Aug 06, 2011 at 07:10:16PM +0800, Colin Guthrie wrote:
> >> 'Twas brillig, and Pierre-Louis Bossart at 05/08/11 16:24 did gyre and
> >> gimble:
>  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.
> >>
> >> Yup I agree (in an ideal world we'd name the thread by sink index too...
> >> (i.e. "alsa-sink 0")
> > 
> > Hi Col,
> > 
> > Do you think it's better to invoke pa_thread_new("alsa-sink 0", func, u)
> > or adding another index after the plain name? (e.g.
> > pa_thread_new("alsa-sink", index, func, u))
> 
> I've not looked at the code, but if we know the sink index by this stage
> (I'm not sure we do?) then yes that could be helpful.

Not for now. at pa__init() stage, we don't know the module's index,
however, it can be supported via attached patch.

> 
> Pierre will probably know if this is practically useful tho'. I suppose
> in most cases testing and probing will be done with only one sink anyway
> so there is no doubt which one owns the thread :p

I'm justing looking around on this mailing list and would like to get my
hands dirty. :D So either way is OK for me.

-- 
guanqun
>From 524829788c5b5a9aa34986fbee163326f6f09267 Mon Sep 17 00:00:00 2001
From: Lu Guanqun 
Date: Mon, 8 Aug 2011 10:22:50 +0800
Subject: [PATCH] module: shuffle the sequence of acquiring the module index

With this change, we can get the module index in pa__init() function of a 
module.

Signed-off-by: Lu Guanqun 
---
 src/pulsecore/module.c |   10 +++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/pulsecore/module.c b/src/pulsecore/module.c
index 8b3ff8f..73f1208 100644
--- a/src/pulsecore/module.c
+++ b/src/pulsecore/module.c
@@ -64,6 +64,7 @@ pa_module* pa_module_load(pa_core *c, const char *name, const 
char *argument) {
 m->argument = pa_xstrdup(argument);
 m->load_once = FALSE;
 m->proplist = pa_proplist_new();
+m->index = PA_IDXSET_INVALID;
 
 if (!(m->dl = lt_dlopenext(name))) {
 pa_log("Failed to open module \"%s\": %s", name, lt_dlerror());
@@ -106,14 +107,14 @@ pa_module* pa_module_load(pa_core *c, const char *name, 
const char *argument) {
 m->core = c;
 m->unload_requested = FALSE;
 
+pa_assert_se(pa_idxset_put(c->modules, m, &m->index) >= 0);
+pa_assert(m->index != PA_IDXSET_INVALID);
+
 if (m->init(m) < 0) {
 pa_log_error("Failed to load module \"%s\" (argument: \"%s\"): 
initialization failed.", name, argument ? argument : "");
 goto fail;
 }
 
-pa_assert_se(pa_idxset_put(c->modules, m, &m->index) >= 0);
-pa_assert(m->index != PA_IDXSET_INVALID);
-
 pa_log_info("Loaded \"%s\" (index: #%u; argument: \"%s\").", m->name, 
m->index, m->argument ? m->argument : "");
 
 pa_subscription_post(c, 
PA_SUBSCRIPTION_EVENT_MODULE|PA_SUBSCRIPTION_EVENT_NEW, m->index);
@@ -137,6 +138,9 @@ pa_module* pa_module_load(pa_core *c, const char *name, 
const char *argument) {
 fail:
 
 if (m) {
+if (m->index != PA_IDXSET_INVALID)
+pa_idxset_remove_by_index(c->modules, m->index);
+
 if (m->proplist)
 pa_proplist_free(m->proplist);
 
-- 
1.7.6

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


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

2011-08-08 Thread Colin Guthrie
'Twas brillig, and Lu Guanqun at 08/08/11 08:55 did gyre and gimble:
> On Sat, Aug 06, 2011 at 07:10:16PM +0800, Colin Guthrie wrote:
>> 'Twas brillig, and Pierre-Louis Bossart at 05/08/11 16:24 did gyre and
>> gimble:
 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.
>>
>> Yup I agree (in an ideal world we'd name the thread by sink index too...
>> (i.e. "alsa-sink 0")
> 
> Hi Col,
> 
> Do you think it's better to invoke pa_thread_new("alsa-sink 0", func, u)
> or adding another index after the plain name? (e.g.
> pa_thread_new("alsa-sink", index, func, u))

I've not looked at the code, but if we know the sink index by this stage
(I'm not sure we do?) then yes that could be helpful.

Pierre will probably know if this is practically useful tho'. I suppose
in most cases testing and probing will be done with only one sink anyway
so there is no doubt which one owns the thread :p

Col

-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


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

2011-08-07 Thread Lu Guanqun
On Sat, Aug 06, 2011 at 07:10:16PM +0800, Colin Guthrie wrote:
> 'Twas brillig, and Pierre-Louis Bossart at 05/08/11 16:24 did gyre and
> gimble:
> >> 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.
> 
> Yup I agree (in an ideal world we'd name the thread by sink index too...
> (i.e. "alsa-sink 0")

Hi Col,

Do you think it's better to invoke pa_thread_new("alsa-sink 0", func, u)
or adding another index after the plain name? (e.g.
pa_thread_new("alsa-sink", index, func, u))

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


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

2011-08-07 Thread Lu Guanqun
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 
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 
---
 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


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

2011-08-06 Thread Colin Guthrie
'Twas brillig, and Pierre-Louis Bossart at 05/08/11 16:24 did gyre and
gimble:
>> 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.

Yup I agree (in an ideal world we'd name the thread by sink index too...
(i.e. "alsa-sink 0")


Col

-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]

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


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

2011-08-05 Thread Pierre-Louis Bossart
> 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

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


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

2011-08-04 Thread wangxingchao2011
From: xingchao 

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

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