Get the system load?

Is there any programmatic way to retrieve the load of the system on QNX
6 (such as returned by uptime)? I don’t see functions such as
kstat_open() or pstat_getdynamic()… ?

Paul D. Smith <pausmith@nortelnetworks.com> HASMAT–HA Software Mthds & Tools
“Please remain calm…I may be mad, but I am a professional.” --Mad Scientist

These are my opinions—Nortel Networks takes no responsibility for them.

Paul D. Smith <pausmith@nortelnetworks.com> wrote:

Is there any programmatic way to retrieve the load of the system on QNX
6 (such as returned by uptime)? I don’t see functions such as
kstat_open() or pstat_getdynamic()… ?

Here’s the example from ClockID

id = ClockId(1, 1);
for( ;; ) {
ClockTime(id, NULL, &start);
sleep(1);
ClockTime(id, NULL, &stop);
printf(“load = %f%%\n”, (1000000000.0 - (stop-start)) / 10000000.0);
}

I would add

ClockTime( CLOCK_REALTIME, &real_start );
ClockTime( CLOCK_REALTIME, &real_stop );

around the sleep so that you can get the exact interval that the
program slept for (it’s not always going to be exactly 1000000000.0)


cburgess@qnx.com

Thanks.

So, there’s no historical load maintained by the system (lots of UNIX
boxes have a way to tell you the load at 1 minute ago, 5 minutes ago,
and 15 minutes ago; these values are maintained by the kernel)?

Paul D. Smith <pausmith@nortelnetworks.com> HASMAT–HA Software Mthds & Tools
“Please remain calm…I may be mad, but I am a professional.” --Mad Scientist

These are my opinions—Nortel Networks takes no responsibility for them.

Paul D. Smith <pausmith@nortelnetworks.com> wrote:

Thanks.

So, there’s no historical load maintained by the system (lots of UNIX
boxes have a way to tell you the load at 1 minute ago, 5 minutes ago,
and 15 minutes ago; these values are maintained by the kernel)?

No. We’re not UNIX. ;v)

But it would be trivial to make a resmgr that would do this.

Oh no, the ‘T’ word!

Colin


\

cburgess@qnx.com

%% Colin Burgess <cburgess@qnx.com> writes:

So, there’s no historical load maintained by the system (lots of UNIX
boxes have a way to tell you the load at 1 minute ago, 5 minutes ago,
and 15 minutes ago; these values are maintained by the kernel)?

cb> No. We’re not UNIX. ;v)

cb> But it would be trivial to make a resmgr that would do this.

Nah.

I’m just trying to get GNU make’s -l option to work on QNX.

Paul D. Smith <pausmith@nortelnetworks.com> HASMAT–HA Software Mthds & Tools
“Please remain calm…I may be mad, but I am a professional.” --Mad Scientist

These are my opinions—Nortel Networks takes no responsibility for them.

Paul D. Smith <pausmith@nortelnetworks.com> wrote:

%% Colin Burgess <> cburgess@qnx.com> > writes:

So, there’s no historical load maintained by the system (lots of UNIX
boxes have a way to tell you the load at 1 minute ago, 5 minutes ago,
and 15 minutes ago; these values are maintained by the kernel)?

cb> No. We’re not UNIX. ;v)

cb> But it would be trivial to make a resmgr that would do this.

Nah.

I’m just trying to get GNU make’s -l option to work on QNX.

QNX’s scheduling model doesn’t really match the idea of a load
average either, not entirely. We don’t do any sort of fair-share
between higher and lower priorities, we do a fully pre-emptive
scheduling.

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.