Subject: garbage in `ru_utime.tv_sec' field
To: None <netbsd-help@NetBSD.ORG>
From: Anatol Raportirenko <ram@sundg1.jinr.dubna.su>
List: port-sparc
Date: 04/20/1995 12:36:23
HELP! all,
I ran NetBSD-current on sparc IPX, compiled from sources dated 8 Apr,
and sometimes have got garbage in field `ru_utime.tv_sec', after call to
`getrusage'.
This two simple function I used to set initial time counters `MS_clock_init',
and to receive current time in miliseconds `MS_clock'.
void
MS_clock_init ()
{
if (getrusage (RUSAGE_SELF, &rusage0))
{
strout ("getrusage error\n", -1);
abort ();
}
}
long
MS_clock ()
{
if (getrusage (RUSAGE_SELF, &rusage))
{
strout ("getrusage error\n", -1);
abort ();
}
return((long)((rusage.ru_utime.tv_sec - rusage0.ru_utime.tv_sec) * 1000 +
(rusage.ru_utime.tv_usec - rusage0.ru_utime.tv_usec) / 1000));
}
===============================================================================
At line 757 variable `gc_start_time' must contain garbage collection time,
but istead I received strange value with probability ~1/321. :)
755
756 gc_start_time = MS_clock () - gc_start_time;
757 gc_time += gc_start_time;
758
(gdb) b GSLalloc.c:757
Breakpoint 1 at 0x26368: file ../GSLisp-1.0/GSLalloc.c, line 757.
(gdb) c
Breakpoint 1, Freclaim () at ../GSLisp-1.0/GSLalloc.c:757
7: gc_count = 320
6: gc_time = 167395
5: /x gc_time = 0x28de3
4: gc_start_time = 661
3: /x gc_start_time = 0x295
2: /x rusage = {ru_utime = {tv_sec = 0x15b, tv_usec = 0x21778}, ru_stime = {
tv_sec = 0x39, tv_usec = 0x4d3d6}, ru_maxrss = 0x0, ru_ixrss = 0x0,
ru_idrss = 0x0, ru_isrss = 0x0, ru_minflt = 0x0, ru_majflt = 0x0,
ru_nswap = 0x0, ru_inblock = 0x94, ru_oublock = 0x13, ru_msgsnd = 0x0,
ru_msgrcv = 0x0, ru_nsignals = 0x1, ru_nvcsw = 0x67, ru_nivcsw = 0x1baa}
1: /x rusage0 = {ru_utime = {tv_sec = 0x0, tv_usec = 0x6c10}, ru_stime = {
tv_sec = 0x0, tv_usec = 0x1b041}, ru_maxrss = 0x0, ru_ixrss = 0x0,
ru_idrss = 0x0, ru_isrss = 0x0, ru_minflt = 0x0, ru_majflt = 0x0,
ru_nswap = 0x0, ru_inblock = 0x2, ru_oublock = 0x4, ru_msgsnd = 0x0,
ru_msgrcv = 0x0, ru_nsignals = 0x0, ru_nvcsw = 0x2, ru_nivcsw = 0x2}
(gdb)
Continuing.
Breakpoint 1, Freclaim () at ../GSLisp-1.0/GSLalloc.c:757
7: gc_count = 321
6: gc_time = 168056
5: /x gc_time = 0x29078
4: gc_start_time = 1646827391 WHY ?
3: /x gc_start_time = 0x6228977f **********
2: /x rusage = {ru_utime = {tv_sec = 0x1afa69f5, tv_usec = 0x339a4},
ru_stime = {tv_sec = 0x39, tv_usec = 0x72a8d}, ru_maxrss = 0x0,
ru_ixrss = 0x0, ru_idrss = 0x0, ru_isrss = 0x0, ru_minflt = 0x0,
ru_majflt = 0x0, ru_nswap = 0x0, ru_inblock = 0x94, ru_oublock = 0x13,
ru_msgsnd = 0x0, ru_msgrcv = 0x0, ru_nsignals = 0x1, ru_nvcsw = 0x67,
ru_nivcsw = 0x1bbd}
1: /x rusage0 = {ru_utime = {tv_sec = 0x0, tv_usec = 0x6c10}, ru_stime = {
tv_sec = 0x0, tv_usec = 0x1b041}, ru_maxrss = 0x0, ru_ixrss = 0x0,
ru_idrss = 0x0, ru_isrss = 0x0, ru_minflt = 0x0, ru_majflt = 0x0,
ru_nswap = 0x0, ru_inblock = 0x2, ru_oublock = 0x4, ru_msgsnd = 0x0,
ru_msgrcv = 0x0, ru_nsignals = 0x0, ru_nvcsw = 0x2, ru_nivcsw = 0x2}
(gdb) c
Continuing.
Breakpoint 1, Freclaim () at ../GSLisp-1.0/GSLalloc.c:757
7: gc_count = 322
6: gc_time = 1646995447
5: /x gc_time = 0x622b27f7
4: gc_start_time = 664
3: /x gc_start_time = 0x298
2: /x rusage = {ru_utime = {tv_sec = 0x15d, tv_usec = 0x9f1d0}, ru_stime = {
tv_sec = 0x39, tv_usec = 0x9f2ca}, ru_maxrss = 0x0, ru_ixrss = 0x0,
ru_idrss = 0x0, ru_isrss = 0x0, ru_minflt = 0x0, ru_majflt = 0x0,
ru_nswap = 0x0, ru_inblock = 0x94, ru_oublock = 0x13, ru_msgsnd = 0x0,
ru_msgrcv = 0x0, ru_nsignals = 0x1, ru_nvcsw = 0x67, ru_nivcsw = 0x1bcd}
1: /x rusage0 = {ru_utime = {tv_sec = 0x0, tv_usec = 0x6c10}, ru_stime = {
tv_sec = 0x0, tv_usec = 0x1b041}, ru_maxrss = 0x0, ru_ixrss = 0x0,
ru_idrss = 0x0, ru_isrss = 0x0, ru_minflt = 0x0, ru_majflt = 0x0,
ru_nswap = 0x0, ru_inblock = 0x2, ru_oublock = 0x4, ru_msgsnd = 0x0,
ru_msgrcv = 0x0, ru_nsignals = 0x0, ru_nvcsw = 0x2, ru_nivcsw = 0x2}
Anatoly