Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
runtime: use vDSO clock_gettime on linux/mips64x
Speed up nanotime1 and walltime1 on MIPS64 with vDSO, just like the other vDSO-enabled targets. Benchmark numbers on Loongson 3A3000 (GOARCH=mips64le, 1.4GHz) against current master: benchmark old ns/op new ns/op delta BenchmarkNow 868 293 -66.24% BenchmarkNowUnixNano 851 296 -65.22% Performance hit on fallback case, tested by using a wrong vDSO symbol name: benchmark old ns/op new ns/op delta BenchmarkNow 868 889 +2.42% BenchmarkNowUnixNano 851 893 +4.94% Change-Id: Ibfb48893cd060536359863ffee7624c00def646b GitHub-Last-Rev: 03a58ac GitHub-Pull-Request: golang#35181 Reviewed-on: https://go-review.googlesource.com/c/go/+/203578 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
- Loading branch information
Showing
6 changed files
with
106 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright 2019 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
// +build linux | ||
// +build mips64 mips64le | ||
|
||
package runtime | ||
|
||
const ( | ||
// vdsoArrayMax is the byte-size of a maximally sized array on this architecture. | ||
// See cmd/compile/internal/mips64/galign.go arch.MAXWIDTH initialization. | ||
vdsoArrayMax = 1<<50 - 1 | ||
) | ||
|
||
// see man 7 vdso : mips | ||
var vdsoLinuxVersion = vdsoVersionKey{"LINUX_2.6", 0x3ae75f6} | ||
|
||
// The symbol name is not __kernel_clock_gettime as suggested by the manpage; | ||
// according to Linux source code it should be __vdso_clock_gettime instead. | ||
var vdsoSymbolKeys = []vdsoSymbolKey{ | ||
{"__vdso_clock_gettime", 0xd35ec75, 0x6e43a318, &vdsoClockgettimeSym}, | ||
} | ||
|
||
// initialize to fall back to syscall | ||
var ( | ||
vdsoClockgettimeSym uintptr = 0 | ||
) |