diff options
author | Yuval Pavel Zholkover <paulzhol@gmail.com> | 2018-02-05 17:11:27 +0200 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2018-04-18 21:54:26 +0000 |
commit | 744ccbb852f18241c637b2c6314b35fce7359916 (patch) | |
tree | 7201dea7cc3ce21462c40af6a646f7ff0c0427db /src/runtime/sys_freebsd_amd64.s | |
parent | 236c567ba9b7767b6f1ebe32eb2d8f0018de8780 (diff) | |
download | go-744ccbb852f18241c637b2c6314b35fce7359916.tar.gz go-744ccbb852f18241c637b2c6314b35fce7359916.zip |
runtime: fast clock_gettime call on FreeBSD
Use AT_TIMEKEEP ELF aux entry to access a kernel mapped ring of timehands structs.
The timehands are updated by the kernel periodically, but for accurate measure the
timecounter still needs to be queried.
Currently the fast path is used only when kern.timecounter.hardware==TSC-low
or kern.timecounter.hardware=='ARM MPCore Timecounter',
other timecounters revert back to regular system call.
TODO: add support for HPET timecounter on 386/amd64.
Change-Id: I321ca4e92be63ba21a2574b758ef5c1e729086ad
Reviewed-on: https://go-review.googlesource.com/93156
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime/sys_freebsd_amd64.s')
-rw-r--r-- | src/runtime/sys_freebsd_amd64.s | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/runtime/sys_freebsd_amd64.s b/src/runtime/sys_freebsd_amd64.s index 4d3e88b482..be191a0784 100644 --- a/src/runtime/sys_freebsd_amd64.s +++ b/src/runtime/sys_freebsd_amd64.s @@ -139,9 +139,9 @@ TEXT runtime·setitimer(SB), NOSPLIT, $-8 SYSCALL RET -// func walltime() (sec int64, nsec int32) -TEXT runtime·walltime(SB), NOSPLIT, $32 - MOVL $232, AX // clock_gettime +// func fallback_walltime() (sec int64, nsec int32) +TEXT runtime·fallback_walltime(SB), NOSPLIT, $32-12 + MOVL $232, AX // clock_gettime MOVQ $0, DI // CLOCK_REALTIME LEAQ 8(SP), SI SYSCALL @@ -153,10 +153,8 @@ TEXT runtime·walltime(SB), NOSPLIT, $32 MOVL DX, nsec+8(FP) RET -TEXT runtime·nanotime(SB), NOSPLIT, $32 +TEXT runtime·fallback_nanotime(SB), NOSPLIT, $32-8 MOVL $232, AX - // We can use CLOCK_MONOTONIC_FAST here when we drop - // support for FreeBSD 8-STABLE. MOVQ $4, DI // CLOCK_MONOTONIC LEAQ 8(SP), SI SYSCALL |