]> Cypherpunks repositories - gostls13.git/commit
runtime: use vDSO clock_gettime for time.now & runtime.nanotime on Linux/amd64
authorShenghou Ma <minux.ma@gmail.com>
Fri, 9 Nov 2012 06:19:07 +0000 (14:19 +0800)
committerShenghou Ma <minux.ma@gmail.com>
Fri, 9 Nov 2012 06:19:07 +0000 (14:19 +0800)
commit4022fc4e21d6c5feecb01248c25f8bc54e9762c2
treeb37ffbe5bca8a8285b067ebf37886cf087470f4c
parentf668e0a5b3b1f393ecda995c92503da7b4c89e53
runtime: use vDSO clock_gettime for time.now & runtime.nanotime on Linux/amd64
Performance improvement aside, time.Now() now gets real nanosecond resolution
on supported systems.

Benchmark done on Core i7-2600 @ 3.40GHz with kernel 3.5.2-gentoo.
original vDSO gettimeofday:
BenchmarkNow    100000000               27.4 ns/op
new vDSO gettimeofday fallback:
BenchmarkNow    100000000               27.6 ns/op
new vDSO clock_gettime:
BenchmarkNow    100000000               24.4 ns/op

R=golang-dev, bradfitz, iant, iant
CC=golang-dev
https://golang.org/cl/6814103
src/pkg/runtime/sys_linux_amd64.s
src/pkg/runtime/vdso_linux_amd64.c