OpenQNX :: The QNX Community Portal

Aug 21, 2008 - 06:24 AM
Google
  Web openqnx.com   
     Create an account Home · Submit News · QNX Forums · QNX Download · Search   
_
Main Menu
Who's Online
There are 41 unlogged users and 0 registered users online.

You can log-in or register for a user account here.

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
sabtain
Post subject: CPU utilization for a multiple cpu computer and calculating   PostPosted: Nov 06, 2007 - 07:05 PM
Guest





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
 
   
Reply with quote Back to top
Colin Burgess
Post subject: Re: CPU utilization for a multiple cpu computer and calculat  PostPosted: Nov 06, 2007 - 10:56 PM
Guest





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:
Quote:
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
 
   
Reply with quote Back to top
sabtain
Post subject: Re: CPU utilization for a multiple cpu computer and calculat  PostPosted: Nov 07, 2007 - 02:28 PM
Guest





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...
Quote:
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
 
   
Reply with quote Back to top
Colin Burgess
Post subject: Re: CPU utilization for a multiple cpu computer and calculat  PostPosted: Nov 07, 2007 - 03:13 PM
Guest





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

sabtain wrote:
Quote:
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
 
   
Reply with quote Back to top
John Garvey
Post subject: Re: CPU utilization for a multiple cpu computer and calculat  PostPosted: Nov 07, 2007 - 03:29 PM
Guest





sabtain wrote:
Quote:
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 ...
 
   
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2007 The PNphpBB Group
Credits
All logos and trademarks in this site are property of their respective owners. The comments are property of their posters.
Powered by OpenQNX: The QNX Community Portal Site
QNX and the QNX logo are registered trademarks of QNX Software Systems.