Skip navigation.
Home
The QNX Community Portal

View topic - CPU utilization for a multiple cpu computer and calculating

CPU utilization for a multiple cpu computer and calculating

Read-only archive of qnx.rtos (Writing resources managers, and general discussion around the QNX Neutrino RTOS) at inn.qnx.com

CPU utilization for a multiple cpu computer and calculating

Postby sabtain » Tue Nov 06, 2007 7:05 pm

Hello,
I am writing a c++ program for calculating CPU utilization of a
computer that has multiple CPUs. If anyone knows of a API or library
call,please inform me.

Also, what is the quickest way to find the amount of free space on a mount
point for a c++ program.

Thanks,

Sabtain
sabtain
 

Re: CPU utilization for a multiple cpu computer and calculat

Postby Colin Burgess » Tue Nov 06, 2007 10:56 pm

Hi Sabtain,

Use ClockTime() to generate a clock id for the first <ncpu> threads of procnto (pid 1).
They are the idle threads for each processor.

You can then poll them at regular intervals to gauge how long they have been running.
The processor usage can be determined by the ratio of interval to nsecs executed.

Regards,

Colin

sabtain wrote:
Hello,
I am writing a c++ program for calculating CPU utilization of a
computer that has multiple CPUs. If anyone knows of a API or library
call,please inform me.

Also, what is the quickest way to find the amount of free space on a mount
point for a c++ program.

Thanks,

Sabtain



--
cburgess@qnx.com
Colin Burgess
 

Re: CPU utilization for a multiple cpu computer and calculat

Postby sabtain » Wed Nov 07, 2007 2:28 pm

Thanks for replying but I have a further quesiton. Even on a single
processor PC, the procnto has 11 threads running. what does that mean?


"Colin Burgess" <cburgess@qnx.com> wrote in message
news:fgqr9o$o8e$1@inn.qnx.com...
Hi Sabtain,

Use ClockTime() to generate a clock id for the first <ncpu> threads of
procnto (pid 1).
They are the idle threads for each processor.

You can then poll them at regular intervals to gauge how long they have
been running.
The processor usage can be determined by the ratio of interval to nsecs
executed.

Regards,

Colin

sabtain wrote:
Hello,
I am writing a c++ program for calculating CPU utilization of a
computer that has multiple CPUs. If anyone knows of a API or library
call,please inform me.

Also, what is the quickest way to find the amount of free space on a
mount point for a c++ program.

Thanks,

Sabtain

--
cburgess@qnx.com
sabtain
 

Re: CPU utilization for a multiple cpu computer and calculat

Postby Colin Burgess » Wed Nov 07, 2007 3:13 pm

procnto starts a threadpool to handle it's resource managers. In a normal scenario they are pretty much all idle,
awaiting messages.

sabtain wrote:
Thanks for replying but I have a further quesiton. Even on a single
processor PC, the procnto has 11 threads running. what does that mean?


"Colin Burgess" <cburgess@qnx.com> wrote in message
news:fgqr9o$o8e$1@inn.qnx.com...
Hi Sabtain,

Use ClockTime() to generate a clock id for the first <ncpu> threads of
procnto (pid 1).
They are the idle threads for each processor.

You can then poll them at regular intervals to gauge how long they have
been running.
The processor usage can be determined by the ratio of interval to nsecs
executed.

Regards,

Colin

sabtain wrote:
Hello,
I am writing a c++ program for calculating CPU utilization of a
computer that has multiple CPUs. If anyone knows of a API or library
call,please inform me.

Also, what is the quickest way to find the amount of free space on a
mount point for a c++ program.

Thanks,

Sabtain
--
cburgess@qnx.com



--
cburgess@qnx.com
Colin Burgess
 

Re: CPU utilization for a multiple cpu computer and calculat

Postby John Garvey » Wed Nov 07, 2007 3:29 pm

sabtain wrote:
Also, what is the quickest way to find the amount of free space on a mount
point for a c++ program.

Look at the statvfs() function ...
John Garvey
 


Return to qnx.rtos

Who is online

Users browsing this forum: No registered users and 4 guests