All of lore.kernel.org
 help / color / mirror / Atom feed
* How does perf collects per thread/process events ?
@ 2013-07-16 15:29 Manuel Selva
  2013-07-22  4:19 ` Michael Ellerman
  0 siblings, 1 reply; 5+ messages in thread
From: Manuel Selva @ 2013-07-16 15:29 UTC (permalink / raw)
  To: linux-perf-users

Hi,

My question regards a platform equipped with 2 Intel Xeon X5650.
According to the perf wiki page 
(https://perf.wiki.kernel.org/index.php/Tutorial), "by default perf stat 
counts for all threads of the process and subsequent child processes and 
threads" and "By default, perf stat counts in per-thread mode".

So a first question is what is the default: per thread or per process ?

Then, independently of the answer, I am wondering how does perf handles 
per thread or per process regarding the scheduler and migrations. I 
didn't find it explicitly in the Intel documentation but it seems 
natural that hardware performance counters located on a given core are 
only capable of counting event on this core and not on other cores. Is 
it true ?

Moreover, the wiki page says that "When a thread migrated from one 
processor to another, counters are saved on the current processor and 
are restored on the new one" (this seems to confirm the answer to my 
previous question above). It means that the scheduler is aware about 
"perf" or that perf is able to register a hook into the scheduler. So I 
guess this is done in the kernel part of perf (in the implementation of 
the perf_event_open system call) and not in the user land part, is it true ?

Thanks

-- 
Manu

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

* Re: How does perf collects per thread/process events ?
  2013-07-16 15:29 How does perf collects per thread/process events ? Manuel Selva
@ 2013-07-22  4:19 ` Michael Ellerman
  2013-07-22  6:50   ` Manuel Selva
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Ellerman @ 2013-07-22  4:19 UTC (permalink / raw)
  To: Manuel Selva; +Cc: linux-perf-users

On Tue, 2013-07-16 at 17:29 +0200, Manuel Selva wrote:
> Hi,
> 
> My question regards a platform equipped with 2 Intel Xeon X5650.
> According to the perf wiki page 
> (https://perf.wiki.kernel.org/index.php/Tutorial), "by default perf stat 
> counts for all threads of the process and subsequent child processes and 
> threads" and "By default, perf stat counts in per-thread mode".
> 
> So a first question is what is the default: per thread or per process ?

It's per process, which is as described in the first quote above. The
second quote is just wrong AFAICS.

> Then, independently of the answer, I am wondering how does perf handles 
> per thread or per process regarding the scheduler and migrations. I 
> didn't find it explicitly in the Intel documentation but it seems 
> natural that hardware performance counters located on a given core are 
> only capable of counting event on this core and not on other cores. Is 
> it true ?
> 
> Moreover, the wiki page says that "When a thread migrated from one 
> processor to another, counters are saved on the current processor and 
> are restored on the new one" (this seems to confirm the answer to my 
> previous question above). It means that the scheduler is aware about 
> "perf" or that perf is able to register a hook into the scheduler. So I 
> guess this is done in the kernel part of perf (in the implementation of 
> the perf_event_open system call) and not in the user land part, is it true ?

Yes.

cheers

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

* Re: How does perf collects per thread/process events ?
  2013-07-22  4:19 ` Michael Ellerman
@ 2013-07-22  6:50   ` Manuel Selva
  2013-07-22 13:44     ` David Ahern
  0 siblings, 1 reply; 5+ messages in thread
From: Manuel Selva @ 2013-07-22  6:50 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linux-perf-users

Thanks for the answer Michael.

I just created an account to be able to edit the perf wiki page. Before 
doing that, I am asking here if someone knows the policy to update this 
wiki or who are the maintainers to ask them ?

Thanks,

Manu

On 07/22/2013 06:19 AM, Michael Ellerman wrote:
> On Tue, 2013-07-16 at 17:29 +0200, Manuel Selva wrote:
>> Hi,
>>
>> My question regards a platform equipped with 2 Intel Xeon X5650.
>> According to the perf wiki page
>> (https://perf.wiki.kernel.org/index.php/Tutorial), "by default perf stat
>> counts for all threads of the process and subsequent child processes and
>> threads" and "By default, perf stat counts in per-thread mode".
>>
>> So a first question is what is the default: per thread or per process ?
>
> It's per process, which is as described in the first quote above. The
> second quote is just wrong AFAICS.
>
>> Then, independently of the answer, I am wondering how does perf handles
>> per thread or per process regarding the scheduler and migrations. I
>> didn't find it explicitly in the Intel documentation but it seems
>> natural that hardware performance counters located on a given core are
>> only capable of counting event on this core and not on other cores. Is
>> it true ?
>>
>> Moreover, the wiki page says that "When a thread migrated from one
>> processor to another, counters are saved on the current processor and
>> are restored on the new one" (this seems to confirm the answer to my
>> previous question above). It means that the scheduler is aware about
>> "perf" or that perf is able to register a hook into the scheduler. So I
>> guess this is done in the kernel part of perf (in the implementation of
>> the perf_event_open system call) and not in the user land part, is it true ?
>
> Yes.
>
> cheers
>

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

* Re: How does perf collects per thread/process events ?
  2013-07-22  6:50   ` Manuel Selva
@ 2013-07-22 13:44     ` David Ahern
  2013-07-22 15:25       ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 5+ messages in thread
