github.com/egonelbre/exp@v0.0.0-20240430123955-ed1d3aa93911/qpc_example.go (about) 1 // +build ignore 2 3 package main 4 5 import ( 6 "math/rand" 7 "time" 8 9 "github.com/egonelbre/exp/qpc" 10 ) 11 12 func main() { 13 A := qpc.NewHistory("A") 14 B := qpc.NewHistory("B") 15 16 for i := 0; i < 1000; i += 1 { 17 A.Start() 18 time.Sleep(time.Duration(rand.Intn(1000))) 19 A.Stop() 20 21 B.Start() 22 time.Sleep(time.Duration(rand.Intn(1000) + 1000)) 23 B.Stop() 24 } 25 26 qpc.PrintSummary(A, B) 27 }