9 releases

0.5.6 May 28, 2024
0.5.4 Nov 3, 2023
0.5.2 Feb 27, 2023
0.5.1 Jul 1, 2022
0.3.1 Sep 9, 2018

#54 in Command line utilities

Download history 24/week @ 2024-09-27 2/week @ 2024-10-04 3/week @ 2024-10-11

503 downloads per month

GPL-3.0-or-later

45KB
783 lines

strace-analyzer

Analyzes strace output.

Table of Contents

Usage

Create logs:

strace -s 0 -ff -o cmd.strace cmd

Analyze logs, with xxx being the first process ID, the analysis will follow forked processes automatically:

strace-analyzer cmd.strace.xxx

Note: Only works with traces created with the usage example above. There is no support for logs that contain output of multiple process IDs and the timed output variants are supported neither. The above-mentioned strace command line yields the shortest output and allows tracing the forked processes without too much effort.

Analysis

At the moment, strace-analyzer only analyzes reads and writes to the file system:

$ strace -s0 -ff -o tar.strace tar czfv pkgs.tar.gz /var/cache/pacman/pkg/linux-*
/var/cache/pacman/pkg/linux-5.12.1.arch1-1-x86_64.pkg.tar.zst
/var/cache/pacman/pkg/linux-api-headers-5.10.13-1-any.pkg.tar.zst
/var/cache/pacman/pkg/linux-docs-5.12.1.arch1-1-x86_64.pkg.tar.zst
/var/cache/pacman/pkg/linux-firmware-20210426.fa0efef-1-any.pkg.tar.zst
/var/cache/pacman/pkg/linux-lts-5.10.34-1-x86_64.pkg.tar.zst

$ strace-analyzer tar.strace.10099
Reads Bytes  Bytes/Op File
9722  94.9M  10.0K    /var/cache/pacman/pkg/linux-5.12.1.arch1-1-x86_64.pkg.tar.zst
111   1.1M   10.0K    /var/cache/pacman/pkg/linux-api-headers-5.10.13-1-any.pkg.tar.zst
2244  21.9M  10.0K    /var/cache/pacman/pkg/linux-docs-5.12.1.arch1-1-x86_64.pkg.tar.zst
17124 167.2M 10.0K    /var/cache/pacman/pkg/linux-firmware-20210426.fa0efef-1-any.pkg.tar.zst
7642  74.6M  10.0K    /var/cache/pacman/pkg/linux-lts-5.10.34-1-x86_64.pkg.tar.zst

Writes Bytes  Bytes/Op File
23020  359.7M 16.0K    pkgs.tar.gz

Installation

Arch Linux

Install the strace-analyzer AUR package:

pacaur -S strace-analyzer

cargo install

cargo install strace-analyzer

from source

git clone https://github.com/wookietreiber/strace-analyzer.git
cd strace-analyzer
cargo build --release
install -Dm755 target/release/strace-analyzer ~/bin/strace-analyzer

Dependencies

~5–16MB
~209K SLoC