Skip to content



pt-ioprofile - Watch process IO and print a table of file and I/O activity.



pt-ioprofile [OPTIONS] [FILE]

pt-ioprofile does two things: 1) get lsof+strace for -s seconds, 2) aggregate the result. If you specify a FILE, then step 1) is not performed.


WARNING: pt-ioprofile freezes the server and may crash the process, or make it perform badly after detaching, or leave it in a sleeping state! Before using this tool, please:

  • Read the tool’s documentation

  • Review the tool’s known “BUGS”

  • Test the tool on a non-production server

  • Backup your production server and verify the backups

pt-ioprofile should be considered an intrusive tool, and should not be used on production servers unless you understand and accept the risks.


pt-ioprofile uses strace and lsof to watch a process’s IO and print out a table of files and I/O activity. By default, it watches the mysqld process for 30 seconds. The output is like:

Tue Dec 27 15:33:57 PST 2011
Tracing process ID 1833
     total       read      write      lseek  ftruncate filename
  0.000150   0.000029   0.000068   0.000038   0.000015 /tmp/ibBE5opS

You probably need to run this tool as root.

pt-ioprofile works by attaching strace to the process using ptrace(), which will make it run very slowly until strace detaches. In addition to freezing the server, there is some risk of the process crashing or performing badly after strace detaches from it, or of strace not detaching cleanly and leaving the process in a sleeping state. As a result, this should be considered an intrusive tool, and should not be used on production servers unless you are comfortable with that.



short form: -a; type: string; default: sum

The aggregate function, either sum or avg.

If sum, then each cell will contain the sum of the values in it. If avg, then each cell will contain the average of the values in it.


short form: -c; type: string; default: times

The cell contents.

Valid values are:

=====  =======================
count  Count of I/O operations
sizes  Sizes of I/O operations
times  I/O operation timing

short form: -g; type: string; default: filename

The group-by item.

Valid values are:

=====     ======================================
all       Summarize into a single line of output
filename  One line of output per filename
pid       One line of output per process ID

Print help and exit.


short form: -p; type: int

The PID to profile, overrides --profile-process.


short form: -b; type: string; default: mysqld

The process name to profile.


type: int; default: 30

How long to profile.


type: string

Filename to save samples in; these can be used for later analysis.


Print the tool’s version and exit.


This tool does not use any environment variables.


This tool requires the Bourne shell (/bin/sh).


For a list of known bugs, see

Please report bugs at Include the following information in your bug report:

  • Complete command-line used to run the tool

  • Tool --version

  • MySQL version of all servers involved

  • Output from the tool including STDERR

  • Input files (log/dump/config files, etc.)

If possible, include debugging output by running the tool with PTDEBUG; see “ENVIRONMENT”.


Using <PTDEBUG> might expose passwords. When debug is enabled, all command line parameters are shown in the output.


Visit to download the latest release of Percona Toolkit. Or, get the latest release from the command line:




You can also get individual tools from the latest release:


Replace TOOL with the name of any tool.


Baron Schwartz


This tool is part of Percona Toolkit, a collection of advanced command-line tools for MySQL developed by Percona. Percona Toolkit was forked from two projects in June, 2011: Maatkit and Aspersa. Those projects were created by Baron Schwartz and primarily developed by him and Daniel Nichter. Visit to learn about other free, open-source software from Percona.


pt-ioprofile 3.6.0