diff options
author | gnn <gnn@FreeBSD.org> | 2012-07-16 20:17:19 +0000 |
---|---|---|
committer | gnn <gnn@FreeBSD.org> | 2012-07-16 20:17:19 +0000 |
commit | fb2c54cc142fe22c61330252063a78bbb73d1b40 (patch) | |
tree | e710f2c8cb95c7f6d47dcc0205a352d8253e3d89 /sys/kern/kern_tc.c | |
parent | 8af6bec3e35a5f83c6fe4955a3235cde9b77a070 (diff) | |
download | FreeBSD-src-fb2c54cc142fe22c61330252063a78bbb73d1b40.zip FreeBSD-src-fb2c54cc142fe22c61330252063a78bbb73d1b40.tar.gz |
Add support for walltimestamp in DTrace.
Submitted by: Fabian Keil
MFC after: 2 weeks
Diffstat (limited to 'sys/kern/kern_tc.c')
-rw-r--r-- | sys/kern/kern_tc.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c index 4a75af5..a08b218 100644 --- a/sys/kern/kern_tc.c +++ b/sys/kern/kern_tc.c @@ -122,6 +122,8 @@ SYSCTL_INT(_kern_timecounter, OID_AUTO, stepwarnings, CTLFLAG_RW, static void tc_windup(void); static void cpu_tick_calibrate(int); +void dtrace_getnanotime(struct timespec *tsp); + static int sysctl_kern_boottime(SYSCTL_HANDLER_ARGS) { @@ -960,6 +962,24 @@ getmicrotime(struct timeval *tvp) #endif /* FFCLOCK */ /* + * This is a clone of getnanotime and used for walltimestamps. + * The dtrace_ prefix prevents fbt from creating probes for + * it so walltimestamp can be safely used in all fbt probes. + */ +void +dtrace_getnanotime(struct timespec *tsp) +{ + struct timehands *th; + u_int gen; + + do { + th = timehands; + gen = th->th_generation; + *tsp = th->th_nanotime; + } while (gen == 0 || gen != th->th_generation); +} + +/* * System clock currently providing time to the system. Modifiable via sysctl * when the FFCLOCK option is defined. */ |