astrofrog / psrecord

Record the CPU and memory activity of a process :chart_with_upwards_trend:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Child processes CPU not monitored correctly

sandervrijders opened this issue · comments

In every loop the process is queried for its children (all_children) upon which the CPU percentage is queried (get_percent). The first time get_percent is called 0 is returned however, since it uses the last measurement for a difference. Since every loop the list of children is reinitialized, only 0 is reported. So a list of child processes should be kept instead and checked if new child processes were created or if some have died. Better yet the loop can be simplified to run through the list of all processes to be monitored (if --include-children is not set than the set only contains the main process, otherwise the main process and its children) and on every process the CPU and mem usage is queried.

Fixed in Pull Request #56

This should now be fixed in psrecord v1.2 - please re-open if not!