Date: Sun, 24 Jun 2012 13:40:09 GMT From: Fabian Keil <fk@fabiankeil.de> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/159612: [dtrace] walltimestamp and timestamp functions incomplete Message-ID: <201206241340.q5ODe9qr063589@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/159612; it has been noted by GNATS. From: Fabian Keil <fk@fabiankeil.de> To: bug-followup@FreeBSD.org Cc: ashley.wil@gmail.com, Andriy Gapon <avg@FreeBSD.org> Subject: Re: kern/159612: [dtrace] walltimestamp and timestamp functions incomplete Date: Sun, 24 Jun 2012 15:34:21 +0200 --Sig_/XTu3iD5adcBI3uKvVE.eD/i Content-Type: multipart/mixed; boundary="MP_/IIPfuo+xn64ZrhajrzOaxRo" --MP_/IIPfuo+xn64ZrhajrzOaxRo Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline The attached patch adds support for walltimestamp on amd64 and i386 by copying the code from mips. I only tested it on amd64. The problem perceived with timestamp was the result of a misunderstanding as confirmed in: http://lists.freebsd.org/pipermail/freebsd-current/2011-August/026733.html Fabian --MP_/IIPfuo+xn64ZrhajrzOaxRo Content-Type: text/x-patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=0001-dtrace-Add-support-for-walltimestamp-on-amd64-and-i3.patch =46rom ac8877b5b0417d6177e59df7e63744a3c69497cc Mon Sep 17 00:00:00 2001 From: Fabian Keil <fk@fabiankeil.de> Date: Sun, 24 Jun 2012 15:19:46 +0200 Subject: [PATCH] dtrace: Add support for walltimestamp on amd64 and i386 Code copied from mips. --- sys/cddl/dev/dtrace/amd64/dtrace_subr.c | 7 +++++-- sys/cddl/dev/dtrace/i386/dtrace_subr.c | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/sys/cddl/dev/dtrace/amd64/dtrace_subr.c b/sys/cddl/dev/dtrace/= amd64/dtrace_subr.c index 9960fa9..2d42ce2 100644 --- a/sys/cddl/dev/dtrace/amd64/dtrace_subr.c +++ b/sys/cddl/dev/dtrace/amd64/dtrace_subr.c @@ -461,8 +461,11 @@ dtrace_gethrtime() uint64_t dtrace_gethrestime(void) { - printf("%s(%d): XXX\n",__func__,__LINE__); - return (0); + struct timespec curtime; + + getnanotime(&curtime); + + return (curtime.tv_sec * 1000000000UL + curtime.tv_nsec); } =20 /* Function to handle DTrace traps during probes. See amd64/amd64/trap.c */ diff --git a/sys/cddl/dev/dtrace/i386/dtrace_subr.c b/sys/cddl/dev/dtrace/i= 386/dtrace_subr.c index cef6914..3a1677a 100644 --- a/sys/cddl/dev/dtrace/i386/dtrace_subr.c +++ b/sys/cddl/dev/dtrace/i386/dtrace_subr.c @@ -462,8 +462,11 @@ dtrace_gethrtime() uint64_t dtrace_gethrestime(void) { - printf("%s(%d): XXX\n",__func__,__LINE__); - return (0); + struct timespec curtime; + + getnanotime(&curtime); + + return (curtime.tv_sec * 1000000000UL + curtime.tv_nsec); } =20 /* Function to handle DTrace traps during probes. See i386/i386/trap.c */ --=20 1.7.10.3 --MP_/IIPfuo+xn64ZrhajrzOaxRo-- --Sig_/XTu3iD5adcBI3uKvVE.eD/i Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAk/nF2UACgkQSMVSH78upWOi4gCfR0/f1VxhprZAQAh48SJKAKda unUAn1RTccEMuHwYAshlKlFRy7OwiM50 =e5Ai -----END PGP SIGNATURE----- --Sig_/XTu3iD5adcBI3uKvVE.eD/i--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206241340.q5ODe9qr063589>