On Mon, 29 Oct 2001, archan wrote:

> longback, I had written a CPU benchmark program. From that, followign

> >ct2 =        times(&cputime2) ;
> >cout << "\n usertime " <<( cputime2.tms_utime -  cputime1.tms_utime
> >     + cputime2.tms_cutime-  cputime1.tms_cutime)/(CLOCKS_PER_SEC/10000.)
> >

Your code do exactly the same thing as mine. I could not understant
tms_cutime's role. Should I add it to tms_utime or not. The relevant
portion of man 2 times and man time are appended. "time"  function uses
times function and report results by adding these two.

My doubts were as:

1) In above "cout" statement should I add difference of "tms_cutime" or
not.

2) Is there any other way ( if this is not the right method ) to note CPU
time taken by some segment of a program, which is independent of load of
PC.

3) Is it so that some variation is normal ( something like least count or
sampling error ), and can not be large enough to cause any seroius
concern. With less load I get time 1.07 sec and when movie is also going
on it gave me 1.21.

....................... man 2 times.............
NAME
       times - get process times

       The  tms_utime field contains the CPU time spent executing
       instructions of the calling process.  The tms_stime  field
       contains  the CPU time spent in the system while executing
       tasks on behalf of the calling  process.   The  tms_cutime
       field  contains  the  sum  of the tms_utime and tms_cutime
       values  for  all  waited-for  terminated  children.    The

................. man time ..........
TIME(1)                                                   TIME(1)

NAME
       time - time a simple command or give resource usage

       the user CPU time (the sum of the tms_utime and tms_cutime
       values in a struct tms as returned by times(2)), and (iii)


Thanks in advance.

H.S.Rai



_______________________________________________
linux-india-help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/linux-india-help

Reply via email to