Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Percent CPU Utilization?: (2 Items)
   
Percent CPU Utilization?  
Hi all,

 

I'm trying to find a way to extract/display an overall system "percent CPU
utilization" under QNX4, similar to what you might see with the "top"
program on Linux or the minimized Task Manager under MS Windows.  I would
think that there would be a standard utility for this purpose, along with a
corresponding API, but I haven't found them yet.

 

I wrote a small program to periodically call qnx_psinfo() for the idle
process and then compute the overall CPU utilization as (1 - (idle_time /
wall_time)) * 100, where "idle_time" is the tms_utime value from the
qnx_psinfo() result structure.  This works reasonably well, but after the
system has been up for a long time, tms_utime hits ULONG_MAX and just pegs
itself there, rather than wrapping around to zero (which I could deal with).
At this point, my algorithm becomes useless. 

 

Thanks in advance for any suggestions.

 

 

Thanks!!!

 

Walt Wimer

TCSA, Inc.

 

Re: Percent CPU Utilization?  
Well, I stumbled across the 'sac' utility and the qnx_osstat() system call.  These offer an interesting option, but 
raise some questions:

1.  It appears that, by default, cpu load statistics are disabled.  Enabling them requires running 'sac' with a non-zero
 value for the -i option.  What performance impact does this impose on the system???

2.  I want to use qnx_osstat() to access CPU load data within my own application.  But first I have to enable statistics
 gathering, per above.  Is there any way to do this besides the 'sac' utility?  If I must use 'sac', how can I run it so
 that it merely sets the system-wide "integration" (a.k.a. "inertia") factor and then immediately exits, e.g. from 
within /etc/config/sysinit?  I don't want to have to run it and display statistics somewhere, if I can avoid that.


Thanks!

Walt