Expand description
Stats server, #[derive(Stats)] metrics and monitor loop.
Metrics corresponds to the BPF-side struct mlfq_stats: the type is
defined in src/bpf/intf.h and the volatile instance lives in
src/bpf/main.bpf.c, plus a userspace uptime gauge. Field names match
the BPF struct 1:1. The top stats op reports deltas over the poll
interval.
Re-exportsยง
use std::io::Write;๐use std::sync::Arc;๐use std::sync::atomic::AtomicBool;๐use std::sync::atomic::Ordering;๐use std::time::Duration;๐use anyhow::Result;๐use scx_stats_derive::Stats;๐use scx_stats_derive::stat_doc;๐use serde::Deserialize;๐use serde::Deserialize;๐use serde::Serialize;๐use serde::Serialize;๐use scx_stats::prelude::*;๐
Structsยง
- Metrics
- PerCpu
Metrics - One entry of the web UIโs per-CPU card grid.
- WebMetrics
- Snapshot served by the web UIโs
/api/statsendpoint.
Constantsยง
- OP_
LAT_ ๐EDGES_ US - Bucket edges of the op-latency histogram, matching
enum mlfq_op_lat_constsinsrc/bpf/intf.h, in microseconds.
Functionsยง
- fmt_
op_ ๐lat - Format one opโs eight bucket counts with their microsecond edges as โlow-high=countโ pairs. A histogram shorter than eight buckets (the untracked default) formats as โn/aโ.
- monitor
- The monitor loop. It periodically polls the stats server and prints a
one-line summary. It runs in its own thread (see
main.rs) and exits on shutdown. - server_
data - The stats server definition. A single
topop reporting interval deltas.