func main() { runtime.GOMAXPROCS(runtime.NumCPU()) stat = actionstat.New() var listenFrom = flag.String("listenFrom", ":6666", "server ip/port") var connCount = flag.Int("count", 1000, "connection count") var connThrottle = flag.Int("throttle", 10, "connection throttle") var rundur = flag.Int("rundur", 3600, "run sec") var profilefilename = flag.String("pfilename", "", "profile filename") flag.Parse() if *profilefilename != "" { f, err := os.Create(*profilefilename) if err != nil { log.Fatalf("profile %v", err) } pprof.StartCPUProfile(f) defer pprof.StopCPUProfile() } go gogueserver.TCPServer(*listenFrom, *connCount, *connThrottle, servergo) go func() { timerInfoCh := time.Tick(time.Duration(1000) * time.Millisecond) for { select { case <-timerInfoCh: log.Info("%v", stat) stat.UpdateLap() } } }() time.Sleep(time.Duration(*rundur) * time.Second) }
func main() { runtime.GOMAXPROCS(runtime.NumCPU()) var connectTo = flag.String("connectTo", "localhost:6666", "server ip/port") var count = flag.Int("count", 1000, "client count") var rundur = flag.Int("rundur", 3600, "run sec") var clientdur = flag.Int("clientdur", 3600, "run sec") var profilefilename = flag.String("pfilename", "", "profile filename") flag.Parse() if *profilefilename != "" { f, err := os.Create(*profilefilename) if err != nil { log.Fatalf("profile %v", err) } pprof.StartCPUProfile(f) defer pprof.StopCPUProfile() } c := Clients{ *clientdur, } gogueclient.MultiClient(*connectTo, *count, *rundur, c.clientMain) }