How can I get the processor load for a process if I only know the PID? MAXOS X
I looked at older source codes for MACOSX and I found some important functions in libtop.c
libtop_p_proc_table_read(boolean_t reg)
libtop_p_task_update()
libtop_pinfo_update_cpu_usage()
The problem is that I don’t understand how they get% CPU utilization from this huge amount of MACOS specific “machine cores”. Does anyone have a solution for this?
I am the source that they get system_time, user_time, total_time.
Am I total_time from the start of the process or what? Or maybe total_time is 1 second.
For example, my results are: for the Opera browser:
pid: 1214 user: 653.517582sec system: 193.597306sec total: 847.114888sec
Correct the information from the top utility:
-%
1214- 8.0 14: 04.52
, 8.0%.
- .
: 847 14 04
, - .
, - .