MCPcopy Create free account
hub / github.com/PHPantom-dev/phpantom_lsp / get_rss_kib

Function get_rss_kib

benches/memory_usage.py:410–421  ·  view source on GitHub ↗

Read VmRSS from /proc/ /status. Returns KiB or None.

(pid: int)

Source from the content-addressed store, hash-verified

408
409
410def get_rss_kib(pid: int) -> int | None:
411 """Read VmRSS from /proc/<pid>/status. Returns KiB or None."""
412 try:
413 status = Path(f"/proc/{pid}/status").read_text()
414 for line in status.splitlines():
415 if line.startswith("VmRSS:"):
416 # Format: "VmRSS: 12345 kB"
417 parts = line.split()
418 return int(parts[1])
419 except (FileNotFoundError, ProcessLookupError, IndexError, ValueError):
420 return None
421 return None
422
423
424def sample_rss(

Callers 1

sample_rssFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected