[lttng-dev] [RFC PATCH 0/2] Identify UST threads by changing thread names
Mathieu Desnoyers
mathieu.desnoyers at efficios.com
Fri Jun 3 06:18:19 UTC 2016
----- On Jun 3, 2016, at 8:11 AM, Jeremie Galarneau jeremie.galarneau at efficios.com wrote:
> And, of course, I forget to add Mathieu in CC... Coffee time!
>
> Jérémie
>
> On Fri, Jun 3, 2016 at 2:10 AM, Jérémie Galarneau
> <jeremie.galarneau at efficios.com> wrote:
>> Hi Raphaël,
>>
>> Adding Mathieu in CC. Please make sure you CC the maintainers when
>> submitting a patch.
>>
>> Regards,
>> Jérémie
>>
>> On Wed, Jun 1, 2016 at 11:04 AM, Raphaël Beamonte
>> <raphael.beamonte at gmail.com> wrote:
>>> Hi,
>>>
>>> I did not get any feedback about this, any thoughts ?
>>>
>>> Thanks,
>>> Raphaël
>>>
>>> 2016-04-21 16:50 GMT-04:00 Raphaël Beamonte <raphael.beamonte at gmail.com>:
>>>> Hi,
>>>>
>>>> This is an RFC patch for comments and ideas about how this should be
>>>> done. In recent work I've been doing, I found out that some UST-
>>>> instrumented userspace process was preempting itself. Looking further,
>>>> it was not the same TID, but the same process name. These processes
>>>> were LTTng-UST listener threads, but were not identified as so.
>>>> Adding a simple symbol, such as "-ust" or "-lttng" at the end of the
>>>> process name would help to identify such process directly in the
>>>> generated trace.
>>>>
>>>> You'll find below two different implementations with their pros
>>>> and cons, for which the "-ust" symbol was choosen:
>>>>
>>>>
>>>> 1/ An implementation using prctl
>>>> It works properly on Linux, but I didn't find a way to make
>>>> it work under FreeBSD, hence the empty function in FreeBSD
>>>> case (keeping the situation as it is now).
>>>>
>>>> Raphaël Beamonte (1):
>>>> Add -ust to the name of UST threads of the application
>>>>
>>>> liblttng-ust/compat.h | 22 ++++++++++++++++++++++
>>>> liblttng-ust/lttng-ust-comm.c | 2 ++
>>>> 2 files changed, 24 insertions(+)
>>>>
>>>>
>>>>
>>>> 2/ An implementation using pthread
>>>> It works on both Linux and FreeBSD, but requires to add a
>>>> link to the pthread library in liblttng-ust Makefile.am.
>>>> Also, this approach relies on the presence of the
>>>> pthread_setname_np function, which was included in glibc
>>>> 2.12, meaning it will not work with older versions (but
>>>> this should not be a problem?)
lttng-ust already uses libc for mutexes and other. So I don't see why
you have to _add_ any explicit dependency there.
About the glibc version, we should use autotools to detect the
features supported by the system libc, and pass a config define
to the source code, so we can use the glibc pthread_setname_np
if available, else we keep the current behavior.
Thoughts ?
Thanks,
Mathieu
>>>>
>>>> Raphaël Beamonte (1):
>>>> Add -ust to the name of UST threads of the application
>>>>
>>>> liblttng-ust/Makefile.am | 1 +
>>>> liblttng-ust/compat.h | 35 +++++++++++++++++++++++++++++++++++
>>>> liblttng-ust/lttng-ust-comm.c | 2 ++
>>>> 3 files changed, 38 insertions(+)
>>>>
>>>>
>>>>
>>>> I'll wait for your comments and ideas on that subject.
>>>>
>>>> Thanks,
>>>> Raphaël
>>>>
>>>>
>>>> --
>>>> 2.1.4
>>>>
>>> _______________________________________________
>>> lttng-dev mailing list
>>> lttng-dev at lists.lttng.org
>>> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
>>
>>
>>
>> --
>> Jérémie Galarneau
>> EfficiOS Inc.
>> http://www.efficios.com
>
>
>
> --
> Jérémie Galarneau
> EfficiOS Inc.
> http://www.efficios.com
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
More information about the lttng-dev
mailing list