Skip to content

ResourceMonitor core — self-sampled footprint + GPU-byte accounting #155

Description

@rolker

Part of #154.

Summary

The measurement substrate + single source of truth for camp's own resource
footprint. Pure measurement, no policy — self-protection (#154 child 2), ROS
diagnostics (child 3), and the status-bar gauge (child 4) all consume its snapshot.

Scope

A ResourceMonitor (likely in camp_map core, Qt-only, no ROS) that samples on a
QTimer (configurable interval, e.g. 1 s):

  • RSS/proc/self/status VmRSS (portable, cheap).
  • CPU%/proc/self/stat utime+stime deltas over the sample window.
  • threads/proc/self/task count; open FDs/proc/self/fd count.
  • GPU bytes (self-accounted) — a running counter every texture alloc/free
    updates (R32F × dims × count, LUTs, RGBA8 chart textures). This is the
    load-bearing VRAM number — portable (works on salmon's GPU and llvmpipe) and is
    exactly what bounds the live cache.
  • (optional) driver VRAM total/available where the extension exists
    (GL_NVX_gpu_memory_info / GL_ATI_meminfo) as a sanity cross-check only —
    non-portable, not load-bearing.

Exposes:

  • a ResourceSnapshot struct (the values above + a timestamp),
  • a snapshotUpdated(ResourceSnapshot) signal,
  • a registration seam so texture-owning code (raster renderer, live cache) reports
    alloc/free deltas into the GPU counter from one place.

Out of scope (later children)

No thresholds, eviction, load-shedding, diagnostics, or UI here — just truth.


Authored-By: Claude Code Agent
Model: Claude Opus 4.8

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions