Conversation
Greptile SummaryThis PR extends dtop to collect and display CPU usage of child processes spawned by each worker, adds a Confidence Score: 5/5Safe to merge; all findings are P2 memory-growth issues that don't affect correctness. Both new comments are P2 (unbounded growth in dimos/core/resource_monitor/stats.py and dimos/utils/cli/dtop.py for the cache-cleanup gaps. Important Files Changed
Sequence DiagramsequenceDiagram
participant M as StatsMonitor
participant S as stats.py
participant LC as LCM
participant D as dtop TUI
loop every poll interval
M->>S: collect_process_stats(worker_pid)
S-->>M: ProcessStats (parent CPU, mem, …)
M->>S: collect_children_stats(worker_pid)
S->>S: proc.children(recursive=False)
loop each child pid
S->>S: _get_process(child.pid) → cached Process
S->>S: cpu_percent(interval=None)
end
S-->>M: list[ChildProcessStats]
M->>M: ps_dict[cpu_percent] += Σ child cpu
M->>M: WorkerStats(…, children=[…])
M->>LC: publish ResourceStatsMessage
end
LC-->>D: _on_msg(msg)
D->>D: write JSONL line (if --log)
D->>D: _refresh() → render child rows under each worker
Reviews (6): Last reviewed commit: "Add log flush" | Re-trigger Greptile |
Problem
dtop only shows cpu usage for Python workers spawned by DimOS. Any native modules spawned by that worker don't show up in the cpu statistics. Also add --log flag to log dtop statistics and dtop-plot to generate plots of cpu usage.
Closes DIM-XXX
Solution
Read the pids of any processes spawned and include their cpu usage in a drop down of the main worker.
Breaking Changes
None
How to Test
dimos --dtop --replay --replay-db=go2_bigoffice run unitree-go2
and
dtop
When dimos spawns the viewer, it will show up as a subprocess of the rerun bridge worker.
Contributor License Agreement