[lttng-dev] Log semaphore, mutex in CTF

Matthew Khouzam matthew.khouzam at ericsson.com
Wed Jul 3 13:07:17 EDT 2019


Trying a reply as the ML seems to have had an issue.

________________________________
From: Matthew Khouzam
Sent: Tuesday, July 2, 2019 10:26:05 AM
To: Jonathan Rajotte-Julien; Zvi Vered
Cc: lttng-dev
Subject: Re: [lttng-dev] Log semaphore, mutex in CTF


Please correct me if I'm wrong, I'm waaay out of my comfort zone here...


So I am assuming you are doing kernel tracing. If it's userspace tracing, you need to wrap the library yourself. I don't know how recommendable it is, you may incur some performance impact.


In Linux, mutexes/semaphores are atomic and not logged, unless there is contention on the resource. You can see this as a "sys_futex" so look up "utex" and you should be good.


Also, if you keep your trace in CTF, certain trace viewers can show your contention between threads[1].


Br,

Matthew


[1] https://wiki.eclipse.org/Trace_Compass/News/NewIn23



________________________________
From: lttng-dev <lttng-dev-bounces at lists.lttng.org> on behalf of Jonathan Rajotte-Julien <jonathan.rajotte-julien at efficios.com>
Sent: Tuesday, July 2, 2019 10:15:17 AM
To: Zvi Vered
Cc: lttng-dev
Subject: Re: [lttng-dev] Log semaphore, mutex in CTF

HI Zvika,

It all depends on what exactly you traced. Did you trace some userspace
application? Did you trace the kernel?

A trace is as good as its tracepoints. You can use lttng list to get the
available tracepoints for each tracing domain:

>From "lttng-list" man page:

  With one or more of the --kernel, --userspace, --jul, --log4j, and --python
  domain options, the command lists the available event sources of the selected
  domain on the system. The JUL, log4j, and Python domains list the names of their
  available loggers. The --syscall option can be used alongside the --kernel
  option to get a list of traceable Linux system calls. The --fields option can be
  used to show the fields of the listed event sources.

AFAIK, lttng-modules does not instrument locking primitive.

lttng-ust does provides overwrite library for pthread_mutex_lock,
pthread_mutex_trylock and pthread_mutex_unlock. You will need to LD_PRELOAD (application start) it.

https://protect2.fireeye.com/url?k=d4352e55-88e124c9-d4356ece-8631fc8bdea5-87f781b0b8299b36&q=1&u=https%3A%2F%2Fgithub.com%2Flttng%2Flttng-ust%2Ftree%2F9d4d2a639afc19a1bd705ea560782917ac892596%2Fliblttng-ust-libc-wrapper

Cheers.

On Mon, Jul 01, 2019 at 07:49:16AM +0300, Zvi Vered wrote:
> Hello,
>
> I converted CTF files created by ltt-ng to text file using babeltrace.
>
> Can you please tell how semaphore, mutex are logged in this text file ?
>
> I did not find the terms "sema" or "mutex".
>
> Thank you,
> Zvika

> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> https://protect2.fireeye.com/url?k=ef7159f6-b3a5536a-ef71196d-8631fc8bdea5-094f48839611091d&q=1&u=https%3A%2F%2Flists.lttng.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Flttng-dev


--
Jonathan Rajotte-Julien
EfficiOS
_______________________________________________
lttng-dev mailing list
lttng-dev at lists.lttng.org
https://protect2.fireeye.com/url?k=9cb6213c-c0622ba0-9cb661a7-8631fc8bdea5-60f0dcbb0316005d&q=1&u=https%3A%2F%2Flists.lttng.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Flttng-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.lttng.org/pipermail/lttng-dev/attachments/20190703/a4f71e5f/attachment.html>


More information about the lttng-dev mailing list