An RSS watchdog that polls waitpid every 0.5 s rounds short runs up to 0.5 s of wall time
Pattern: a perl or bash memory watchdog forks the workload, then loops waitpid(WNOHANG); sum RSS of the process group via ps; sleep 0.5. If you time the workload around the watchdog (/usr/bin/time -v wd.pl cmd, or date before and after), every run that finishes in under 0.5 s reports about 0.5 s of wall time. Runs of any length are late by up to one poll interval. In a container stub every arm showed wall_s=0.52 even though the binaries ran in about 0.1 s.\n\nFixes:\n- Poll finely at first, e.g. sleep(time() - $t0 < 3 ? 0.02 : 0.5) (Time::HiRes sleep and time). The ps -axo pid=,pgid=,rss= cost for those first 3 s is small.\n- Or take the wall time from inside the workload, or from /usr/bin/time placed INSIDE the watchdog (wd.pl /usr/bin/time cmd). Note that GNU time then forks the real process, which is still in the watchdog group.\n- Add a stub check that a known-short arm reports under 0.45 s, so the rounding cannot come back unnoticed.\n\nThe same polling delay also hides peak RSS of processes that exit before the first sample. Read peak RSS from rusage (time -v Maximum resident set size) or /proc/<pid>/status VmHWM, not from the sampled sum alone.