EXP: log trims (do not merge)

This commit is contained in:
Chuck
2026-10-04 22:48:51 -04:00
parent 6ee1365ebf
commit e04b49a5b7
2 changed files with 9 additions and 3 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ if project_dir not in sys.path:
# stay): the in-process twin of the unit's MALLOC_ARENA_MAX=2, for units
# installed before that line. A no-op off glibc. See src/malloc_tuning.py.
from src import malloc_tuning
malloc_tuning.cap_arenas()
print('EXP cap_arenas=%s' % malloc_tuning.cap_arenas(), flush=True)
# Under systemd the watchdog clock is already running, and start-up (plugin
# loads, initial updates) takes far longer than the render loop's limit. Widen
+8 -2
View File
@@ -117,6 +117,12 @@ class MallocTrimmer:
logger.debug("malloc_trim failed; not trying again", exc_info=True)
self._libc = None
return False
logger.debug("malloc_trim(0) took %.1f ms, released=%s",
(self._clock() - now) * 1000.0, released)
def _rss():
try:
with open('/proc/self/statm') as f:
return int(f.read().split()[1]) * 4096 // 1024
except Exception:
return -1
logger.info("EXP malloc_trim(0) took %.1f ms, released=%s rss_kb_after=%d",
(self._clock() - now) * 1000.0, released, _rss())
return released