Measure host load every 10 seconds during an execution
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > Measure host load every 10 seconds during an execution




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Measure host load every 10 seconds during an execution  
pj


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-28-04 11:19 PM

Hi,

I want to measure host loads (using getloadavg()) every 10 seconds
while I am running an application which is written in C, and write the
host load average during the application execution to a file right
before the application ends.

I want to modify (instrument) the source code and call the getloadavg
every 10 seconds during an execution. I don't want to create a child
process to run an application while the parent process measures the
load. is there a way to instrument the application source code so that
I can call getloadavg() every 10 seconds until the execution ends?

thanks a lot for any input on this.
pj





[ Post a follow-up to this message ]



    Re: Measure host load every 10 seconds during an execution  
Eric Sosman


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-28-04 11:19 PM

pj wrote:
> Hi,
>
> I want to measure host loads (using getloadavg()) every 10 seconds
> while I am running an application which is written in C, and write the
> host load average during the application execution to a file right
> before the application ends.
>
> I want to modify (instrument) the source code and call the getloadavg
> every 10 seconds during an execution. I don't want to create a child
> process to run an application while the parent process measures the
> load. is there a way to instrument the application source code so that
> I can call getloadavg() every 10 seconds until the execution ends?

You could launch a separate thread to gather the data.
In this context, though, there's really not much difference
between running a separate thread and running a separate
process, except that running a separate process might be
a little easier.

--
Eric.Sosman@sun.com






[ Post a follow-up to this message ]



    Re: Measure host load every 10 seconds during an execution  
Pascal Bourguignon


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-29-04 01:47 AM

nsf470@yahoo.com (pj) writes:

> Hi,
>
> I want to measure host loads (using getloadavg()) every 10 seconds
> while I am running an application which is written in C, and write the
> host load average during the application execution to a file right
> before the application ends.
>
> I want to modify (instrument) the source code and call the getloadavg
> every 10 seconds during an execution. I don't want to create a child
> process to run an application while the parent process measures the
> load. is there a way to instrument the application source code so that
> I can call getloadavg() every 10 seconds until the execution ends?
>
> thanks a lot for any input on this.
> pj

Yes, that's very useful to try to get the load average every 10
seconds when the system updates the fastest load average only every
minute!


The getloadavg() function returns the number of processes in the system
run queue averaged over various periods of time.  Up to nelem samples are
retrieved and assigned to successive elements of loadavg[].  The system
imposes a maximum of 3 samples, representing averages over the last 1, 5,
and 15 minutes, respectively.



--
__Pascal Bourguignon__                     http://www.informatimago.com/

There is no worse tyranny than to force a man to pay for what he does not
want merely because you think it would be good for him. -- Robert Heinlein





[ Post a follow-up to this message ]



    Re: Measure host load every 10 seconds during an execution  
Alex Fraser


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-29-04 07:52 AM

"Pascal Bourguignon" <spam@thalassa.informatimago.com> wrote in message
news:87llh37db2.fsf@thalassa.informatimago.com...
[snip]
> Yes, that's very useful to try to get the load average every 10
> seconds when the system updates the fastest load average only every
> minute!

Hint: rolling/moving average.

Alex







[ Post a follow-up to this message ]



    Re: Measure host load every 10 seconds during an execution  
Ian Fitchet


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-29-04 12:52 PM

Eric Sosman <Eric.Sosman@sun.com> writes:

> In this context, though, there's really not much difference
> between running a separate thread and running a separate
> process, except that running a separate process might be
> a little easier.

I wrote a little job distribution app a few years back and to keep
the load down the server processes ran "iostat -c 10" in a child
process and read the values back in through a pipe.  Quite remarkably
(or a very subtle artifact of Solaris 2.5.1 through 8) after months
of continuous operation the child iostat processes never showed any
accumulated CPU time.

Not that that helps you if you're quite determined to call
getloadavg() but interesting to note that some processes cause very
little CPU load.

Cheers,

Ian






[ Post a follow-up to this message ]



    Re: Measure host load every 10 seconds during an execution  
Pascal Bourguignon


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-29-04 01:08 PM

"Alex Fraser" <me@privacy.net> writes:

> "Pascal Bourguignon" <spam@thalassa.informatimago.com> wrote in message
> news:87llh37db2.fsf@thalassa.informatimago.com...
> [snip] 
>
> Hint: rolling/moving average.

Oops, you're right. Sorry.


--
__Pascal Bourguignon__                     http://www.informatimago.com/

There is no worse tyranny than to force a man to pay for what he does not
want merely because you think it would be good for him. -- Robert Heinlein





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 11:37 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register