Skip to main content

End-to-end latency breakdown tool — see exactly where your command spends time

Project description

Sliceit

See exactly where your command spends time.

Sliceit wraps any command and breaks execution into four buckets — compute, I/O, memory, and idle — then renders a live terminal dashboard showing the full breakdown.

sliceit run -- pytest tests/
sliceit run -- python train.py
sliceit run -- cargo build
sliceit run -- npm test

Why

Most developers debug slow commands with intuition. time ./script.sh gives you a total. Profilers give you a flame graph you have to learn to read. Neither tells you the obvious thing: is this slow because of CPU, disk, or just waiting?

Sliceit answers that in one line.


Demo

─────────────────  Sliceit  python experiments/smoke_test.py  ──────────────────
  total  3.45s   samples  54   status  ✓ ok

╭──────────────────────────────────── timeline ──────────────────────────────────╮
│ ████████████████████████░░░░░░░░░░░░░░░░░░░░░███████████░░░░░░░░░░░░░░░░░████  │
│   ▐ Compute  ▐ I/O  ▐ Memory  ▐ Idle                                           │
╰────────────────────────────────────────────────────────────────────────────────╯

╭────────────────╮  ╭────────────────╮  ╭────────────────╮  ╭────────────────╮
│ Compute        │  │ I/O            │  │ Memory         │  │ Idle           │
│ 7.4%  255ms    │  │ 24.1%  832ms   │  │ 3.7%  128ms    │  │ 64.8%  2.24s   │
│ █░░░░░░░░░░░░░ │  │ ███░░░░░░░░░░░ │  │ █░░░░░░░░░░░░░ │  │ █████████░░░░░ │
╰────────────────╯  ╰────────────────╯  ╰────────────────╯  ╰────────────────╯

╭──────────────────────────────── phase breakdown ───────────────────────────────╮
│  Waiting / blocked   Idle     1.44s  ████████████████████████                  │
│  Module load         I/O      440ms  ███████                                   │
│  Lock wait           Idle     435ms  ███████                                   │
│  Disk read           I/O      310ms  █████                                     │
│  Network I/O         Idle     250ms  ████                                      │
│  Parsing / compile   Compute  123ms  ██                                        │
│  CPU execution       Compute   63ms  █                                         │
╰────────────────────────────────────────────────────────────────────────────────╯

╭───────────────────────────────────── insight ──────────────────────────────────╮
│ 65% Idle — process is mostly waiting (locks, sleeps, child processes).          │
│ → Investigate blocking calls, use async I/O, or check if worker processes      │
│   are stalling.                                                                 │
╰────────────────────────────────────────────────────────────────────────────────╯

Install

pip install sliceit

Requirements: Python 3.9+, works on macOS, Linux, and Windows.

Dependencies (rich, psutil) are installed automatically.

Add to PATH

After installing, make sure the sliceit command is on your PATH.

Windows (PowerShell):

$s = python -c "import sysconfig; print(sysconfig.get_path('scripts'))"
[Environment]::SetEnvironmentVariable("PATH", $env:PATH + ";" + $s, "User")

Restart PowerShell after running.

macOS / Linux:

export PATH="$HOME/.local/bin:$PATH"   # add to ~/.bashrc or ~/.zshrc

No PATH? No problem.

# macOS / Linux
python -m sliceit run -- <command>

# Windows
python -c "from sliceit.cli import main; main()" run -- <command>

Usage

sliceit run [options] -- <command>
Flag Description
--repeat N, -n N Run the command N times and show a comparison table
--quiet, -q One-line summary instead of full dashboard
--no-capture Let the command's stdout/stderr print to your terminal normally

Examples

# Scripts
sliceit run -- python train.py
sliceit run -- node index.js

# Test suites
sliceit run -- pytest tests/
sliceit run -- npm test
sliceit run -- cargo test

# Builds
sliceit run -- cargo build
sliceit run -- make build
sliceit run -- go build ./...

# Run 3 times and compare
sliceit run --repeat 3 -- pytest

# One-liner for CI
sliceit run --quiet -- python script.py

# Pass through stdout
sliceit run --no-capture -- cargo build

Multi-run comparison

sliceit run --repeat 3 -- npm test

               multi-run summary
  run   total    compute   i/o   memory   idle
 ──────────────────────────────────────────────
   #1   3,240ms     18%    47%      7%     28%
   #2   3,010ms     22%    40%      9%     24%
   #3   3,290ms     16%    52%     14%     18%
  avg   3,180ms     19%    46%     10%     23%

  min 3,010ms  max 3,290ms  spread 280ms

How it works

Sliceit wraps your command in a subprocess and polls it — and all its child processes — at 20Hz using psutil. Each sample is classified into one bucket:

Bucket Classification rule
I/O Bytes read or written per interval exceed threshold
Compute CPU% above 25%
Memory RSS growing faster than 512KB per sample
Idle Everything else — locks, sleeps, network wait, spawning

Consecutive same-bucket samples are merged into named phases. The timeline bar maps each character to ~1/60th of total runtime, colored by dominant bucket.

Sampler overhead: under 1% CPU on the background thread.


Limitations

  • Short commands (<200ms) collect too few samples for a meaningful breakdown. Use --repeat to aggregate.
  • Classification is heuristic — a process doing both CPU work and disk I/O in the same 50ms window gets assigned the dominant signal. Fine-grained interleaving won't be perfectly separated.
  • Windows I/O counters may show 0% for some processes depending on permissions.
  • GPU time is not measured. Compute reflects CPU only — GPU-bound workloads will appear mostly Idle.

Roadmap

  • JSON output (--json) for CI integration
  • GPU utilization bucket via pynvml
  • Export flamegraph-style HTML report
  • Per-child-process breakdown
  • Config file (.sliceit.toml) for custom thresholds

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sliceit_cli-0.1.0.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sliceit_cli-0.1.0-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file sliceit_cli-0.1.0.tar.gz.

File metadata

  • Download URL: sliceit_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sliceit_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6bd9e2d3d6d6f32c68f89a6af82d162427672140a35e25deb8cc636658231e1e
MD5 ebb5e9e008fc81debe800f8da299f3a6
BLAKE2b-256 9d3d2f3e1763ead9531085ba8c3df6283252b0c76600b5b74748fb1d3043ab8b

See more details on using hashes here.

Provenance

The following attestation bundles were made for sliceit_cli-0.1.0.tar.gz:

Publisher: publish.yml on Kushalk0677/sliceit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sliceit_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: sliceit_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sliceit_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 50c363c094ef002514fe3c0d99d86de6a90afa8a4fc05afd1c19287571a2c922
MD5 dff14087d4cdf6485b82125da3cb85af
BLAKE2b-256 a6e49548655f5fe9c8cacdd38b56ccffc32372e256f0b6c04b32cb01a560ba87

See more details on using hashes here.

Provenance

The following attestation bundles were made for sliceit_cli-0.1.0-py3-none-any.whl:

Publisher: publish.yml on Kushalk0677/sliceit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page