Vitals 0.1.0: workload map with browser tab accounting
Process monitors stop at the browser boundary, so the thing that usually
pegs a machine is invisible: forty identical processes, no age, no tab
names, no idea which page is the offender.
Vitals resolves every process to a human identity (container, flatpak,
systemd unit, tree root, or script), then joins the OS view to the
browser's own DevTools counters so each tab carries its own page-work
number beside the cores its browser instance is burning. The gap between
those two numbers is the diagnosis: idle page, burning compositor.
- dependency-free sampler over /proc, 2s cadence, 5 min in-memory history
- minimal CDP client (WebSocket + JSON) with no third-party packages
- both unit systems side by side: percent of machine and fractional cores
- flags for leaked automation instances and live WebRTC calls
- user service with CPUQuota so the monitor can never be the problem
- identity tests that need no root, server, or browser
MIT licensed. Runs on Linux, reads /proc, asks for no privilege.
2026-10-19 16:42:54 -05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
# Install Vitals as a systemd user service. Idempotent.
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
|
|
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
|
UNIT_DIR="$HOME/.config/systemd/user"
|
|
|
|
|
UNIT="$UNIT_DIR/vitals.service"
|
|
|
|
|
|
|
|
|
|
command -v python3 >/dev/null || { echo "python3 is required"; exit 1; }
|
|
|
|
|
[ -d /proc ] || { echo "this tool needs /proc (Linux)"; exit 1; }
|
|
|
|
|
|
|
|
|
|
mkdir -p "$UNIT_DIR"
|
|
|
|
|
sed "s|%h/Projects/vitals|$HERE|g" "$HERE/systemd/vitals.service" > "$UNIT"
|
|
|
|
|
|
|
|
|
|
systemctl --user daemon-reload
|
|
|
|
|
systemctl --user enable --now vitals.service
|
|
|
|
|
sleep 1
|
|
|
|
|
|
|
|
|
|
if systemctl --user is-active --quiet vitals.service; then
|
|
|
|
|
echo "Vitals is running: http://127.0.0.1:8791"
|
|
|
|
|
echo " logs: journalctl --user -u vitals -f"
|
|
|
|
|
echo " stop: systemctl --user stop vitals"
|
|
|
|
|
echo " disable: systemctl --user disable --now vitals"
|
|
|
|
|
else
|
|
|
|
|
echo "Vitals failed to start. Check: journalctl --user -u vitals -n 40"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
Live UI: stop the page from jumping, and put Vitals in the bookmark bar
The page rebuilt its whole header, bar and row list twice a second, so
numbers snapped, columns resized as digits changed, and rows swapped places
over a hundredth of a core.
- header values are tabular-width and tweened toward the newest sample
- machine-bar segments are keyed and reordered by flex order, so widths
animate instead of being recreated mid-transition
- rows are keyed DOM nodes updated in place, sorted on a 0.1-core grid with
the previous order as tiebreak, with hysteresis at the idle threshold
- tabs, banner and detail panes only re-render when their data changes
- poll every 700ms and drop repeat frames from the 2s sampler
bookmark.py puts a Vitals bookmark and a popup bookmarklet in the browser's
bookmark bar. It recomputes Chromium's bookmark checksum (MD5 over the
canonical node serialisation) and verifies it after writing, because a file
that fails that check leaves the browser showing an empty bar while the file
on disk still looks perfect. Refuses while the browser holds the profile,
keeps a timestamped backup, idempotent. install.sh runs it.
Co-developed-with: CLU
2026-10-20 13:52:49 -05:00
|
|
|
|
|
|
|
|
# --- bookmark bar -------------------------------------------------------
|
|
|
|
|
# A tool you have to remember the URL of does not get used. Put it behind the
|
|
|
|
|
# bar, where a bookmark belongs. The browser must be closed while we write,
|
|
|
|
|
# because Chromium keeps the bookmark model in memory and overwrites the file
|
|
|
|
|
# on its next save. Running install.sh while the browser is up is not a
|
|
|
|
|
# failure: it prints the one command to run afterwards.
|
|
|
|
|
if [ "${1:-}" = "--no-bookmark" ]; then
|
|
|
|
|
echo
|
|
|
|
|
echo "Bookmark skipped. Add it later with:"
|
|
|
|
|
echo " python3 $HERE/bookmark.py --install"
|
|
|
|
|
else
|
|
|
|
|
echo
|
|
|
|
|
python3 "$HERE/bookmark.py" --install ${VITALS_BOOKMARK_WAIT:+--wait "$VITALS_BOOKMARK_WAIT"} || true
|
|
|
|
|
fi
|