SyntheticSampler
A PlatformSampler that reports a script instead of the machine (monitor-load-color §MHD-9).
| Inherits | PlatformSampler |
In the namespace monitor::testing. Declared in src/libs/libmonitor/monitor/testing/SyntheticSampler.hpp.
Detailed description
It gives cores, a GPU, memory, a disk, an interface, a filesystem and processes, with no load on the machine and no read of /proc. So the full range of the load colors can be seen on an idle machine, and two captures of a scene are the same picture on every machine.
- Calibration: fixed rows at shares 0.25, 0.5, 1, 2, 4 … the machine share for each channel, and the mixes CPU + memory, CPU + VRAM, memory + VRAM and all three, at equal and at 4 : 1 shares.
- Sweep: every row ramps from 0 to the machine share and back over a period of ticks: linear to one core, then one equal step per doubling, so a row passes through every step of the scale.
- Frozen: one fixed snapshot, for a scene. setFrozen() replaces it.
A share is in units of one core's worth, as the process list reads it (§CU-PG.9). The sampler reports it in the sampler's own units: the CPU percent is core-scaled (100 is one core), and the memory and VRAM percents are of the whole machine, which the list multiplies by the core count.
It is also the scripted sampler of testResourceMonitor: an interface set, a stall inside sample() and the counts of requests served.
Test support only. No OPAL task and no setting switches a running app to it, because a user must never see invented loads as real ones (§MHO-1).
sample() runs on the monitor's worker thread and the setters on the GUI thread, so the state is under a lock.