// want to measure.
func (b *B) StopTimer() {
if b.timerOn {
- b.duration += time.Now().Sub(b.start)
+ b.duration += time.Since(b.start)
b.timerOn = false
}
}
// run example
t0 := time.Now()
eg.F()
- dt := time.Now().Sub(t0)
+ dt := time.Since(t0)
// close pipe, restore stdout/stderr, get output
w.Close()
// a call to runtime.Goexit, record the duration and send
// a signal saying that the test is done.
defer func() {
- t.duration = time.Now().Sub(t.start)
+ t.duration = time.Since(t.start)
t.signal <- t
}()
if err == nil {
c.Close()
}
- elapsed := time.Now().Sub(startTime)
+ elapsed := time.Since(startTime)
t.Logf("dialClosedPort: measured delay %v", elapsed)
return elapsed
}
startTime := time.Now()
c, err := d.Dial("tcp", JoinHostPort("slow6loopback4", dss.port))
- elapsed := time.Now().Sub(startTime)
+ elapsed := time.Since(startTime)
if err == nil {
c.Close()
} else if tt.dualstack {
time.Sleep(100 * time.Millisecond)
start := time.Now()
runtime.ReadMemStats(&ms)
- latencies = append(latencies, time.Now().Sub(start))
+ latencies = append(latencies, time.Since(start))
}
// Make sure to stop the timer before we wait! The load created above
// is very heavy-weight and not easy to stop, so we could end up
for i := 0; i < b.N; i++ {
start := time.Now()
metrics.Read(samples)
- latencies = append(latencies, time.Now().Sub(start))
+ latencies = append(latencies, time.Since(start))
}
// Make sure to stop the timer before we wait! The load created above
// is very heavy-weight and not easy to stop, so we could end up
if !ok {
b.Fatal("goroutine profile failed")
}
- latencies = append(latencies, time.Now().Sub(start))
+ latencies = append(latencies, time.Since(start))
}
b.StopTimer()
// should do considerably better than this bound.
bound := int64(myLimit + 16<<20)
start := time.Now()
- for time.Now().Sub(start) < 200*time.Millisecond {
+ for time.Since(start) < 200*time.Millisecond {
metrics.Read(m[:])
retained := int64(m[0].Value.Uint64() - m[1].Value.Uint64())
if retained > bound {