2013/7/23 Peipei Wang <wangpeipei...@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() :) -- To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html