Skip to content
Khaled.dev
← Back to work

Solo engineer — profiler core, CLI, visualizations · 2024

Trading Latency Profiler

A nanosecond-resolution profiler that pinpoints where latency hides in an order pipeline — from packet arrival to ack.

Trading Latency Profiler

Stack

  • Rust
  • HdrHistogram
  • tokio
  • eBPF

Links

Overview

What it is

A CLI + library for instrumenting low-latency trading paths. It timestamps an order at every hop using a monotonic clock, attributes the time spent in each stage, and renders a flamegraph-style breakdown so you can see whether your tail latency lives in parsing, risk checks, or the network.

It samples without allocating on the hot path and exports histograms (HdrHistogram) so p99.9 numbers are trustworthy rather than averaged into meaninglessness.

Highlights

4 things worth calling out

Nanosecond, monotonic-clock timestamps per pipeline hop

Zero hot-path allocation when sampling

Trustworthy p99.9 via HdrHistogram export

Flamegraph-style stage attribution

Gallery

A closer look

Trading Latency Profiler screenshot