Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: David.OShea@quantum.com (David OShea)
Subject: [lttng-dev] Wrong procname for userspace trace of app with different thread names
Date: Wed, 24 Oct 2012 03:58:59 +0000	[thread overview]
Message-ID: <20998D40D9A2B7499CA5A3A2666CB1EB19F7CBC4@ZURMSG1.QUANTUM.com> (raw)

Hi all,

I performed a userspace trace of a multi-threaded application that uses prctl(PR_SET_NAME, ...) to give its threads names.  From the output of 'lttng view' below (I removed timestamps to make it shorter), it appears that UST is populating the "procname" by getting the process/thread name from the first thread it sees for a given PID, then assuming that name applies to all threads in the process:

mydaemon:22593 mydaemon:start: { <cpu_id> }, { pthread_id = 1496398144, procname = "mythread31", vtid = 22761, vpid = 22593 }, { <payload> }
mydaemon:22593 mydaemon:end: { <cpu_id> }, { pthread_id = 1496398144, procname = "mythread31", vtid = 22761, vpid = 22593 }, { <payload> }
myclient:28277 myclient:end: { <cpu_id> }, { pthread_id = 47216641758592, vtid = 28277, vpid = 28277, procname = "myclient" }, { <payload> }
myclient:28277 myclient:start: { <cpu_id> }, { pthread_id = 47216641758592, vtid = 28277, vpid = 28277, procname = "myclient" }, { <payload> }
mydaemon:22593 mydaemon:start: { <cpu_id> }, { pthread_id = 1485908288, procname = "mythread31", vtid = 22760, vpid = 22593 }, { <payload> }

On the first line, the procname contains the thread name for vtid = 22761.  On the last line, the procname is still shown as "mythread31", but the vtid is different, and I can see from /proc/22593/task/22760/stat that the thread's name is "mythread30".  However, the <process name>:<PID> at the start of each line - the pair before the <trace provider>:<tracepoint name> - does show the actual process name rather than any thread name.

I'm using LTTng 2.0.4 and babeltrace 1.0.0.rc5.  I set up my trace using these steps:

lttng create
lttng enable-channel channel0 --userspace
lttng add-context --userspace -t vpid -t vtid -t procname -t pthread_id
lttng enable-event --userspace --all

It would be great if "procname" was replaced by "threadname" and showed each thread's name correctly, since the process's name is already shown, but the thread names would be very useful.  Otherwise, at the very least, "procname" should probably show the same thing that is shown at the start of the line rather than incorrectly using the name of one of the threads.

Incidentally, why do I have to do "enable-channel" to get the context to actually appear?  If I don't do this, the "add-context" still says that each of the four contexts was "added to all channels", but they don't appear in 'lttng view'.

Thanks in advance,
David

----------------------------------------------------------------------
The information contained in this transmission may be confidential. Any disclosure, copying, or further distribution of confidential information is not permitted unless such privilege is explicitly granted in writing by Quantum. Quantum reserves the right to have electronic communications, including email and attachments, sent across its networks filtered through anti virus and spam software programs and retain such messages in order to comply with applicable data security and retention requirements. Quantum is not responsible for the proper and complete transmission of the substance of this communication or for any delay in its receipt.



             reply	other threads:[~2012-10-24  3:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-24  3:58 David OShea [this message]
2012-10-24 12:32 ` Mathieu Desnoyers
2012-10-24 12:35   ` Mathieu Desnoyers
2012-10-24 13:06     ` Mathieu Desnoyers
2012-10-25  4:07       ` David OShea

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20998D40D9A2B7499CA5A3A2666CB1EB19F7CBC4@ZURMSG1.QUANTUM.com \
    --to=david.oshea@quantum.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox