I've done a little ticker precision test. I want to do something in a 4 Mhz
interval. My test creates a ticker with 250 nsec duration. So I've expected
4 * 10^6 / 250 nsec = 16000 calls, but I got no more then 13000. What's
wrong?
package main
import (
"fmt"
"time"
)
func main() {
t := time.NewTicker(250 * time.Nanosecond)
stop := make(chan bool, 1)
c := 0
go func() {
for {
select {
case <- t.C:
c++
case <- stop:
return
}
}
}()
time.Sleep(1*time.Second)
stop <- true
fmt.Println(c)
}
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.