linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How do the software events work in perf?
@ 2013-07-22 23:11 Peipei Wang
  2013-07-22 23:51 ` Frederic Weisbecker
  0 siblings, 1 reply; 3+ messages in thread
From: Peipei Wang @ 2013-07-22 23:11 UTC (permalink / raw)
  To: perf group

Hi guys,
I am curious about how perf get the software events. While hardware
events are defined and can be found in architecture manuals, I don't
get any information or documentation about how perf get the software
events, or how they are collected.

Thanks for your help.

Yours,
Wang Peipei

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

* Re: How do the software events work in perf?
  2013-07-22 23:11 How do the software events work in perf? Peipei Wang
@ 2013-07-22 23:51 ` Frederic Weisbecker
  2013-07-23  0:09   ` David Ahern
  0 siblings, 1 reply; 3+ messages in thread
From: Frederic Weisbecker @ 2013-07-22 23:51 UTC (permalink / raw)
  To: Peipei Wang; +Cc: perf group

2013/7/23 Peipei Wang <wangpeipei.90@gmail.com>:
> Hi guys,
> I am curious about how perf get the software events. While hardware
> events are defined and can be found in architecture manuals, I don't
> get any information or documentation about how perf get the software
> events, or how they are collected.
>
> Thanks for your help.

Hi,

They are implemented using tracepoints. To summarize, tracepoints are callbacks
that are called on any interesting point in the code.

For example in the context switch path we have a function call
trace_sched_context_switch() that in turn calls a callback that then
rely into the perf events susbsystem to record the event in the
buffer.

In practice it is a bit more complicated, there is a layer in the
middle with the trace events subsystem.

For more details on tracepoints: Documentation/tracepoints.txt and
Documentation/events.txt

But really, this is just about function calls that we put when we find
some interesting code to trace. Like a very enhanced printk() :)

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

* Re: How do the software events work in perf?
  2013-07-22 23:51 ` Frederic Weisbecker
@ 2013-07-23  0:09   ` David Ahern
  0 siblings, 0 replies; 3+ messages in thread
From: David Ahern @ 2013-07-23  0:09 UTC (permalink / raw)
  To: Frederic Weisbecker, Peipei Wang; +Cc: perf group

On 7/22/13 5:51 PM, Frederic Weisbecker wrote:
> 2013/7/23 Peipei Wang <wangpeipei.90@gmail.com>:
>> Hi guys,
>> I am curious about how perf get the software events. While hardware
>> events are defined and can be found in architecture manuals, I don't
>> get any information or documentation about how perf get the software
>> events, or how they are collected.
>>
>> Thanks for your help.
>
> Hi,
>
> They are implemented using tracepoints. To summarize, tracepoints are callbacks
> that are called on any interesting point in the code.

Besides tracepoints there a few software events -- cpu-clock, 
task-clock, context-switches, page faults, cpu migrations, etc.

David

>
> For example in the context switch path we have a function call
> trace_sched_context_switch() that in turn calls a callback that then
> rely into the perf events susbsystem to record the event in the
> buffer.
>
> In practice it is a bit more complicated, there is a layer in the
> middle with the trace events subsystem.
>
> For more details on tracepoints: Documentation/tracepoints.txt and
> Documentation/events.txt
>
> But really, this is just about function calls that we put when we find
> some interesting code to trace. Like a very enhanced printk() :)
> --
> 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] 3+ messages in thread

end of thread, other threads:[~2013-07-23  0:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-22 23:11 How do the software events work in perf? Peipei Wang
2013-07-22 23:51 ` Frederic Weisbecker
2013-07-23  0:09   ` David Ahern

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).