Date: Sat, 29 Nov 2003 15:07:14 -0800 From: Kris Kennaway <kris@obsecurity.org> To: stable@FreeBSD.org Cc: phk@freeBSD.org Subject: Corrected gettimeofday() test code Message-ID: <20031129230714.GB10325@xor.obsecurity.org>
next in thread | raw e-mail | index | archive | help
--ADZbWkCsHQ7r3kzd
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
I forwarded the reports of timecounter problems to phk, and he asked
that people who are seeing timecounter problems provide FULL details
of their system configuration, including:
* dmesg
* kernel configuration
* compiler options
* time-related system configuration (whether ntpd/timed/ntpdate is
running, and if so whether it's correcting for a seriously drifting
clock)
* The kernel timecounter configuration, e.g. the
kern.timecounter.method and kern.timecounter.hardware sysctls, and
whether changing them has any effect.
* The exact output of the corrected test program below (the original
would give spurious errors if it didn't run at least once a second,
which may have been confusing some people if their systems were
sufficiently loaded).
* The system status when the problem is observed (i.e. does it only
occur under load; what else is running at the time)
It's hard to track down this kind of problem when people don't provide
this level of detail, and half-reports just confuse the issue.
Thanks,
Kris
----- Forwarded message from Poul-Henning Kamp <phk@phk.freebsd.dk> -----
X-Original-To: kkenn@localhost
Delivered-To: kkenn@localhost.obsecurity.org
Delivered-To: kris@freebsd.org
Date: Sat, 29 Nov 2003 23:48:12 +0100
From: Poul-Henning Kamp <phk@phk.freebsd.dk>
Subject: Re: gettimeofday() test code
In-reply-to: "Your message of Sat, 29 Nov 2003 14:21:24 PST."
<20031129222124.GA10022@xor.obsecurity.org>
To: Kris Kennaway <kris@obsecurity.org>
X-UIDL: 1f9b02cde6c0ab3cc62d0309b681fcc3
X-Bogosity: No, tests=3Dbogofilter, spamicity=3D0.000000, version=3D0.15.7
Have them run this one instead...
#include <stdio.h>
#include <sys/time.h>
int
main()
{
struct timeval prevtime;
struct timeval curtime;
double last, now;
gettimeofday(&prevtime, NULL);
last =3D prevtime.tv_sec + prevtime.tv_usec * 1e-6;
for (;;)
{
gettimeofday(&curtime, NULL);
now =3D curtime.tv_sec + curtime.tv_usec * 1e-6;
if (now < last) {
printf("%f %f %d.%06d %d.%06d\n", now, last,
curtime.tv_sec, curtime.tv_usec,
prevtime.tv_sec, prevtime.tv_usec);
}
last =3D now;
prevtime =3D curtime;
}
return 0;
}
--=20
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk@FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe =20
Never attribute to malice what can adequately be explained by incompetence.
----- End forwarded message -----
--ADZbWkCsHQ7r3kzd
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (FreeBSD)
iD8DBQE/ySahWry0BWjoQKURAh0VAKDuNU+vS918cROls2Ncs45aaRZFyQCdGZHv
160xoA/l1FFriEgWgeIT8ho=
=/QSO
-----END PGP SIGNATURE-----
--ADZbWkCsHQ7r3kzd--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031129230714.GB10325>
