1
0
mirror of https://github.com/golang/go synced 2024-11-20 00:04:43 -07:00

runtime: use monotonic clock for timers on freebsd/amd64,386,arm

For now we don't use CLOCK_MONOTONIC_FAST instead because
it's not supported on prior to 9-STABLE.

Update #6007

LGTM=minux.ma
R=golang-codereviews, minux.ma, bradfitz
CC=golang-codereviews
https://golang.org/cl/68690043
This commit is contained in:
Mikio Hara 2014-02-26 10:19:51 +09:00
parent d97d37188a
commit 36013e4a22
3 changed files with 11 additions and 5 deletions

View File

@ -135,7 +135,7 @@ TEXT runtime·setitimer(SB), NOSPLIT, $-4
TEXT time·now(SB), NOSPLIT, $32
MOVL $232, AX
LEAL 12(SP), BX
MOVL $0, 4(SP)
MOVL $0, 4(SP) // CLOCK_REALTIME
MOVL BX, 8(SP)
INT $0x80
MOVL 12(SP), AX // sec
@ -152,7 +152,9 @@ TEXT time·now(SB), NOSPLIT, $32
TEXT runtime·nanotime(SB), NOSPLIT, $32
MOVL $232, AX
LEAL 12(SP), BX
MOVL $0, 4(SP)
// We can use CLOCK_MONOTONIC_FAST here when we drop
// support for FreeBSD 8-STABLE.
MOVL $4, 4(SP) // CLOCK_MONOTONIC
MOVL BX, 8(SP)
INT $0x80
MOVL 12(SP), AX // sec

View File

@ -144,7 +144,7 @@ TEXT runtime·setitimer(SB), NOSPLIT, $-8
// func now() (sec int64, nsec int32)
TEXT time·now(SB), NOSPLIT, $32
MOVL $232, AX
MOVQ $0, DI
MOVQ $0, DI // CLOCK_REALTIME
LEAQ 8(SP), SI
SYSCALL
MOVQ 8(SP), AX // sec
@ -157,7 +157,9 @@ TEXT time·now(SB), NOSPLIT, $32
TEXT runtime·nanotime(SB), NOSPLIT, $32
MOVL $232, AX
MOVQ $0, DI
// 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
MOVQ 8(SP), AX // sec

View File

@ -162,7 +162,9 @@ TEXT time·now(SB), NOSPLIT, $32
// int64 nanotime(void) so really
// void nanotime(int64 *nsec)
TEXT runtime·nanotime(SB), NOSPLIT, $32
MOVW $0, R0 // CLOCK_REALTIME
// We can use CLOCK_MONOTONIC_FAST here when we drop
// support for FreeBSD 8-STABLE.
MOVW $4, R0 // CLOCK_MONOTONIC
MOVW $8(R13), R1
MOVW $SYS_clock_gettime, R7
SWI $0