Files
zoneminder/scripts/ZoneMinder
Isaac ConnorandClaude Opus 5 ab08d37588 fix: merge OpenBSD top cpu parsing into Server::CpuUsage
The openbsd branch and master both changed the top fallback in CpuUsage
and diverged. Combine them:

- Keep master's /proc/stat diagnostics: report why /proc/stat could not
  be read (ProcSubset=pid mount namespace vs open failure), default the
  fields split out of top output so an empty result does not warn under
  -w, and only complain once per process.
- Keep the openbsd branch's parse_bsd_top_cpu(): OpenBSD top prints CPU
  states in a format neither the FreeBSD nor the Linux grep matches, so
  when the greps produce no numbers, parse raw top output. It handles
  both the aggregate "CPU states:" line and per-core "CPU0 states:"
  lines, averaging over the lines seen, and does not depend on padding.
- Carry over scripts/ZoneMinder/t/server_cpu.t covering it.

Tests: prove -Iscripts/ZoneMinder/lib scripts/ZoneMinder/t/server_cpu.t
-> 16/16 pass. perl -c on Server.pm is clean.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kfiom9RefM75GTZFkqpJo2
2026-08-15 11:16:03 -04:00
..