From: "John T. Williams" <jowillia@vt.edu>
To: "John T. Williams" <jtwilliams@vt.edu>,
Llfrg@aol.com, linux-c-programming@vger.kernel.org
Subject: Re: Monitoring a program
Date: Mon, 1 Mar 2004 17:50:52 -0500 [thread overview]
Message-ID: <007d01c3ffdf$a62aab70$ed64a8c0@descartes> (raw)
In-Reply-To: 002f01c3ffd5$8379cb60$ed64a8c0@descartes
Have you considered using the 'time' program?
You could do something like (say the target program is ls again)
time ls 2>> statfile
the only problem is that you wouldn't see anything sent to stderr while the
program was executing
if you want your users to be unaware of this you could do something like
mv /bin/ls /bin/ls.bk
then make the file
/bin/ls
----------------------------------------
#!/bin/bash
time ls 2>> statfile
----------------end file---------------
----- Original Message -----
From: "John T. Williams" <jowillia@vt.edu>
To: <Llfrg@aol.com>; <linux-c-programming@vger.kernel.org>
Sent: Monday, March 01, 2004 4:38 PM
Subject: Re: Monitoring a program
> 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
>
> ----- Original Message -----
> From: <Llfrg@aol.com>
> To: <linux-c-programming@vger.kernel.org>
> Sent: Monday, March 01, 2004 1:22 PM
> Subject: Monitoring a program
>
>
> > 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.
> > -
> > To unsubscribe from this list: send the line "unsubscribe
> linux-c-programming" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
>
> -
> To unsubscribe from this list: send the line "unsubscribe
linux-c-programming" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2004-03-01 22:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-01 18:22 Monitoring a program Llfrg
2004-03-01 21:38 ` John T. Williams
2004-03-01 22:50 ` John T. Williams [this message]
2004-03-01 22:34 ` Glynn Clements
-- strict thread matches above, loose matches on Subject: below --
2004-03-02 0:02 Llfrg
[not found] <183D9E9B.3D6733E9.0000FADF@aol.com>
2004-03-02 2:39 ` John T. Williams
2004-03-02 12:12 Llfrg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='007d01c3ffdf$a62aab70$ed64a8c0@descartes' \
--to=jowillia@vt.edu \
--cc=Llfrg@aol.com \
--cc=jtwilliams@vt.edu \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).