Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 May 2015 15:44:17 +0200
From:      Sebastian Huber <sebastian.huber@embedded-brains.de>
To:        Poul-Henning Kamp <phk@freebsd.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Problem with timecounters and memory model
Message-ID:  <55686D31.1060408@embedded-brains.de>
In-Reply-To: <85121.1432906871@critter.freebsd.dk>
References:  <55686300.3080100@embedded-brains.de> <85086.1432906578@critter.freebsd.dk> <55686C0F.9000101@embedded-brains.de> <85121.1432906871@critter.freebsd.dk>

next in thread | previous in thread | raw e-mail | index | archive | help


On 29/05/15 15:41, Poul-Henning Kamp wrote:
> --------
> In message <55686C0F.9000101@embedded-brains.de>, Sebastian Huber write=
s:
>
>> Ok, what makes me wonder is why this problem didn't show up in FreeBSD=
.=3D20
>> In our case we observed backward jumps in the supposed to be monotonic=
=3D20
>> uptime.
> How often do you "wind" the timecounter ?
>

More often than necessary. About 1000 times a second with only one=20
timehand (this is a hack to support legacy systems). The test case is:

     while (1) {
         struct timespec newtime;

         if (clock_gettime(CLOCK_MONOTONIC, &newtime) !=3D 0) {
             fprintf(stderr, "clock_gettime() failed: \"%s\"\n",=20
strerror(errno));

             return (NULL);
         }


         if (!(newtime.tv_sec > lasttime.tv_sec
               || (newtime.tv_sec =3D=3D lasttime.tv_sec
                   && newtime.tv_nsec >=3D lasttime.tv_nsec))) {
             printf("Time went backwards, from {%ld, %ld} to {%ld,=20
%ld}\n", lasttime.tv_sec, lasttime.tv_nsec, newtime.tv_sec,=20
newtime.tv_nsec);
         }

         lasttime =3D newtime;
     }

--=20
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine gesch=E4ftliche Mitteilung im Sinne des EHUG.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?55686D31.1060408>