[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bgl-discuss] cpu time also cycles



Hi Steven,

>CPU time as returned by getrusage  continues to cycle after somewhat
>more than 7 hours.  so nothing has been corrected in the area of
>timing.
>  
>

Other system related things such as IO node kernel and ramdisk staff
also has not been changed a lot( which is good to me :-> ).


I guess that ru_utime and ru_stime in struct rusage are converted
from cpu tick counter. Powerpc 440 processor has 64-bit tick counter.
If getrusage() is based on ppc tick counter and goes wrong more than
7 hour, the tick counter might be initilized...


If the following code works well, we might be able to use the tick counter.
also getrusage() might be forwarded to CIOD.


uint64_t a,b;

a = rdtsc();

/* something more than 7 hour */

b = rdtsc();

if( b<a ) printf("something wrong...\n")
else {
printf("time used: approx. %llu second\n",
(b-a)/(699000000) );
}




/*===============
*rdtsc()
*===============*/
__inline__ unsigned long long int rdtsc(void)
{
unsigned long long int result=0;
unsigned long int upper, lower,tmp;
__asm__ volatile(
"loop: \n"
"\tmftbu %0 \n"
"\tmftb %1 \n"
"\tmftbu %2 \n"
"\tcmpw %2,%0 \n"
"\tbne loop \n"
: "=r"(upper),"=r"(lower),"=r"(tmp)
);
result = upper;
result = result<<32;
result = result|lower;

return(result);
}




>steve
>
>- --------------------------------------------------------------------
>To add or remove yourself from this mailing list, use the 'notifyme'
>command on any BGL machine. To remove: notifyme -n, to add: notifyme -y.
>
>  
>

- --------------------------------------------------------------------
To add or remove yourself from this mailing list, use the 'notifyme'
command on any BGL machine. To remove: notifyme -n, to add: notifyme -y.