]> Cypherpunks repositories - gostls13.git/commit
runtime: use libc for nanotime on Darwin
authorKeith Randall <khr@golang.org>
Tue, 1 May 2018 16:42:04 +0000 (09:42 -0700)
committerKeith Randall <khr@golang.org>
Sun, 20 May 2018 00:09:28 +0000 (00:09 +0000)
commitcc09212f59ee215cae5345dc1ffcd1ed81664e1b
treef3848bd8adf10bf4a21ee4525659d05e17185ba8
parente86c26789dbc11c50c4c49bee55ea015847a97b7
runtime: use libc for nanotime on Darwin

Use mach_absolute_time and mach_timebase_info to get nanosecond-level
timing information from libc on Darwin.

The conversion code from Apple's arbitrary time unit to nanoseconds is
really annoying.  It would be nice if we could replace the internal
runtime "time" with arbitrary units and put the conversion to nanoseconds
only in the places that really need it (so it isn't in every nanotime call).

It's especially annoying because numer==denom==1 for all the machines
I tried.  Makes it hard to test the conversion code :(

Update #17490

Change-Id: I6c5d602a802f5c24e35184e33d5e8194aa7afa86
Reviewed-on: https://go-review.googlesource.com/110655
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/runtime/asm_386.s
src/runtime/defs_darwin.go
src/runtime/defs_darwin_386.go
src/runtime/defs_darwin_amd64.go
src/runtime/stubs3.go
src/runtime/stubs4.go [new file with mode: 0644]
src/runtime/sys_darwin.go
src/runtime/sys_darwin_386.s
src/runtime/sys_darwin_amd64.s