Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(82)

Unified Diff: test/mapnan.go

Issue 15570046: code review 15570046: test/mapnan: use time.Now instead of syscall.Getrusage (Closed)
Patch Set: diff -r 98840b3349f4 https://code.google.com/p/go/ Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mapnan.go
===================================================================
--- a/test/mapnan.go
+++ b/test/mapnan.go
@@ -13,17 +13,13 @@
"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 @@
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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b