Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get the %CPU of a program

Status
Not open for further replies.

shayzu

Programmer
Mar 4, 2002
3
0
0
IL
Hi
I'm writing a monitor program, that is suppoed to calculate the %CPU of a program.

In order to do so, I call the getprocs() function, and use the
pi_ru.ru_utime -user time used
pi_ru.ru_stime -system time used.
of struct procsinfo.

The sum of the above field was compared to the value of the TIME column in the output of the ps command - and the result is absolutely different.

Could anyone tell me if the above values really hold the CPU time, or is there another way to get that information ?

Thanks

Shay
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top