From: David Ahern @ 2013-07-22 13:44 UTC (permalink / raw)
  To: Manuel Selva; +Cc: Michael Ellerman, linux-perf-users, Arnaldo Carvalho de Melo

On 7/22/13 12:50 AM, Manuel Selva wrote:
> Thanks for the answer Michael.
>
> I just created an account to be able to edit the perf wiki page. Before
> doing that, I am asking here if someone knows the policy to update this
> wiki or who are the maintainers to ask them ?

Arnaldo is the current one I believe.
David


>
> On 07/22/2013 06:19 AM, Michael Ellerman wrote:
>> On Tue, 2013-07-16 at 17:29 +0200, Manuel Selva wrote:
>>> Hi,
>>>
>>> My question regards a platform equipped with 2 Intel Xeon X5650.
>>> According to the perf wiki page
>>> (https://perf.wiki.kernel.org/index.php/Tutorial), "by default perf stat
>>> counts for all threads of the process and subsequent child processes and
>>> threads" and "By default, perf stat counts in per-thread mode".
>>>
>>> So a first question is what is the default: per thread or per process ?
>>
>> It's per process, which is as described in the first quote above. The
>> second quote is just wrong AFAICS.
>>
>>> Then, independently of the answer, I am wondering how does perf handles
>>> per thread or per process regarding the scheduler and migrations. I
>>> didn't find it explicitly in the Intel documentation but it seems
>>> natural that hardware performance counters located on a given core are
>>> only capable of counting event on this core and not on other cores. Is
>>> it true ?
>>>
>>> Moreover, the wiki page says that "When a thread migrated from one
>>> processor to another, counters are saved on the current processor and
>>> are restored on the new one" (this seems to confirm the answer to my
>>> previous question above). It means that the scheduler is aware about
>>> "perf" or that perf is able to register a hook into the scheduler. So I
>>> guess this is done in the kernel part of perf (in the implementation of
>>> the perf_event_open system call) and not in the user land part, is it
>>> true ?
>>
>> Yes.
>>
>> cheers
>>
> --
> To unsubscribe from this list: send the line "unsubscribe
> linux-perf-users" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: How does perf collects per thread/process events ?
  2013-07-22 13:44     ` David Ahern
@ 2013-07-22 15:25       ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-07-22 15:25 UTC (permalink / raw)
  To: David Ahern; +Cc: Manuel Selva, Michael Ellerman, linux-perf-users

Em Mon, Jul 22, 2013 at 07:44:35AM -0600, David Ahern escreveu:
> On 7/22/13 12:50 AM, Manuel Selva wrote:
> >Thanks for the answer Michael.
> >
> >I just created an account to be able to edit the perf wiki page. Before
> >doing that, I am asking here if someone knows the policy to update this
> >wiki or who are the maintainers to ask them ?
> 
> Arnaldo is the current one I believe.

I wonder if there is a policy for all of wiki.kernel.org, checking...
Couldn't find any.

Policy in what regard? We expect people that know what they are talking
about and want to help write content that they are entitled to
collaborate in a lawful way so if you think you can do that, go ahead
:-)

- Arnaldo

> David
> 
> 
> >
> >On 07/22/2013 06:19 AM, Michael Ellerman wrote:
> >>On Tue, 2013-07-16 at 17:29 +0200, Manuel Selva wrote:
> >>>Hi,
> >>>
> >>>My question regards a platform equipped with 2 Intel Xeon X5650.
> >>>According to the perf wiki page
> >>>(https://perf.wiki.kernel.org/index.php/Tutorial), "by default perf stat
> >>>counts for all threads of the process and subsequent child processes and
> >>>threads" and "By default, perf stat counts in per-thread mode".
> >>>
> >>>So a first question is what is the default: per thread or per process ?
> >>
> >>It's per process, which is as described in the first quote above. The
> >>second quote is just wrong AFAICS.
> >>
> >>>Then, independently of the answer, I am wondering how does perf handles
> >>>per thread or per process regarding the scheduler and migrations. I
> >>>didn't find it explicitly in the Intel documentation but it seems
> >>>natural that hardware performance counters located on a given core are
> >>>only capable of counting event on this core and not on other cores. Is
> >>>it true ?
> >>>
> >>>Moreover, the wiki page says that "When a thread migrated from one
> >>>processor to another, counters are saved on the current processor and
> >>>are restored on the new one" (this seems to confirm the answer to my
> >>>previous question above). It means that the scheduler is aware about
> >>>"perf" or that perf is able to register a hook into the scheduler. So I
> >>>guess this is done in the kernel part of perf (in the implementation of
> >>>the perf_event_open system call) and not in the user land part, is it
> >>>true ?
> >>
> >>Yes.
> >>
> >>cheers
> >>
> >--
> >To unsubscribe from this list: send the line "unsubscribe
> >linux-perf-users" in
> >the body of a message to majordomo@vger.kernel.org
> >More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2013-07-22 15:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-16 15:29 How does perf collects per thread/process events ? Manuel Selva
2013-07-22  4:19 ` Michael Ellerman
2013-07-22  6:50   ` Manuel Selva
2013-07-22 13:44     ` David Ahern
2013-07-22 15:25       ` Arnaldo Carvalho de Melo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.