linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "John T. Williams" <jowillia@vt.edu>
To: Llfrg@aol.com, linux-c-programming@vger.kernel.org
Subject: Re: Monitoring a program
Date: Mon, 1 Mar 2004 21:39:09 -0500	[thread overview]
Message-ID: <000901c3ffff$8a57f770$ed64a8c0@descartes> (raw)
In-Reply-To: 183D9E9B.3D6733E9.0000FADF@aol.com

I'm not sure what you mean by every part of the execution.

however you could do a very simple program in that record the exicution time
of its child process.

----------------main.c-------------------------------
#include <sys/times.h>
#include <sys/param.h>
#include <wait.h>

char* prog = "/bin/bash";
char* arglist[] = {
 "bash",
 0
};


int main () {
 int pid, status;
 struct tms systime;
 time_t point[2];
 int elaps;
 int ktime;
 int utime;
 int ttime;
 int itime;

 time(&point[0]);
 if( (pid = fork()) == 0 ) {
  execv(prog, arglist);
  printf("execv error\n");
  _exit(0);
 }

 wait(&status);
 time(&point[1]);
 times(&systime);


 elaps = point[1] - point[0];
 ktime = systime.tms_cstime / HZ;
 utime = systime.tms_cutime / HZ;
 ttime = ktime + utime;
       itime = elaps - ttime;

 printf("total time for of exicution: %i\n", ttime);
 printf("time in kernel for process:  %i\n", ktime);
 printf("time in user space:          %i\n", utime);
 printf("idile time:                  %i\n", itime);
 printf("total elaps time:            %i\n", elaps);


}
-------------End main.c--------------------------------












----- Original Message ----- 
From: <Llfrg@aol.com>
To: ""John T. Williams"" <jtwilliams@vt.edu>
Sent: Monday, March 01, 2004 7:21 PM
Subject: Re: Monitoring a program


> Ok, but I would like to have specific information on every part of the
execution, not only the total time. The objective of all this is to have a
profiling tool that measures performance of parallel programs. I wish to
find out load imbalance on different processors at different times on the
execution of parallel programs. I intend to run the profiling program on
every node and then compare their statistics.
>
> Thanks,
> Leonardo.


       reply	other threads:[~2004-03-02  2:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <183D9E9B.3D6733E9.0000FADF@aol.com>
2004-03-02  2:39 ` John T. Williams [this message]
2004-03-02 12:12 Monitoring a program Llfrg
  -- strict thread matches above, loose matches on Subject: below --
2004-03-02  0:02 Llfrg
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

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='000901c3ffff$8a57f770$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).