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/cddl/dev/dtrace | |
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/cddl/dev/dtrace')
-rw-r--r-- | sys/cddl/dev/dtrace/amd64/dtrace_subr.c | 9 | ||||
-rw-r--r-- | sys/cddl/dev/dtrace/i386/dtrace_subr.c | 9 |
2 files changed, 14 insertions, 4 deletions
diff --git a/sys/cddl/dev/dtrace/amd64/dtrace_subr.c b/sys/cddl/dev/dtrace/amd64/dtrace_subr.c index 4895231..00e3e24 100644 --- a/sys/cddl/dev/dtrace/amd64/dtrace_subr.c +++ b/sys/cddl/dev/dtrace/amd64/dtrace_subr.c @@ -47,6 +47,8 @@ extern uintptr_t dtrace_in_probe_addr; extern int dtrace_in_probe; +extern void dtrace_getnanotime(struct timespec *tsp); + int dtrace_invop(uintptr_t, uintptr_t *, uintptr_t); typedef struct dtrace_invop_hdlr { @@ -461,8 +463,11 @@ dtrace_gethrtime() uint64_t dtrace_gethrestime(void) { - printf("%s(%d): XXX\n",__func__,__LINE__); - return (0); + struct timespec current_time; + + dtrace_getnanotime(¤t_time); + + return (current_time.tv_sec * 1000000000UL + current_time.tv_nsec); } /* 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/i386/dtrace_subr.c index e8384bf..551e035 100644 --- a/sys/cddl/dev/dtrace/i386/dtrace_subr.c +++ b/sys/cddl/dev/dtrace/i386/dtrace_subr.c @@ -49,6 +49,8 @@ extern uintptr_t kernelbase; extern uintptr_t dtrace_in_probe_addr; extern int dtrace_in_probe; +extern void dtrace_getnanotime(struct timespec *tsp); + int dtrace_invop(uintptr_t, uintptr_t *, uintptr_t); typedef struct dtrace_invop_hdlr { @@ -462,8 +464,11 @@ dtrace_gethrtime() uint64_t dtrace_gethrestime(void) { - printf("%s(%d): XXX\n",__func__,__LINE__); - return (0); + struct timespec current_time; + + dtrace_getnanotime(¤t_time); + + return (current_time.tv_sec * 1000000000UL + current_time.tv_nsec); } /* Function to handle DTrace traps during probes. See i386/i386/trap.c */ |