pref record question
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
Signature · 5 lines
[email protected] http://tim.klingt.org art is short - life is long Jack Kerouac
Quoted 8 lines · Tim Blechmann
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.
Quoted 9 lines · Peter Zijlstra
Quoted 7 lines · Tim Blechmann
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.
Quoted 4 lines
Quoted 1 line
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
Quoted 11 lines · Ingo Molnar
Quoted 9 lines · Peter Zijlstra
Quoted 7 lines · Tim Blechmann
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.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
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.
Quoted 25 lines · Peter Zijlstra
Quoted 11 lines · Ingo Molnar
Quoted 9 lines · Peter Zijlstra
Quoted 7 lines · Tim Blechmann
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.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
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).
Quoted 5 lines
Or add a new flag in
perf_event_attrto 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.
Quoted 3 lines
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