Date: Fri, 7 Jul 2006 18:55:58 GMT From: John Birrell <jb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 100920 for review Message-ID: <200607071855.k67Itwpu060675@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=100920 Change 100920 by jb@jb_freebsd2 on 2006/07/07 18:55:42 Add a high resolution time function for DTrace. This is what it uses for vtime (thread execution time which takes into account of context switches). Affected files ... .. //depot/projects/dtrace/src/sys/sun4v/sun4v/tick.c#2 edit Differences ... ==== //depot/projects/dtrace/src/sys/sun4v/sun4v/tick.c#2 (text+ko) ==== @@ -27,6 +27,8 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD: src/sys/sparc64/sparc64/tick.c,v 1.20 2006/02/11 09:33:07 phk Exp $"); +#include "opt_kdtrace.h" + #include <sys/param.h> #include <sys/kernel.h> #include <sys/systm.h> @@ -194,3 +196,17 @@ intr_restore_all(s); } +/* + * DTrace needs a high resolution time function which can + * be called from a probe context and guaranteed not to have + * instrumented with probes itself. + * + * Returns nanoseconds since boot. + */ +#ifdef KDTRACE +uint64_t +dtrace_gethrtime() +{ + return (rd(tick) * (uint64_t) 1000000000 / tick_freq); +} +#endif
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200607071855.k67Itwpu060675>