Date: Fri, 28 Nov 2003 21:32:30 -0400 (AST) From: "Marc G. Fournier" <scrappy@hub.org> To: freebsd-current@freebsd.org Cc: freebsd-stable@freebsd.org Subject: Time jumping on both 4.x and 5.x ... Message-ID: <20031128212342.G99096@ganymede.hub.org>
next in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] In trying to isolate an issue where the PostgreSQL 'explain analyze' is showing "odd results" (namely, negative time estimates on queries), Tom Lane wrote a quick C program to test gettimeofday() (program attached) ... the results on a 4.9-PRERELEASE kernel of Sep 20 14:16:48 ADT 2003 shows: neptune# time ./timetest out of order tv_sec: 1070068479 99040, prev 1070069174 725235 out of order tv_usec: 1070068479 99040, prev 1070069174 725235 out of order tv_sec: 1070069175 19687, prev 1070068479 99040 out of order tv_usec: 1070069175 19687, prev 1070068479 99040 out of order tv_sec: 1070068499 99377, prev 1070069194 625573 out of order tv_usec: 1070068499 99377, prev 1070069194 625573 out of order tv_sec: 1070069194 808542, prev 1070068499 99377 ^C1.171u 23.461s 0:24.68 99.7% 5+169k 1+0io 0pf+0w One person on the list has tried the same script on a 5.2 kernel, and reports seeing similar results, but after a longer period of time (~30min) ... In most (all?) cases, the offset appears to be ~+/-695 secs ... Linux ppl on the list, running the same problem, seem to be able to reproduce the issue, except they are only finding differences of 1 microsecond, and then only on older kernels (2.2.x, apparently) ... those running newer Linux kernels are reporting a clean run ... Known problem? ---- Marc G. Fournier Hub.Org Networking Services (http://www.hub.org) Email: scrappy@hub.org Yahoo!: yscrappy ICQ: 7615664 [-- Attachment #2 --] #include <stdio.h> #include <sys/time.h> int main() { struct timeval prevtime; struct timeval curtime; gettimeofday(&prevtime, NULL); for (;;) { gettimeofday(&curtime, NULL); if (curtime.tv_usec < 0 || curtime.tv_usec >= 1000000) fprintf(stderr, "bogus tv_usec: %ld %ld, prev %ld %ld\n", (long int) curtime.tv_sec, (long int) curtime.tv_usec, (long int) prevtime.tv_sec, (long int) prevtime.tv_usec); if (curtime.tv_sec < prevtime.tv_sec || curtime.tv_sec > prevtime.tv_sec + 1) fprintf(stderr, "out of order tv_sec: %ld %ld, prev %ld %ld\n", (long int) curtime.tv_sec, (long int) curtime.tv_usec, (long int) prevtime.tv_sec, (long int) prevtime.tv_usec); if (curtime.tv_usec < prevtime.tv_usec && curtime.tv_sec != prevtime.tv_sec + 1) fprintf(stderr, "out of order tv_usec: %ld %ld, prev %ld %ld\n", (long int) curtime.tv_sec, (long int) curtime.tv_usec, (long int) prevtime.tv_sec, (long int) prevtime.tv_usec); prevtime = curtime; } return 0; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031128212342.G99096>
