Tracing and Profiling: Difference between revisions

From Yocto Project
Jump to navigationJump to search
No edit summary
Line 21: Line 21:
For example, this probe from the SystemTap tutorial [http://sourceware.org/systemtap/tutorial/] simply prints a line every time any process on the system open()s a file.  For each line, it prints the executable name of the program that opened the file, along with its pid, and the name of the file it opened (or tried to open), which it extracts from the open syscall's argstr.
For example, this probe from the SystemTap tutorial [http://sourceware.org/systemtap/tutorial/] simply prints a line every time any process on the system open()s a file.  For each line, it prints the executable name of the program that opened the file, along with its pid, and the name of the file it opened (or tried to open), which it extracts from the open syscall's argstr.


<code>
probe syscall.open
probe syscall.open
{
{
Line 30: Line 31:
         exit ()
         exit ()
}
}
</code>


For many more examples, and documentation, see [http://sourceware.org/systemtap/].
For many more examples, and documentation, see [http://sourceware.org/systemtap/].

Revision as of 23:27, 10 January 2011

Tracing and Profiling in Yocto

Yocto bundles a large number of tracing and profiling tools; many of them are available however only in 'sdk' images. So, in order to be able to access all of the tools described here, please first build and boot an 'sdk' image e.g.

$ bitbake poky-image-sdk-live

This page contains basic information and simple examples to help you get started with each of the tracing and profiling tools available in Yocto. There is no overall structure - each tool is simply listed in alphabetical order. If you'd like to see more involved real-world use cases that show how you might use these tools in concert, see Tracing and Profiling End-to-End Examples.


blktrace

blktrace is a tool for tracing and reporting low-level disk I/O. blktrace provides the tracing half of the equation; its output can be piped into the blkparse program, which renders the data in a human-readable form and does some basic analysis:

$ blktrace /dev/sda | blkparse -

systemtap

SystemTap is a system-wide script-based tracing and profiling tool.


For example, this probe from the SystemTap tutorial [1] simply prints a line every time any process on the system open()s a file. For each line, it prints the executable name of the program that opened the file, along with its pid, and the name of the file it opened (or tried to open), which it extracts from the open syscall's argstr.

probe syscall.open {

       printf ("%s(%d) open (%s)\n", execname(), pid(), argstr)

}

probe timer.ms(4000) # after 4 seconds {

       exit ()

}

For many more examples, and documentation, see [2].