Problem with timecounters and memory model
Sebastian Huber
sebastian.huber at embedded-brains.de
Fri May 29 13:44:22 UTC 2015
On 29/05/15 15:41, Poul-Henning Kamp wrote:
> --------
> In message <55686C0F.9000101 at embedded-brains.de>, Sebastian Huber writes:
>
>> Ok, what makes me wonder is why this problem didn't show up in FreeBSD.=20
>> In our case we observed backward jumps in the supposed to be monotonic=20
>> uptime.
> How often do you "wind" the timecounter ?
>
More often than necessary. About 1000 times a second with only one
timehand (this is a hack to support legacy systems). The test case is:
while (1) {
struct timespec newtime;
if (clock_gettime(CLOCK_MONOTONIC, &newtime) != 0) {
fprintf(stderr, "clock_gettime() failed: \"%s\"\n",
strerror(errno));
return (NULL);
}
if (!(newtime.tv_sec > lasttime.tv_sec
|| (newtime.tv_sec == lasttime.tv_sec
&& newtime.tv_nsec >= lasttime.tv_nsec))) {
printf("Time went backwards, from {%ld, %ld} to {%ld,
%ld}\n", lasttime.tv_sec, lasttime.tv_nsec, newtime.tv_sec,
newtime.tv_nsec);
}
lasttime = newtime;
}
--
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 at embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
More information about the freebsd-hackers
mailing list