Chapter 2. Overview

Table of Contents

1. Getting started with OProfile using operf
2. Getting started with OProfile using legacy profiling mode
3. Getting started with OProfile using ocount
4. Specifying performance counter events
5. Tools summary

1. Getting started with OProfile using operf

Profiling with operf is the recommended profiling mode with OProfile. Using this mode not only allows you to target your profiling more precisely (i.e., single process or system-wide), it also allows OProfile to co-exist better with other tools on your system that may also be using the perf_events kernel subsystem.

With operf, there is no initial setup needed -- simply invoke operf with the options you need; then run the OProfile post-processing tool(s). The operf syntax is as follows:

operf [ options ] [ --system-wide | --pid=<PID> | [ command [ args ] ] ]

A typical usage might look like this:

operf ./my_test_program my_arg

When ./my_test_program completes (or when you press Ctrl-C), profiling stops and you're ready to use opreport or other OProfile post-processing tools. By default, operf stores the sample data in <cur_dir>/oprofile_data/samples/current, and opreport and other post-processing tools will look in that location first for profile data, unless you pass the --session-dir option.