6. Analyzing profile data on another system (oparchive)

The oparchive utility generates a directory populated with executable, debug, and oprofile sample files. This directory can be copied to another (host) machine and analyzed offline, with no further need to access the data collection machine (target).

The following command, executed on the target system, will collect the sample files, the executables associated with the sample files, and the debuginfo files associated with the executables and copy them into /tmp/current_data:

# oparchive -o /tmp/current_data

When transferring archived profile data to a host machine for offline analysis, you need to determine if the oprofile ABI format is compatible between the target system and the host system; if it isn't, you must run the opimport command to convert the target's sample data files to the format of your host system. See Section 7, “Converting sample database files (opimport)” for more details.

After your profile data is transferred to the host system and (if necessary) you have run the opimport command to convert the file format, you can now run the opreport and opannotate commands. However, you must provide an "archive specification" to let these post-processing tools know where to find of the profile data (sample files, executables, etc.); for example:

# opreport archive:/home/user1/my_oprofile_archive --symbols

Furthermore, if your profile was collected on your target system into a session-dir other than /var/lib/oprofile, the oparchive command will display a message similar to the following:

# NOTE: The sample data in this archive is located at /home/user1/test-stuff/oprofile_data
instead of the standard location of /var/lib/oprofile.  Hence, when using opreport
and other post-processing tools on this archive, you must pass the following option:
        --session-dir=/home/user1/test-stuff/oprofile_data

Then the above opreport example would have to include that --session-dir option.

Note

In some host/target development environments, all target executables, libraries, and debuginfo files are stored in a root directory on the host to facilitate offline analysis. In such cases, the oparchive command collects more data than is necessary; so, when copying the resulting output of oparchive, you can skip all of the executables, etc, and just archive the $SESSION_DIR tree located within the output directory you specified in your oparchive command. Then, when running the opreport or opannotate commands on your host system, pass the --root option to point to the location of your target's executables, etc.

6.1. Usage of oparchive

--help / -? / --usage

Show help message.

--exclude-dependent / -x

Do not include application-specific images for libraries, kernel modules and the kernel.

--image-path / -p [paths]

Comma-separated list of additional paths to search for binaries. This is needed to find kernel modules.

--root / -R [path]

A path to a filesystem to search for additional binaries.

--output-directory / -o [directory]

Output to the given directory. There is no default. This must be specified.

--list-files / -l

Only list the files that would be archived, don't copy them.

--verbose / -V [options]

Give verbose debugging output.

--session-dir=dir_path

Use sample database from the specified directory dir_path instead of the default location. If this option is not specified, then oparchive will search for samples in <cur_dir>/oprofile_data first. If that directory does not exist, the standard session-dir of /var/lib/oprofile is used as the session directory.

--version / -v

Show version.