summaryrefslogtreecommitdiff
path: root/test/mapnan.go
diff options
context:
space:
mode:
authorMichael Stapelberg <stapelberg@debian.org>2013-12-03 09:43:15 +0100
committerMichael Stapelberg <stapelberg@debian.org>2013-12-03 09:43:15 +0100
commit64d2a7c8945ba05af859901f5e248f1befdd8621 (patch)
tree013fcb7e9e3296ecdda876012252c36bd6bcb063 /test/mapnan.go
parentb901efe83e212f0c34c769c079e41373da12d723 (diff)
downloadgolang-64d2a7c8945ba05af859901f5e248f1befdd8621.tar.gz
Imported Upstream version 1.2upstream/1.2
Diffstat (limited to 'test/mapnan.go')
-rw-r--r--test/mapnan.go12
1 files changed, 2 insertions, 10 deletions
diff --git a/test/mapnan.go b/test/mapnan.go
index 60b35fbea..f081cab01 100644
--- a/test/mapnan.go
+++ b/test/mapnan.go
@@ -13,17 +13,13 @@ import (
"fmt"
"math"
"time"
- "syscall"
)
func main() {
// Test that NaNs in maps don't go quadratic.
t := func(n int) time.Duration {
- var u0 syscall.Rusage
- if err := syscall.Getrusage(0, &u0); err != nil {
- panic(err)
- }
+ t1 := time.Now()
m := map[float64]int{}
nan := math.NaN()
for i := 0; i < n; i++ {
@@ -32,11 +28,7 @@ func main() {
if len(m) != n {
panic("wrong size map after nan insertion")
}
- var u1 syscall.Rusage
- if err := syscall.Getrusage(0, &u1); err != nil {
- panic(err)
- }
- return time.Duration(u1.Utime.Nano() - u0.Utime.Nano())
+ return time.Since(t1)
}
// Depending on the machine and OS, this test might be too fast