linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: Monitoring a program
@ 2004-03-02  0:02 Llfrg
  0 siblings, 0 replies; 7+ messages in thread
From: Llfrg @ 2004-03-02  0:02 UTC (permalink / raw)
  To: linux-c-programming

Yes John, what I am trying to do is quite like your description. Only that instead of a simple program like ls, the target program would be scientific applications that take several seconds/minutes/hours executing, so that I would like to collect statistics periodically (i.e. every 0.1 second) and store it on a log file for future use (in a way similar to the vmstat command). I believe such information is not available after the execution (if it is, even better!). I would like to know ways of doing it with minimal effect on the target application performance.

John wrote:

>
Let me see if I understand what you are trying to do.  Lets pretend the
target program is ls.
Whenever ls is run by any user you would like you daemon to store
statistical information about the execution of ls.

You might have to get this information from the kernels process table.
While executing the information you want is available in the procfs, however
when the process completes the information disappears.  It has been awhile
since I took my OS class, so I'm not sure if the information is still
available in the kernel's data structures or not.  I believe it would be
until another process with the same pid runs, but there is a good chance
that I'm wrong.

Depending on what you are trying to accomplish there may be better/easier
ways to accomplish your goal.

--
John
>

Thanks,
Leonardo


^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: Monitoring a program
@ 2004-03-02 12:12 Llfrg
  0 siblings, 0 replies; 7+ messages in thread
From: Llfrg @ 2004-03-02 12:12 UTC (permalink / raw)
  To: "John T. Williams"; +Cc: linux-c-programming

By every part of the execution I mean the same kind of report the command <vmstat 1> does. I might even use vmstat, but how could I start it whenever a specific program starts? Is there a way to make vmstat work on intervals lower than one second?

Thanks,
Leonardo.

^ permalink raw reply	[flat|nested] 7+ messages in thread
[parent not found: <183D9E9B.3D6733E9.0000FADF@aol.com>]
* Monitoring a program
@ 2004-03-01 18:22 Llfrg
  2004-03-01 21:38 ` John T. Williams
  2004-03-01 22:34 ` Glynn Clements
  0 siblings, 2 replies; 7+ messages in thread
From: Llfrg @ 2004-03-01 18:22 UTC (permalink / raw)
  To: linux-c-programming

Hi,

I would like to monitor a program execution. I intend to have a program (or daemon) that, whenever the target program (whose name is to be passed as a paramenter) starts (i.e when ps -C progname returns any process), gets statistics like cpu usage and store them on a file, finishing when the target program finishes. What would be an efficient way to do that?

Thanks,
Leonardo.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-03-02 12:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-02  0:02 Monitoring a program Llfrg
  -- strict thread matches above, loose matches on Subject: below --
2004-03-02 12:12 Llfrg
     [not found] <183D9E9B.3D6733E9.0000FADF@aol.com>
2004-03-02  2:39 ` John T. Williams
2004-03-01 18:22 Llfrg
2004-03-01 21:38 ` John T. Williams
2004-03-01 22:50   ` John T. Williams
2004-03-01 22:34 ` Glynn Clements

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).