Skip to content
lpmi-13Public

About

An extended wasm-based Doom game that lets you explore system telemetry from a linux VM

Resources

Stars

8 stars

Watchers

0 watching

Forks

Repository files navigation

Doom Perf

Doom Perf is a fork of the original doom-typescript browser port. The base project brought the open-source Doom engine into the browser with TypeScript, WebAssembly, Web Audio, and Tone.js. This fork keeps that run/build shape, then amends the game into a USE-methodology performance diagnostics lab.

The current goal is not to make a normal Doom game. It is to turn Doom into an explorable systems observability space where CPU, memory, storage, and network utilization, saturation, and errors become Doom rooms, visualizations, and salient signals.

Launch Release Trailer: https://youtu.be/j_Fe7hDtjzg

Title screen

CPU door

CPU cores

vmstat terminal

run queue

major and minor faults

memory spire

memory wing swap

in-game terminal screen

disk spire

io await corridor

iops by device

decorative elements

network tunnel

nic RX buffer

Current Status

You can run this live in an iximiuz Labs playground!

The project currently runs as a browser-hosted Doom diagnostics lab using the same esbuild and public/ hosting flow as the fork source. The default runtime path loads the patched Doom WASM engine, the redistributable Freedoom Phase 1 freedoom1.wad IWAD, and the generated Doom Perf map PWAD.

