LinuxCommandLibrary

blkparse

Parse block I/O trace data

SYNOPSIS

blkparse [options] [input-dir | input-file]

PARAMETERS

-a disks, --add=<disks>
    Add comma-separated disks (by basename number or major:minor) to process.

-b size, --buffer=<size>
    Set input buffer size in MiB (default 1024).

-d dir, --input-dir=<dir>
    Read input traces from dir (default current directory).

-f format, --format=<format>
    Set output format string (e.g., %d %C %D).

-h, --help
    Display help and exit.

-i file, --input=<file>
    Read single input trace file.

-m size
    Limit data per line to size bytes.

-n procname
    Filter traces by process name.

-o file, --output=<file>
    Write output to file (default stdout).

-q
    Quiet mode: suppress non-data messages.

-s size
    Set sub-buffer size in MiB.

-t
    Enable per-thread dispatch reports.

-v
    Verbose mode.

-V, --version
    Show version and exit.

-w file
    Write dispatch traces to file.

DESCRIPTION

blkparse is a Linux command-line tool from the blktrace suite that converts binary block I/O trace data, captured by blktrace, into human-readable text format. It reconstructs detailed events such as I/O dispatch, completion, queueing, and back-merges, including timestamps, process IDs, CPU numbers, and sector information.

This utility is crucial for analyzing storage performance, debugging kernel block layer issues, and profiling disk workloads. It processes trace files from one or more block devices, applying filters for specific disks, processes, or verbosity levels. Output can be customized with formats like CSV or dispatch logs, making it suitable for scripting or visualization tools.

Typical usage follows blktrace collection: blktrace -d /dev/sda -o trace; blkparse -i trace. It handles multi-CPU traces efficiently, supports per-thread views, and limits line lengths for readability. blkparse excels in revealing I/O patterns, latencies, and scheduler behavior without kernel modifications.

CAVEATS

Requires matching binary files from blktrace; does not trace itself. Large/multi-device traces demand high memory/CPU. Input directory must contain per-CPU files (e.g., device.0.0).

HISTORY

Developed by Jens Axboe in 2004 as part of blktrace toolkit for Linux block I/O tracing. Evolved with kernel block layer changes; now in blktrace package, widely used in storage analysis.

SEE ALSO

blktrace(8), bpftrace(1), perf(1), iostat(1)

Copied to clipboard