Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Nov 1998 09:01:16 -0700
From:      Wes Peters <wes@softweyr.com>
To:        Rasmus Kaj <kaj@interbizz.se>
Cc:        max@vega.pfts.com, freebsd-stable@FreeBSD.ORG
Subject:   Re: calcru: negative time of -71345076 usec for pid 23891 (make)
Message-ID:  <3649B4CC.ACF9587E@softweyr.com>
References:  <36440E77.3758284D@vega.pfts.com> <19981111004246Z.kaj@interbizz.se>

next in thread | previous in thread | raw e-mail | index | archive | help
Rasmus Kaj wrote:
> 
> >>>>> "MS" == Maxim Sobolev <max@vega.pfts.com> writes:
> 
>  MS> Does anybody know what does this mysterious message means?
> 
>  MS> calcru: negative time of -71345076 usec for pid 23891 (make)
> 
> Since I haven't seen an explanatory answer to this, let me throw in a
> guess (so there is at lest a try for an answer) ...

"Use the Source, Luke!"

wes@zaphod$ cd /usr/src/sys
wes@zaphod$ find . -name '*.c' -print | xargs grep "negative time"
./kern/kern_clock.c:            printf("hzto: negative time difference %ld sec %ld usec\n",
./kern/kern_resource.c:         printf("calcru: negative time: %ld usec\n", (long)totusec);
wes@zaphod$ vi kern/kern_resource.c

 
/*
 * Transform the running time and tick information in proc p into user,
 * system, and interrupt time usage.
 */
void
calcru(p, up, sp, ip)

...

        if (p == curproc) {     
                /*
                 * Adjust for the current time slice.  This is actually fairly
                 * important since the error here is on the order of a time
                 * quantum, which is much greater than the sampling error.
                 */ 
                microtime(&tv); 
                sec += tv.tv_sec - runtime.tv_sec;
                usec += tv.tv_usec - runtime.tv_usec;
        }
        totusec = (quad_t)sec * 1000000 + usec;
        if (totusec < 0) {
                /* XXX no %qd in kernel.  Truncate. */
                printf("calcru: negative time: %ld usec\n", (long)totusec);
                totusec = 0;
        }

...

So, it looks like your process has been charged negative time during this
accounting interval.  I've not studied the code to determine exactly *why*
this happens, or what it means, but it seems to be relatively harmless.

It started happening on my 486/66 server box around 2.2.5 release.  I suspect
there may be a buglet in there somewhere, but it seems harmless so I just
avoid using ttyv0.  ;^)

-- 
       "Where am I, and what am I doing in this handbasket?"

Wes Peters                                                 Softweyr LLC
http://www.softweyr.com/~softweyr                      wes@softweyr.com

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3649B4CC.ACF9587E>