From: Steven Rostedt <rostedt@goodmis.org>
To: Joel Fernandes <joelaf@google.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RFC] adding of TGID to ftrace output
Date: Wed, 10 May 2017 21:28:09 -0400 [thread overview]
Message-ID: <20170510212809.1d1cd9a7@grimm.local.home> (raw)
In-Reply-To: <CAJWu+ooo0YSxm5w64txV=s0fOVXW_UXWKs783eQpGTBjaDUQNA@mail.gmail.com>
On Wed, 10 May 2017 16:04:55 -0700
Joel Fernandes <joelaf@google.com> wrote:
> Hi Steven,
>
> Can we add TGID information along with PID to ftrace output?
>
> Something like:
> # _-----=> irqs-off
> # / _----=> need-resched
> # | / _---=> hardirq/softirq
> # || / _--=> preempt-depth
> # ||| / delay
> # TASK-PID:TGID CPU# |||| TIMESTAMP FUNCTION
> # | | | | |||| | |
> bash-1977:1977 [000] .... 17284.993652: sys_close <-
>
> Instead of:
> # _-----=> irqs-off
> # / _----=> need-resched
> # | / _---=> hardirq/softirq
> # || / _--=> preempt-depth
> # ||| / delay
> # TASK-PID CPU# |||| TIMESTAMP FUNCTION
> # | | | |||| | |
> bash-1977 [000] .... 17284.993652: sys_close <-
Well the thing about this is that it adds more overhead to each event
that is mostly not needed by users.
>
> Currently in android, we inject tgid into each trace event at the end
> of the trace just so we can group threads under a process in our trace
> viewer.
>
> The other option we're thinking off is we can retrieve tgid during the
> trace output (reading trace file from debugfs/tracefs) from the
> task_struct and then have ftrace output it that way.
Hmm, is there any events that show the TGID currently? If we have that,
you can use another tracing instance to read from (one that wont get
overridden by other events), and keep track of what TGID processes
have. The timestamp could be used to keep everything in sync.
>
> Anyway, having this will really simplify things and make it more
> reliable (we run ps -T at the end of the trace right now, but its
> unreliable because threads might have exited by then). We also have to
> call getpid() and inject pid into each userspace trace_marker write
> just so we can do this grouping.
Perhaps we need to have a way to record it via another event. Fork or
sched switch?
Perhaps we can add a trigger to record extra data like this, similar to
the stack trace trigger does now.
Also, you could add a kprobe at sched switch or something to possibly
record this.
-- Steve
next prev parent reply other threads:[~2017-05-11 1:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-10 23:04 Joel Fernandes
2017-05-11 1:28 ` Steven Rostedt [this message]
2017-05-11 3:10 ` Joel Fernandes
2017-05-11 14:23 ` Steven Rostedt
2017-05-11 18:57 ` Joel Fernandes
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=20170510212809.1d1cd9a7@grimm.local.home \
--to=rostedt@goodmis.org \
--cc=joelaf@google.com \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®