diff --git a/fastping.go b/fastping.go index 96950ca..349ec99 100644 --- a/fastping.go +++ b/fastping.go @@ -43,6 +43,7 @@ import ( "log" "math/rand" "net" + "runtime" "sync" "syscall" "time" @@ -105,6 +106,10 @@ func ipv4Payload(b []byte) []byte { return b[hdrlen:] } +func numGoRoutines() int { + return runtime.GOMAXPROCS(0) * 4 +} + type packet struct { bytes []byte addr net.Addr