linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* pref record question
@ 2009-10-19 17:04 Tim Blechmann
  2009-10-20  4:26 ` Peter Zijlstra
  0 siblings, 1 reply; 5+ messages in thread
From: Tim Blechmann @ 2009-10-19 17:04 UTC (permalink / raw)
  To: linux-kernel, mingo

[-- Attachment #1: Type: text/plain, Size: 534 bytes --]

i am trying to do some profiling with perf (2.6.31.4). while
thread-level profiling works fine, i haven't been able to record
profiling data of a whole process (i.e. main thread + child threads).
from my understanding, this should be enabled by running 'perf record
-i' on the main thread. this does only collect the data from the main
thread, though.

is this an issue with perf or with my understanding of perf?

thanks, tim

-- 
tim@klingt.org
http://tim.klingt.org

art is short - life is long
  Jack Kerouac



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: pref record question
  2009-10-19 17:04 pref record question Tim Blechmann
@ 2009-10-20  4:26 ` Peter Zijlstra
  2009-10-20  6:00   ` Ingo Molnar
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Zijlstra @ 2009-10-20  4:26 UTC (permalink / raw)
  To: Tim Blechmann; +Cc: linux-kernel, mingo

On Mon, 2009-10-19 at 19:04 +0200, Tim Blechmann wrote:
> i am trying to do some profiling with perf (2.6.31.4). while
> thread-level profiling works fine, i haven't been able to record
> profiling data of a whole process (i.e. main thread + child threads).
> from my understanding, this should be enabled by running 'perf record
> -i' on the main thread. this does only collect the data from the main
> thread, though.
> 
> is this an issue with perf or with my understanding of perf?

-i will only inherit the counters on new fork()/clone() calls, so an
existing process/task tree will not automagically get the counters.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: pref record question
  2009-10-20  4:26 ` Peter Zijlstra
@ 2009-10-20  6:00   ` Ingo Molnar
  2009-10-20  9:19     ` Peter Zijlstra
  0 siblings, 1 reply; 5+ messages in thread
From: Ingo Molnar @ 2009-10-20  6:00 UTC (permalink / raw)
  To: Peter Zijlstra, Arnaldo Carvalho de Melo, Mike Galbraith,
	Frédéric Weisbecker
  Cc: Tim Blechmann, linux-kernel


* Peter Zijlstra <peterz@infradead.org> wrote:

> On Mon, 2009-10-19 at 19:04 +0200, Tim Blechmann wrote:
>
> > i am trying to do some profiling with perf (2.6.31.4). while 
> > thread-level profiling works fine, i haven't been able to record 
> > profiling data of a whole process (i.e. main thread + child 
> > threads). from my understanding, this should be enabled by running 
> > 'perf record -i' on the main thread. this does only collect the data 
> > from the main thread, though.
> > 
> > is this an issue with perf or with my understanding of perf?
> 
> -i will only inherit the counters on new fork()/clone() calls, so an 
> existing process/task tree will not automagically get the counters.

Looks like something very much worth fixing.

	Ingo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: pref record question
  2009-10-20  6:00   ` Ingo Molnar
@ 2009-10-20  9:19     ` Peter Zijlstra
  2009-10-20 12:46       ` Ingo Molnar
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Zijlstra @ 2009-10-20  9:19 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Arnaldo Carvalho de Melo, Mike Galbraith,
	Frédéric Weisbecker, Tim Blechmann, linux-kernel

On Tue, 2009-10-20 at 08:00 +0200, Ingo Molnar wrote:
> * Peter Zijlstra <peterz@infradead.org> wrote:
> 
> > On Mon, 2009-10-19 at 19:04 +0200, Tim Blechmann wrote:
> >
> > > i am trying to do some profiling with perf (2.6.31.4). while 
> > > thread-level profiling works fine, i haven't been able to record 
> > > profiling data of a whole process (i.e. main thread + child 
> > > threads). from my understanding, this should be enabled by running 
> > > 'perf record -i' on the main thread. this does only collect the data 
> > > from the main thread, though.
> > > 
> > > is this an issue with perf or with my understanding of perf?
> > 
> > -i will only inherit the counters on new fork()/clone() calls, so an 
> > existing process/task tree will not automagically get the counters.
> 
> Looks like something very much worth fixing.

Well, maybe.

There's two ways to go about this, either iterate the tasks in userspace
and attach a counter to each one (repeat until there's no new ones
left).

Or add a new flag in perf_event_attr to iterate the tasks on attach in
an atomic manner.

We cannot simply extend the current attach behaviour as that would make
it impossible to attach to a single thread in a thread group.

Also, if you extend the interface, it would make sense to allow
automatically attaching to a process group, not only a thread group,
etc.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: pref record question
  2009-10-20  9:19     ` Peter Zijlstra
@ 2009-10-20 12:46       ` Ingo Molnar
  0 siblings, 0 replies; 5+ messages in thread
From: Ingo Molnar @ 2009-10-20 12:46 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Arnaldo Carvalho de Melo, Mike Galbraith,
	Frédéric Weisbecker, Tim Blechmann, linux-kernel


* Peter Zijlstra <peterz@infradead.org> wrote:

> On Tue, 2009-10-20 at 08:00 +0200, Ingo Molnar wrote:
> > * Peter Zijlstra <peterz@infradead.org> wrote:
> > 
> > > On Mon, 2009-10-19 at 19:04 +0200, Tim Blechmann wrote:
> > >
> > > > i am trying to do some profiling with perf (2.6.31.4). while 
> > > > thread-level profiling works fine, i haven't been able to record 
> > > > profiling data of a whole process (i.e. main thread + child 
> > > > threads). from my understanding, this should be enabled by running 
> > > > 'perf record -i' on the main thread. this does only collect the data 
> > > > from the main thread, though.
> > > > 
> > > > is this an issue with perf or with my understanding of perf?
> > > 
> > > -i will only inherit the counters on new fork()/clone() calls, so an 
> > > existing process/task tree will not automagically get the counters.
> > 
> > Looks like something very much worth fixing.
> 
> Well, maybe.
> 
> There's two ways to go about this, either iterate the tasks in 
> userspace and attach a counter to each one (repeat until there's no 
> new ones left).
> 
> Or add a new flag in perf_event_attr to iterate the tasks on attach in 
> an atomic manner.
> 
> We cannot simply extend the current attach behaviour as that would 
> make it impossible to attach to a single thread in a thread group.

Correct.

> Also, if you extend the interface, it would make sense to allow 
> automatically attaching to a process group, not only a thread group, 
> etc.

Indeed. This more automated approach sounds like the better solution to 
me.

	Ingo

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-10-20 12:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-19 17:04 pref record question Tim Blechmann
2009-10-20  4:26 ` Peter Zijlstra
2009-10-20  6:00   ` Ingo Molnar
2009-10-20  9:19     ` Peter Zijlstra
2009-10-20 12:46       ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).