资源统计不可靠 #3

Open
opened 2024-01-30 22:28:40 +08:00 by Paul · 0 comments
Owner

目前使用 wait4 统计内存、时间开销,但如果子进程涉及多线程,统计结果将不可靠:

I don't have a reference for this, but you can easily verify it yourself. The CPU time of a grand-child is only included in the CPU time of a child if the grand-child terminated before the child and the child has waited for the termination of the grand-child with one of the wait system calls. Otherwise the CPU time of the grand child is not yet included or even completely lost.

stackexchange

这一点在 pypy3 上得到验证:A+B 问题中 RLIMIT 设置的极限内存(76MB)与统计的内存(~50MB)存在过大差距

目前使用 `wait4` 统计内存、时间开销,但如果子进程涉及多线程,统计结果将不可靠: > I don't have a reference for this, but you can easily verify it yourself. The CPU time of a grand-child is only included in the CPU time of a child if the grand-child terminated before the child and the child has waited for the termination of the grand-child with one of the wait system calls. Otherwise the CPU time of the grand child is not yet included or even completely lost. > > [stackexchange](https://unix.stackexchange.com/questions/61244/cpu-time-measurement-with-wait4-vs-cpuacct-cgroup) 这一点在 `pypy3` 上得到验证:`A+B` 问题中 `RLIMIT` 设置的极限内存(`76MB`)与统计的内存(`~50MB`)存在过大差距
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: woj/woj-sandbox#3
No description provided.