measureing host loads until a task is finished.

P

pj

Hi,

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

i.e.,
--- Application is started
--- measure load average (using `uptime`) every 10 seconds
during the
execution
--- Application is terminated.
--- calculate the load average and print it out

My question is how can I run system(uptime) every 10 seconds during
the application execution using one processor machine? I was thinking
of having two threads, but the thread blocks the other until it is
terminated which is not what I want. I need to run two jobs (uptime
every 10 seconds and an application executable) simultaneously and
uptime should stop when the application is finished and print out the
average. thanks for any help in advance
 
M

Mark A. Odell

(e-mail address removed) (pj) wrote in

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

What is it today with these "nothing to do with the C language" questions?
PJ, there is no threading in C and what an implementation does with the
uptime command passed to system() is platform-specific. Your question
cannot be answered here. It may be answerable in comp.unix.programmer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top