lmtop guide

Overview

lmtop reimagines the traditional interactive top utility as a deterministic, cross-platform stdio JSON server for automated agents, benchmarks, and observability pipelines. Instead of rendering ANSI escape sequences to a terminal, it samples 24 host-normalized CPU, memory, disk, and network metrics on a background thread and answers structured NDJSON queries over stdin and stdout.

Sampling architecture and ring buffer memory model

The server separates periodic metric collection from request handling so slow or bursty client queries never jitter the sampling clock:

Cross-platform metric parity and honest missing values

lmtop shares its 24-metric catalog and normalization rules with lmdebug's sys sample / sys counters specification across three native OS backends selected at compile time:

Window statistics and downsampled history

Clients can query the accumulated ring buffer at any time without disturbing ongoing collection:

# Example requests sent to the server over stdio, one JSON object per line
{"id":1,"method":"status"}
{"id":2,"method":"summary","params":{"seconds":10}}

Combining lmtop with LMScript and load tests

In LMScript performance workflows, start lmtop server redirected to a pair of POSIX FIFOs before executing an lmcurl load test, lmvalkey benchmark, or lmrg corpus search. Once the workload finishes, invoke lmtop client --in ... --out ... summary to capture the exact host CPU peak, hottest single core percentage, disk write bandwidth, and memory pressure during the run, then send stop to terminate the monitor cleanly.