diff options
author | Jordan Rhee <jordanrh@microsoft.com> | 2018-12-18 16:32:09 -0800 |
---|---|---|
committer | Brad Fitzpatrick <bradfitz@golang.org> | 2018-12-19 18:10:21 +0000 |
commit | f880efcc1666e2b99fbda644eeff258e4a15dd38 (patch) | |
tree | 2f1429afedb531c0f53c76b96b7ea75ab6cbb3dd /src/runtime/os_windows.go | |
parent | e2897e4ac0e0c124f3bb06885b4e2ed22e18eabf (diff) | |
download | go-f880efcc1666e2b99fbda644eeff258e4a15dd38.tar.gz go-f880efcc1666e2b99fbda644eeff258e4a15dd38.zip |
Revert "runtime: use QPC for nanotime and time.now on windows/arm"
This reverts change https://golang.org/cl/154758.
Restore the previous implementations of nanotime and time.now, which
are sufficiently high resolution and more efficient than
QueryPerformanceCounter. The intent of the change was to improve
resolution of tracing timestamps, but the change was overly broad
as it was only necessary to fix cputicks(). cputicks() is fixed in
a subsequent change.
Updates #26148
Change-Id: Ib9883d02fe1af2cc4940e866d8f6dc7622d47781
Reviewed-on: https://go-review.googlesource.com/c/154761
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/runtime/os_windows.go')
-rw-r--r-- | src/runtime/os_windows.go | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/runtime/os_windows.go b/src/runtime/os_windows.go index 20fe01c403..9b34589874 100644 --- a/src/runtime/os_windows.go +++ b/src/runtime/os_windows.go @@ -198,12 +198,9 @@ func loadOptionalSyscalls() { } _NtWaitForSingleObject = windowsFindfunc(n32, []byte("NtWaitForSingleObject\000")) - underWine := windowsFindfunc(n32, []byte("wine_get_version\000")) != nil - if underWine || GOARCH == "arm" { - initQPC(k32) - } - if underWine { - initWine() + if windowsFindfunc(n32, []byte("wine_get_version\000")) != nil { + // running on Wine + initWine(k32) } } @@ -360,7 +357,7 @@ func nowQPC() (sec int64, nsec int32, mono int64) { return } -func initQPC(k32 uintptr) { +func initWine(k32 uintptr) { _GetSystemTimeAsFileTime = windowsFindfunc(k32, []byte("GetSystemTimeAsFileTime\000")) if _GetSystemTimeAsFileTime == nil { throw("could not find GetSystemTimeAsFileTime() syscall") @@ -397,9 +394,7 @@ func initQPC(k32 uintptr) { // We have to do it this way (or similar), since multiplying QPC counter by 100 millions overflows // int64 and resulted time will always be invalid. qpcMultiplier = int64(timediv(1000000000, qpcFrequency, nil)) -} -func initWine() { useQPCTime = 1 } |