Skip to content

Process tree retrieval#7

Closed
charmitro wants to merge 2 commits intomasterfrom
process-tree-retrieval
Closed

Process tree retrieval#7
charmitro wants to merge 2 commits intomasterfrom
process-tree-retrieval

Conversation

@charmitro
Copy link
Owner

@charmitro charmitro commented May 27, 2025

The process tree retrieval failed when attempted after the monitored
process had terminated. Fix this by capturing the tree structure
during monitoring at peak memory usage.

Store the process tree snapshot when a new memory peak is detected and
return this stored tree instead of attempting post-termination
retrieval. This ensures child process information remains available
for display.

Verbose output for bash with children:

Command: cargo build
Started: 2025-05-28 00:38:31 UTC
Process ID: 1309040

Memory Usage:
  Peak RSS: 2.1 GiB (2243727360 bytes)
  Peak VSZ: 7.4 GiB (7979651072 bytes)

Process Tree: (18 processes monitored)
cargo (PID: 1309040) - Peak: 44.2 MiB
rustc (PID: 1309354) - Peak: 185.9 MiB
rustc (PID: 1309250) - Peak: 182.1 MiB
rustc (PID: 1309289) - Peak: 174.3 MiB
rustc (PID: 1309423) - Peak: 171.1 MiB
rustc (PID: 1309587) - Peak: 165.1 MiB
rustc (PID: 1309498) - Peak: 162.5 MiB
rustc (PID: 1309405) - Peak: 154.0 MiB
rustc (PID: 1309577) - Peak: 142.3 MiB
rustc (PID: 1309593) - Peak: 132.4 MiB
rustc (PID: 1309615) - Peak: 130.7 MiB
rustc (PID: 1309639) - Peak: 127.7 MiB
rustc (PID: 1309353) - Peak: 124.7 MiB
rustc (PID: 1309582) - Peak: 108.3 MiB
rustc (PID: 1309526) - Peak: 105.9 MiB
cc (PID: 1309630) - Peak: 940.0 KiB
collect2 (PID: 1309649) - Peak: 908.0 KiB
ld (PID: 1309650) - Peak: 26.7 MiB

Performance:
  Duration: 5.800s
  Samples collected: 59
  Sampling interval: 98ms

Exit Status: 0 (success)

Make verbose output mode (-v/--verbose) to provide detailed memory
usage information with process tree visualization and monitoring
metadata.

Signed-off-by: Charalampos Mitrodimas <charmitro@posteo.net>
@charmitro charmitro requested a review from panosfol May 27, 2025 23:42
@charmitro charmitro self-assigned this May 27, 2025
@charmitro charmitro added the bug Something isn't working label May 27, 2025
@charmitro charmitro force-pushed the process-tree-retrieval branch 4 times, most recently from 3199bf6 to bfb6b3c Compare May 28, 2025 00:18
@charmitro
Copy link
Owner Author

And a macOS one, FWIW:

Command: cargo b
Started: 2025-05-28 00:20:27 UTC
Process ID: 27137

Memory Usage:
  Peak RSS: 1.2 GiB (1262616576 bytes)
  Peak VSZ: 4.2 TiB (4630405857280 bytes)

Process Tree: (11 processes monitored)
cargo (PID: 27137) - Peak: 39.5 MiB
rustc (PID: 27164) - Peak: 177.6 MiB
rustc (PID: 27272) - Peak: 127.5 MiB
rustc (PID: 27274) - Peak: 125.9 MiB
rustc (PID: 27276) - Peak: 124.5 MiB
rustc (PID: 27275) - Peak: 118.1 MiB
rustc (PID: 27277) - Peak: 112.3 MiB
rustc (PID: 27280) - Peak: 98.2 MiB
rustc (PID: 27279) - Peak: 96.9 MiB
rustc (PID: 27278) - Peak: 93.3 MiB
rustc (PID: 27281) - Peak: 90.3 MiB

Performance:
  Duration: 3.501s
  Samples collected: 36
  Sampling interval: 97ms

Exit Status: 0 (success)

The process tree retrieval failed when attempted after the monitored
process had terminated. Fix this by capturing the tree structure
during monitoring at peak memory usage.

Store the process tree snapshot when a new memory peak is detected and
return this stored tree instead of attempting post-termination
retrieval.  This ensures child process information remains available
for display.

Signed-off-by: Charalampos Mitrodimas <charmitro@posteo.net>
@charmitro charmitro force-pushed the process-tree-retrieval branch from bfb6b3c to 4177400 Compare May 28, 2025 00:39
@charmitro
Copy link
Owner Author

Closed, now using srht https://lists.sr.ht/~charmitro/peak-mem-devel

@charmitro charmitro closed this Jun 4, 2025
@charmitro charmitro deleted the process-tree-retrieval branch June 8, 2025 12:01
@charmitro charmitro restored the process-tree-retrieval branch June 28, 2025 15:30
@charmitro charmitro deleted the process-tree-retrieval branch June 28, 2025 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working MODULE:PROCESS_TREE

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant