Skip to content

Show child process cpu usage in dtop#1880

Draft
aclauer wants to merge 4 commits intodevfrom
andrew/feat/dtop-subprocess-cpu-usage
Draft

Show child process cpu usage in dtop#1880
aclauer wants to merge 4 commits intodevfrom
andrew/feat/dtop-subprocess-cpu-usage

Conversation

@aclauer
Copy link
Copy Markdown
Collaborator

@aclauer aclauer commented Apr 18, 2026

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.

Closes DIM-XXX

Solution

Read the pids of any processes spawned and include their cpu usage in a drop down of the main worker.

dtop

Breaking Changes

None

How to Test

dimos --dtop --replay --replay-dir=unitree_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

  • I have read and approved the CLA.

@aclauer aclauer changed the title Initial subprocess display Show child process cpu usage in dtop Apr 18, 2026
Comment on lines +130 to +142
try:
proc = _get_process(pid)
for child in proc.children(recursive=False):
child_proc = _get_process(child.pid)
try:
name = child_proc.name()
cpu = child_proc.cpu_percent(interval=None)
result.append(ChildProcessStats(pid=child.pid, name=name, cpu_percent=cpu))
except (psutil.NoSuchProcess, psutil.AccessDenied):
pass
except (psutil.NoSuchProcess, psutil.AccessDenied):
pass
return result
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presumably _get_process raises (psutil.NoSuchProcess, psutil.AccessDenied). Then surround just that function call with try-except. Nesting the try-excepts is confusing.

Comment thread dimos/utils/cli/dtop.py
parser.add_argument(
"--log",
nargs="?",
const=f"dtop_{time.strftime('%Y%m%d_%H%M%S')}.jsonl",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it's automatically git-ignored.

Suggested change
const=f"dtop_{time.strftime('%Y%m%d_%H%M%S')}.jsonl",
const=f"dtop_{time.strftime('%Y%m%d_%H%M%S')}.ignore.jsonl",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants