7. Converting sample database files (opimport)

This utility converts sample database files from a foreign binary format (abi) to
the native format. This is required when moving sample files to a (host) system
other than the one used for collection (target system), and the host and target systems are different
architectures. The abi format of the sample files to be imported is described in a
text file located in $SESSION_DIR/abi. If you are unsure if
your target and host systems have compatible architectures (in regard to the OProfile
ABI), simply diff a $SESSION_DIR/abi file from the target system
with one from the host system. If any differences show up at all, you must run the
opimport command.

The oparchive command should be used on the machine where
the profile was taken (target) in order to collect sample files and all other necessary
information. The archive directory that is the output from oparchive
should be copied to the system where you wish to perform your performance analysis (host).

The following command converts an input sample file to the specified
output sample file using the given abi file as a binary description
of the input file and the curent platform abi as a binary description
of the output file. (NOTE: The ellipses are used to make the example more
compact and cannot be used in an actual command line.)

Since opimport converts just one file at a time, an example shell script is provided below
that will perform an import/conversion of all sample files in a samples directory collected
from the target system.

Example usage: Assume that on the target system, a profile was collected using a session-dir of
/var/lib/oprofile, and then oparchive -o profile1 was run.
Then the profile1 directory is copied to the host system for analysis. To import
the sample data in profile1, you would perform the following steps:

$cd profile1/var/lib/oprofile/samples
$my-import.sh `pwd`/../abi

If the OProfile ABI is truly different on host and target machines, then the end result of running the
above script will place the converted (i.e., imported) files into the current-imported
directory. By default, opreport and other post-profiling tools will look for samples
in samples/current of the specified session directory. So you should either rename
current-imported to current or specify the session specification of
session:current-imported when running post-profiling tools.

If the OProfile ABI is the same on the host and target machines, the my-import.sh script
will print the following message for each sample file:

input abi is identical to native. no conversion necessary.

7.1. Usage of opimport

--help / -? / --usage

Show help message.

--abi / -a [filename]

Input abi file description location.

--force / -f

Force conversion even if the input and output abi are identical.

--output / -o [filename]

Specify the output filename. If the output file already exists, the file is
not overwritten but data are accumulated in. Sample filename are informative
for post profile tools and must be kept identical, in other word the pathname
from the first path component containing a '{' must be kept as it in the
output filename.