Skip to main content

Module stats

Module stats 

Source
Expand description

Stats server for the flow scheduler.

Copyright (c) 2026 Galih Tama galpt@v.recipes Exports the counters view plus the dashboard view from the BPF maps. The stats server carries deltas while the dashboard carries raw counters plus per CPU cards for the loopback page.

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
Counters with placement, admission, and miss detail. BPF holds 17 counters, Rust adds display-only uptime for eighteen.
PerCpuMetrics
One card of the per CPU grid. Id plus SMT stay fixed while pid plus slice refresh on each poll. Pid holds zero when idle and slice holds the shared quantum. SMT marks the second thread of one core for display only with no placement use and false on old JSON.
WebMetrics
Snapshot for the web dashboard. Counters stay raw with the on CPU gauge plus the live pid view. The run loop pushes one per poll and the web thread keeps the newest behind a lock for the page plus the JSON routes.

Functionsยง

monitor
Stats printer loop for the monitor flag. Polls the stats server on the interval with plain text lines.
server_data
Server data for the stats server. A single top op reports interval deltas of the counters.