What currently works:

  • Browser launcher at public/index.html and the full-screen game host at public/game/index.html.
  • TypeScript bundle built from src/index.ts into public/dist/index.js.
  • Patched Doom WASM engine artifacts at public/engine/ for Low (320×200), public/engine/640x400/ for Regular (640×400), and public/engine/960x600/ for High (960×600).
  • Generated Doom Perf map PWAD at public/maps/doomperf-lab.wad.
  • Central atrium with four themed resource wings: CPU, memory, disk, and network.
  • Go telemetry SSE service at http://127.0.0.1:9999/telemetry.
  • Telemetry client in the browser that normalizes live/simulated resource data and pushes live CPU, memory, storage, and network values into the WASM engine through exported DoomPerf_* functions.
  • Native Doom menu over the animated title or current game view, with live/ simulated modes and screen resolution.
  • Twelve current data-source choices from the splash/menu flow:
    • LIVE STATS
    • SIM: HIGH CPU UTILIZATION
    • SIM: HIGH CPU SATURATION
    • SIM: HIGH DISK UTILIZATION
    • SIM: DISK SATURATION, SHALLOW QUEUE
    • SIM: DISK SATURATION, DEEP QUEUE
    • SIM: HIGH MEMORY UTILIZATION
    • SIM: MEMORY SATURATION, SWAP
    • SIM: MEMORY SATURATION, NO SWAP
    • SIM: HIGH NETWORK UTILIZATION
    • SIM: NETWORK RECEIVE SATURATION
    • SIM: NETWORK TRANSMIT SATURATION
  • CPU wing instruments for per-core utilization, run queue pressure, blocked I/O-wait tasks, and load average pressure.
  • Memory wing instruments for a central book-fill spire (physical-memory utilization with a page-cache split), a swap/reclaim saturation sluice, a minor/major page-fault firing range, an OOM-killer Baron, and per-process RSS barrels.
  • Storage wing instruments for a disk-usage sunburst, per-device IOPS rain gauges, a two-tier IO queue circuit, a latency causeway that drags player movement by read/write await, a pulsing platter spindle, and a scrolling metrics dashboard.
  • Network wing live instruments for RX/TX packet-orb lanes with gate-metered block signals, softnet tesla coils, recv/send socket capacitor banks, a kernel-TX qdisc disc, a switchyard train tunnel, and RJ45 link/activity LEDs.
  • Interactive terminal overlays across all four wings: CPU (per-core cores, run queue, load average), memory (utilization baseline, top RSS, reclaim & relief, page faults, OOM errors), storage (iostat service & queue, df capacity, per-device IOPS, IO queue depth, latency causeway), and network (per-interface throughput, TCP socket census, socket Recv-Q/Send-Q, softnet backlog, qdisc backlog, NIC RX/TX ring counters).
  • Touch-device support for menu navigation, movement, the USE/interact prompt, and a long-press on the game view to reopen the data-source menu (the phone's equivalent of Esc) so a different sim can be selected mid-run.
  • Disk server-rack easter egg that plays an interaction sting and spikes the storage metrics dashboard.

All four resource wings (CPU, memory, storage, and network) now carry live, engine-driven visual instruments; none of them are static map geometry anymore.

What is still left:

  • Add more per-room music or audio cues beyond the current interaction sting. The supported audio path is currently sound-effects-only. MIDI playback is intentionally absent from the product experience, and the unused experimental Tone.js/MIDI stack has been removed to reduce startup cost. Future MIDI music will need a deliberately lazy-loaded, audio-clock-based implementation rather than restoring dormant music assets to the initial application bundle.

Installation And Running

Prerequisites:

  • Node.js 18 or newer
  • npm
  • Go 1.22 or newer for the local telemetry SSE service
  • Emscripten SDK only if rebuilding the WASM engine
  • The bundled Freedoom Phase 1 IWAD at public/wads/freedoom1.wad

Install dependencies:

npm install

Regenerate the Doom Perf map and build the browser bundle:

npm run build:map
npm run build

To rebuild the three engine resolutions locally, run npm run build:engine before npm run build. The engine script reads a clean ../doom/linuxdoom-1.10 checkout by default; set DOOM_SRC_DIR if yours is elsewhere. The build stages and patches its own copy of that source.

Start the browser host and Linux telemetry SSE service:

npm run dev:telemetry

Then open:

http://localhost:8000

Useful URL variants:

http://localhost:8000/
http://localhost:8000/?telemetry=off
http://localhost:8000/game/?resolution=320
http://localhost:8000/game/?resolution=640
http://localhost:8000/game/?resolution=960

On a first visit to /game/, Regular (640×400) loads by default. The native menu appears over the animated flamegraph title with Mode and Screen Resolution as its two top-level choices. Use Up/Down to choose, Enter to open a submenu, and Backspace or Left Arrow to return to the top level. Escape closes the menu. The resolution submenu offers Low (320×200), Regular (640×400), and High (960×600) in larger text. All three occupy the same 8:5 screen area; the internal render detail changes. Press Esc during play to open that menu over the current game view. Changing resolution restarts the engine and loses the current position. The choice is saved in the browser. A valid ?resolution= value applies to that visit without changing the saved choice.

Controls

Key Action
Arrow keys Move and turn
Space Open doors, use, or open/close nearby Doom Perf terminal overlays
Shift Run
Esc Open/close menu or close terminal overlay
Tab Automap

Combat and weapon switching are intentionally disabled by engine patches. Doom Perf is currently an observational lab, not a combat game.

On touch devices, the browser host adds menu controls on the title, a menu button and movement pad during play, and an on-screen USE/interact prompt near doors and terminal screens. Tap the menu button to open the native mode and resolution menu over the current game view. BACK returns from a submenu to the top level, then closes the menu.

Data Sources

npm run dev:telemetry starts two processes:

  • go run ./cmd/telemetry (the SSE collector on 127.0.0.1:9999)
  • the dev web server (scripts/build-web.mjs --watch --serve), which serves public/ and the in-memory bundle, and proxies /telemetry and /healthz to the collector — the same same-origin fronting nginx provides in prod.

The Go service samples Linux state once per second and emits Server-Sent Events. The current live feed includes:

  • /proc/stat for aggregate and per-core CPU utilization
  • /proc/loadavg and /proc/uptime for run queue and load pressure
  • /proc/meminfo, /proc/vmstat (page faults, oom_kill), and /proc/pressure/memory (PSI) for memory pressure, plus per-process /proc/<pid>/ (comm, statm, oom_score) for the top resident sets
  • /proc/diskstats, /sys/block/* (per-device IOPS), and statfs (capacity) for storage utilization, queue depth, latency, I/O rate, and df
  • /proc/net/dev, /proc/net/snmp, /proc/net/netstat, /proc/net/softnet_stat, /proc/net/tcp (socket Recv-Q/Send-Q), and /sys/class/net/* for network throughput, backlog, socket queues, drops, and errors

Data source → visualization map

The tables below map each live data source to the discrete in-world instrument it drives, by wing. This is the LIVE STATS path: in a SIM: scenario the selected wing synthesizes its own stressed values engine-side and ignores the live push, while the other three wings keep reading these live sources. Values are pushed into the engine through the exported DoomPerf_Set* functions (src/index.ts), so the "Data source" column is the ultimate origin, not an intermediate. Terminal overlays (opened with USE at each screen) carry the full per-resource detail beyond the geometry listed here.

CPU wing

Visualized element Data source Reads as
Central core pillars — streak count (per pillar) /proc/stat per-CPU jiffies Per-core utilization (USE: utilization)
Central core pillars — streak speed (shared; inverted, calm = fast) /proc/loadavg → run-queue pressure max(nr_running − nCPU, 0) / nCPU Run-queue saturation (USE: saturation)
Run-queue subway orbs (reservoir fill + overflow tokens) /proc/loadavg running count (field 4 numerator) Runnable-task count
Blocked-task pen orbs /proc/stat procs_blocked Uninterruptible-sleep (D-state) I/O-wait tasks
Load-average gauges (1 / 5 / 15 min) /proc/loadavg load1 / load5 / load15 Load averages
Load-gauge band glow /proc/loadavg load1 vs nCPU (load pressure) Overall load pressure
Title-screen oo pulse /proc/loadavg load pressure Overall CPU load (non-wing)

CPU errors are intentionally not visualized — see the section below.

Memory wing

Visualized element Data source Reads as
Central book-fill spire — fill height (green working-set books) /proc/meminfo 1 − MemAvailable/MemTotal Memory utilization (USE: utilization)
Central book-fill spire — cyan page-cache band /proc/meminfo (Buffers + Cached) / MemTotal Reclaimable page-cache share
Swap/reclaim saturation sluice — pool level /proc/pressure/memory (PSI); fallback /proc/vmstat refault/reclaim + swap + major-fault rate Reclaim stalls / memory saturation (USE: saturation)
Sluice swap relief vent — capped vs open /proc/meminfo SwapTotal Whether swap is configured
Sluice swap relief vent — glow / steam /proc/vmstat pswpin + pswpout Swap paging rate
Page-fault firing range — near (minor) meter /proc/vmstat pgfault − pgmajfault Minor faults/s (RAM-served)
Page-fault firing range — far (major) meter /proc/vmstat pgmajfault Major faults/s (disk/swap refault)
Per-process RSS barrels — count + height (top 5) /proc/<pid>/statm via ps --sort=-rss Largest resident sets
Per-process RSS barrels — glow /proc/<pid>/oom_score Kernel OOM badness (USE: errors, precursor)
OOM-killer Baron detonation /proc/vmstat oom_kill (rising edge) OOM-kill event (USE: errors)

Storage (disk) wing

Visualized element Data source Reads as
Disk-usage sunburst (back wall) statfs("/") (df /) Root-filesystem capacity used
Latency causeway — read/write lane drag + pistons (drags player speed) /proc/diskstats r_await / w_await (worst-await device) Per-op read/write service time (USE: saturation)
Media-pit latency gauges /proc/diskstats await (worst device) Aggregate I/O service time
Platter spindle pulse rings /proc/diskstats %util Device busy fraction (USE: utilization)
Metrics-dashboard IOPS graph /proc/diskstats (reads + writes)/s Aggregate IOPS
Per-device IOPS rain gauges — fall speed (top 5) /proc/diskstats per-device ops/s Per-device I/O rate
Per-device IOPS rain gauges — density + brightness /proc/diskstats per-device %util Per-device utilization
Two-tier IO queue rack — device magazine /proc/diskstats in-flight (field 9) + /sys/block/*/device/queue_depth (cap) Hardware queue occupancy (USE: saturation)
Two-tier IO queue rack — scheduler magazine /proc/diskstats aqu-sz − in-flight Scheduler backlog (unbounded)
Tower request circuit burstiness /proc/diskstats aqu-sz (total queue length) Total queue depth

Network wing

Visualized element Data source Reads as
RX / TX packet-orb lanes — orb density (+ gate-metered block signals) /proc/net/dev rx/tx bytes/s, scaled by /sys/class/net/*/speed Throughput vs link rate (USE: utilization)
Recv / send socket capacitor banks — current + fill /proc/net/tcp{,6} Recv-Q / Send-Q bytes (+ backlogged-accept lift) Socket-buffer backlog (USE: saturation)
Socket capacitor banks — reverse flashover /proc/net/snmp Rcv/SndbufErrors + /proc/net/netstat TCPRcvQDrop/TCPBacklogDrop (fill-proxy fallback) Socket-buffer overflows (USE: errors)
Softnet tesla coils — squeeze electrode /proc/net/softnet_stat time_squeeze/s Per-CPU input-queue budget exhaustion (kernel-RX saturation)
Softnet tesla coils — drop electrode /proc/net/softnet_stat dropped/s Softnet backlog drops (USE: errors)
Kernel-TX qdisc floor disc — violet pie fill netlink RTM_GETQDISC (tc backlog bytes); "scanning" state when unreadable Qdisc backlog (kernel-TX saturation)
Kernel-TX lane drops /proc/net/dev tx drops/s Transmit-side drops
NIC ring lock — fill + brim /proc/net/dev rx/tx fifo overruns/s (+ ethtool ring depth for the brim line) NIC ring overruns (NIC saturation/errors)
Socket alcove SYN-RECV backlog column /proc/net/tcp{,6} SYN-RECV count Half-open connections
RJ45 link / activity LEDs /proc/net/dev rx/tx activity Link up + per-packet blink
TCP socket patch-panel / census /proc/net/tcp{,6} per-state census Sockets by TCP state

The browser accepts either telemetry events or JSON message events. With no query parameter it always connects same-origin to /telemetry:

/telemetry   # dev: dev-server proxy -> 127.0.0.1:9999
/telemetry   # prod / iximiuz Labs: nginx -> 127.0.0.1:9999

Because the request is same-origin in both environments, the collector serves no CORS headers. Use ?telemetry=off to disable telemetry, or ?telemetry=<url> to point at a loopback collector directly (restricted to the 127.0.0.1:9999 / localhost:9999 dev endpoint by the client).

CPU Errors Are Intentionally Not Visualized

Doom Perf maps the full USE triad — utilization, saturation, and errors — onto the lab, but the CPU wing deliberately ships only utilization (per-core instruments) and saturation (run queue and load gauges). There is no CPU errors instrument, and that omission is intentional.

In Brendan Gregg's USE method, a CPU error is a hardware fault: a Machine Check Exception (MCE), an ECC/cache parity error, or thermal throttling. Those are surfaced through /sys/devices/system/machinecheck/, the EDAC counters under /sys/devices/system/edac/mc/, the per-core thermal_throttle counters under /sys/devices/system/cpu/, or the kernel log.

Utilization and saturation are products of workload — any unprivileged process can produce them on demand (a busy loop for utilization, an oversubscribed run queue for saturation). A genuine CPU error is a product of hardware, and userspace cannot make one happen. The only facilities that can fabricate one deterministically are:

  • mce-inject — software injection of a synthetic MCE record into the kernel's machine-check path (needs CONFIG_X86_MCE_INJECT, root, and the /sys/kernel/debug/mce-inject debugfs node).
  • ACPI APEI einj — firmware-mediated injection through the platform's real error hardware (needs CONFIG_ACPI_APEI_EINJ, root, debugfs, and server-class firmware that implements the EINJ table).

Both require root and debugfs, EINJ additionally requires server firmware, and neither exists inside the unprivileged container the lab runs in (iximiuz Labs). Scraping dmesg/journalctl is not a workaround either: dmesg_restrict blocks unprivileged kernel-log reads, so it would mean granting the collector root/CAP_SYSLOG and shelling out — abandoning its clean, unprivileged /proc + /sys design.

The upshot is that a live CPU error instrument would read zero in every environment Doom Perf actually runs in, with no reliable way to demonstrate a non-zero state, so it is omitted rather than shown as a permanently dead gauge. The data model itself already carries errors for every resource (src/telemetry/types.ts), and the collector populates it where an error signal is reachable: memory errors from OOM kills (/proc/vmstat oom_kill) and network errors from NIC RX/TX error counters (/proc/net/dev). CPU is simply the one resource whose USE error is purely a hardware fault.

iximiuz Labs Deployment

The iximiuz Labs playground scaffold lives under playground/iximiuz/. It follows the same rootfs-image pattern as the use-practice playground:

  • playground/iximiuz/Dockerfile builds the browser bundle and telemetry binary, then installs them into an iximiuz Ubuntu 24.04 rootfs image.
  • Nginx listens on 0.0.0.0:8080, serves public/, and proxies /telemetry and /healthz to the local Go telemetry service on 127.0.0.1:9999.
  • systemd starts doomperf-telemetry, nginx, and a bootstrap readiness check.
  • playground/iximiuz/manifest.yaml exposes a terminal tab and a Doom Perf http-port tab on port 8080. The tab serves a launcher at /; the game runs at /game/ so it can be opened in a separate browser tab and receive direct keyboard input outside the iximiuz iframe.

Build and publish the rootfs image from the repository root:

docker build -f playground/iximiuz/Dockerfile -t ghcr.io/lpmi-13/doom-perf-rootfs:vTAG .
docker push ghcr.io/lpmi-13/doom-perf-rootfs:vTAG

Then publish or start the playground with playground/iximiuz/manifest.yaml. The Doom Perf tab should open through the iximiuz-generated HTTPS domain. Click Open Game from that tab to launch /game/ in a separate browser tab; the browser should connect to telemetry using the same origin at /telemetry.

Bundled use-practice load generator

The image also bundles the use-practice load generator so lab users can create real host CPU/memory/disk/network load and watch it in the game's live-stats mode:

use-practice run            # pick a resource + profile
use-practice run cpu        # or target cpu|memory|disk|network directly
use-practice status         # active run + PIDs
use-practice reveal         # show the answer
use-practice stop           # end the run

At playground startup, the init task also installs the latest use-tool release for the VM architecture and verifies the archive against the release checksums. For example:

use-tool practice system

The Dockerfile copies the prebuilt dispatcher, workload binaries, scenarios, and privileged helper out of a pinned use-practice rootfs image (only those paths ship — the rest of that image is build-time cache, not baked in):

ARG USE_PRACTICE_ROOTFS=ghcr.io/lpmi-13/use-practice-rootfs:v12

To adopt a newer use-practice, publish its rootfs image first, then bump that tag (or override at build time with --build-arg USE_PRACTICE_ROOTFS=...:vNN) and rebuild doom-perf. The image adds iproute2, sudo, and sysstat for the namespace/cgroup privilege paths and the terminal USE tools the scenarios print as hints. CPU, memory, and disk load are host-global and show up in the game immediately; the network scenario drives traffic inside a network namespace, so confirm how it surfaces in the network wing on a live lab.

Architecture

Browser
  public/index.html
    -> public/game/index.html
       -> public/dist/index.js
          -> patched Doom WASM engine
          -> Doom Perf PWAD
       -> telemetry EventSource

Local telemetry service
  cmd/telemetry/main.go
    -> /proc and /sys sampling
    -> SSE stream

Build inputs
  src/                 TypeScript browser host, telemetry, and UI
  wasm/                Emscripten platform adapters
  patches/             Per-file linuxdoom-1.10 engine patches
  scripts/             map and engine build scripts

The original id Software C source is not committed here. The engine rebuild script expects a clean external linuxdoom-1.10 tree and stages it into .build/doom/linuxdoom-1.10 before applying Doom Perf patches.

Doom Perf Engine Patches

The patches under patches/doom/linuxdoom-1.10/ are the source of truth for changes to the Doom C engine. There is exactly one patch per modified engine file: each <file>.patch holds the complete cumulative Doom Perf delta for that source file. Because every patch touches a distinct file, the set is order-independent — the build applies them in lexical order purely for deterministic output, not because any patch depends on another. Each patch begins with a header comment listing the original per-feature changes it bundles. To revise an engine feature, edit the one patch for the file it lives in (or regenerate it by diffing a clean tree against the staged build tree).

Patch (file) Bundled Doom Perf changes
d_main.c.patch Allow the project PWAD with the base IWAD; hold the opening title page instead of cycling demos; uncapped render loop; title oo load-pulse wiring.
g_game.c.patch Ignore fire and weapon-selection controls.
hu_stuff.c.patch Show the active scenario title on the automap.
i_system.c.patch Keep the zone-heap size initializer (mb_used) in sync with the m_misc.c defaults table at 16 MB (avoids a fragmentation Z_Malloc black screen).
info.c.patch Run-queue and blocked I/O-wait orb actor states; dim tall red torches; orb spawn/despawn polish; cyan RX / violet TX network packet orbs; memory-well book fill; RJ45 link/activity LEDs.
info.h.patch Declarations for the orb, network-packet, book, and LED actor states.
m_menu.c.patch Simplified Doom Perf title menu; paged data-source selection (live plus CPU/disk/memory/network sim modes); automap scenario title; title oo load pulse; trimmed options menu; disabled F-key shortcuts and deleted the classic Load/Save/Sound/Options/Episode menus.
m_misc.c.patch Raise the zone-heap default (mb_used) from 2 to 16 MB — the defaults table is what actually sizes the zone at boot.
p_doors.c.patch Remove key requirements from locked doors.
p_inter.c.patch Make the observer immune to damage.
p_map.c.patch Suppress the original USE wall-bump grunt around terminal screens.
p_mobj.c.patch Suppress monster and lost-soul spawning; strip normal gameplay items while keeping selected lab props.
p_tick.c.patch Per-tick instrument drivers for all four wings: CPU pillar sink and run-queue orbs; disk platter pulse/spindle, metrics dashboard, IOPS bank, df sunburst, queue couriers, and latency-causeway pistons; memory RSS barrels, page-fault meters, reclaim sluice, OOM-killer Baron, and spire book-fill; network packet grove, gate-metered lane signals, softnet coils, qdisc, and ethernet LEDs.
p_user.c.patch Latency causeway: scale player forward/side thrust by the storage wing's read/write await so the crossing is dragged, leaving turning instant.
r_bsp.c.patch Raise MAXSEGS (solidsegs clip table) 32→256 so a dense single-view can never overflow it into a black screen; capture the peak drawseg count for the perf harness.
r_data.c.patch Allow project sprite replacements for lab signs.
r_defs.h.patch Raise MAXDRAWSEGS so dense wall geometry (esp. the network substation hall) renders fully instead of dropping segs.
r_draw.c.patch CPU floor instruments (cores, column streaks, pads, load gauges) and disk floor instruments (latency, queue channel, metrics dashboard, platter spindle); network qdisc disc and faceplate shader; sim-mode level select.
r_main.c.patch Full 320x200 view (suppress the status bar); camera viewpoint interpolation; flattened light diminishing.
r_plane.c.patch CPU core floor display; disk queue channel and platter spindle; network qdisc floor sentinels; peak-visplane counter.
r_segs.c.patch Wall-surface instruments: CPU core streaks/floor, CPU load gauge band, disk latency gauges, disk metrics dashboard, disk platter spindle; flattened light diminishing.
r_things.c.patch Hide first-person weapon sprites and muzzle flash; allow PWAD sprite overrides; hide the viewplayer body sprite; peak-vissprite counter.
r_things.h.patch Raise the vissprite limit 128→1024 (the memory spire alone is ~180 book sprites).
st_stuff.c.patch Suppress the original status bar HUD.
v_video.c.patch Title oo load-pulse palette remap in V_DrawPatch.
z_zone.c.patch Instrument the zone allocator (publish total size and high-water usage) so the perf harness can right-size the heap.

Rebuild the engine from a clean Doom source checkout:

DOOM_SRC_DIR=/path/to/DOOM/linuxdoom-1.10 npm run build:engine

DOOM_PATCH_DIR overrides the patch directory and DOOM_PLATFORM_DIR overrides the Emscripten adapter directory.

Doom Perf Map

The readable map generator is scripts/build-doomperf-map.mjs. It writes:

public/maps/doomperf-lab.wad

The map currently provides a central atrium and labeled CPU, memory, storage, and network wings. All four wings are fully instrumented with live, engine-driven visuals and terminal read points.

  • CPU is instrumented with a core chamber (per-core utilization plus run-queue saturation on the core pillars), run-queue subway, blocked-task pen, and load-average gauge room.
  • Memory is instrumented with a central book-fill spire (physical-memory utilization), a swap/reclaim saturation sluice, a minor/major page-fault firing range, an OOM-killer Baron patrolling per-process RSS barrels, and its terminal read points.
  • Storage is instrumented with a disk-usage sunburst, per-device IOPS rain gauges, a two-tier IO queue circuit, a latency causeway that drags the player, a pulsing platter spindle, a scrolling metrics dashboard, and terminals.
  • Network is instrumented with RX/TX packet-orb lanes and gate-metered block signals, softnet tesla coils, recv/send socket capacitor banks, a kernel-TX qdisc disc, a switchyard train tunnel with RJ45 LEDs, and its terminals.

Regenerate the map with:

npm run build:map

Build Commands

Command Purpose
npm run build Build the browser bundle and stamp cache-busting asset versions (scripts/build-web.mjs, esbuild under the hood).
npm run dev:telemetry Run the Go telemetry service and the esbuild web host (watch + serve) together.
npm run build:map Regenerate public/maps/doomperf-lab.wad and validate it.
npm run build:engine Rebuild public/engine/doom.js and public/engine/doom.wasm.
npm run test:map Run the map-builder unit tests.
npm run test:go Run Go telemetry service tests.
npm run typecheck Run TypeScript checking. This is stricter than the supported esbuild bundle path.
npm run check Run typecheck, the map-builder tests, Go tests, and the browser bundle build.
npm run perf Profile the running tab (see Profiling Harness); pass flags after --.

Profiling Harness

scripts/perf-harness.mjs measures the tab's CPU, render, and memory cost so a change can be checked before and after on a working copy without committing anything. It drives the app in a real browser (Playwright + Chrome DevTools Protocol), samples metrics, and writes a JSON snapshot to the gitignored perf-results/. Run it twice around a change and --compare the two files.

The app exposes two hooks the harness relies on:

  • ?perf-bench=1 attaches a passive in-page probe (window.__perfProbe, src/perf_probe.ts) that samples requestAnimationFrame cadence, long tasks, JS/WASM heap, DOM node count, and the engine's rendered-frame counter. It only attaches with the flag, so it costs nothing otherwise.
  • ?scenario=NAME boots straight into a fixed data source for a reproducible load, instead of live host jitter (NAME may also be a raw sim-mode index 0–11). Names: live; cpu / cpu-sat; disk / disk-sat-shallow / disk-sat-deep; mem / mem-sat / mem-noswap; net / net-rx / net-tx.

Serve the app first (npm run dev:telemetry, or node scripts/build-web.mjs --watch --serve for the web host alone), then:

# Automated before/after (headless, scripted camera motion):
node scripts/perf-harness.mjs --mode tour --label before --scenario cpu-load --duration 30
#   …make a change, rebuild (npm run build / npm run build:engine)…
node scripts/perf-harness.mjs --mode tour --label after  --scenario cpu-load --duration 30
node scripts/perf-harness.mjs --compare perf-results/before-*.json perf-results/after-*.json

# Manual: opens a real GPU-composited window; drive it by hand; Ctrl-C stops + flushes:
node scripts/perf-harness.mjs --mode manual --label hand-tuning --scenario cpu-load

# Attach to your own Chrome (started with --remote-debugging-port=9222 --user-data-dir=…):
node scripts/perf-harness.mjs --mode attach --label real-chrome --endpoint http://localhost:9222

# All flags:
node scripts/perf-harness.mjs --help

--compare prints a delta table with a pass/fail against a 5% regression threshold and a one-line commit summary. Headless runs (the tour default) composite with software GL and have no real vsync, so absolute fps is only indicative — relative before/after deltas are the source of truth. Use --headed or --mode manual for real GPU-composited fps, and --repeat N to take the median of N tour runs against per-run noise.

Stuck-input protection

Browsers can lose a movement-key release while an operating-system shortcut owns the keyboard. Physical arrow-key presses therefore use a lease: the operating system auto-repeats only the most recently pressed key, so four seconds without a trusted down or repeat event from that key releases it. A key shadowed by a later arrow press (holding forward while tapping a turn key) legitimately stops repeating and is never released for silence. Expired repeats are ignored until a fresh non-repeat keydown begins a new press.

Blur, focus, page-hide, and hidden-visibility transitions also clear held input. Later keyboard events reconcile stale Alt, Control, and Shift state. The same behavior is used by the WebAssembly engine and TypeScript fallback.

Repository Map

Path Role
src/index.ts Browser entry point: WASM engine, telemetry, and UI wiring.
src/telemetry.ts Public telemetry exports for the browser entry point.
src/telemetry/ Telemetry source resolution, SSE client, normalization, and shared types.
src/ui/terminalOverlay.ts Linux-command-style terminal overlay renderers for the resource wings.
src/ui/movementPad.ts Touch movement controls.
src/ui/menuControls.ts Touch controls for the native Doom menu.
src/engine_bootstrap.ts WASM engine bootstrap and data file mounting.
src/perf_probe.ts In-page profiling probe (window.__perfProbe) behind ?perf-bench=1.
scripts/perf-harness.mjs Playwright + CDP profiling harness (tour/manual/attach + compare).
cmd/telemetry/main.go Linux SSE telemetry service.
scripts/build-doomperf-map.mjs Project PWAD generator.
scripts/lib/wings/ Self-contained CPU, memory, storage, and network wing builders.
scripts/build-doom-wasm.sh Patch and compile pipeline for the Doom C engine.
wasm/ Emscripten adapters and Doom Perf bridge globals.
patches/doom/linuxdoom-1.10/ Per-file engine patches (one per modified source file).
public/engine/ Generated patched engine artifacts.
public/maps/ Generated Doom Perf PWAD.
public/wads/ Runtime IWAD files and Freedoom license notice.
VISUAL_REVAMP.md Design notes for the CPU wing revamp.

License

The original Doom source code is released under GPLv2. Doom Perf keeps the browser-port code under the same GPLv2-compatible footing as the forked doom-typescript project.

The bundled base IWAD is Freedoom Phase 1 (public/wads/freedoom1.wad), which is distributed under the Freedoom license notice in public/wads/COPYING.txt. Local Doom1.WAD files are not required and are intentionally ignored/excluded from Docker packaging.

Acknowledgments

  • id Software for open-sourcing the Doom engine
  • The original doom-typescript browser port this project was forked from
  • GitHub Copilot CLI for the original browser-port migration work
  • Playwright MCP for browser rendering and scaling debugging

About

An extended wasm-based Doom game that lets you explore system telemetry from a linux VM

Resources

Stars

8 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages