// main func func main() { flag.Parse() NCPU := runtime.NumCPU() runtime.GOMAXPROCS(NCPU) // to speed up rands = make([]*rand.Rand, NCPU) for i, _ := range rands { s := rand.NewSource(time.Now().UnixNano()) rands[i] = rand.New(s) } gree_client.C2S_Secret = auth_key gree_client.S2S_Secret = auth_key log.Println("cpu number -> ", NCPU) log.Println("rps -> ", rps) log.Println("slow threshold -> ", slowThreshold, "ms") log.Println("profile type -> ", profileType) log.Println("proxy -> ", proxy) log.Println("auth method-> ", auth_method) log.Println("auth key -> ", auth_key) profile, _ = scenario.New(profileType, sessionAmount) if profileFile != "" { profile.InitFromFile(profileFile) } else { profile.InitFromCode(sessionUrlPrefix) } logger, _ = logg.NewLogger(logType, fmt.Sprintf("%s_%d_%d_%d", profileType, rps, sessionAmount, slowThreshold)) rand.Seed(time.Now().UnixNano()) hamm := new(Hammer) hamm.Init() go hamm.launch(rps) http.HandleFunc("/log", hamm.log) http.HandleFunc("/health", hamm.health) http.ListenAndServe(":9090", nil) var input string for { fmt.Scanln(&input) if input == "exit" { break } } }
// main func func main() { flag.Parse() NCPU := runtime.NumCPU() runtime.GOMAXPROCS(1) // to speed up rands = make([]*rand.Rand, NCPU) for i, _ := range rands { s := rand.NewSource(time.Now().UnixNano()) rands[i] = rand.New(s) } log.Println("cpu number -> ", NCPU) log.Println("rps -> ", rps) log.Println("slow threshold -> ", slowThreshold, "ms") log.Println("profile type -> ", profileType) log.Println("Proxy -> ", proxy) profile, _ = scenario.New(profileType, sessionAmount) if profileFile != "" { profile.InitFromFile(profileFile) } else { profile.InitFromCode() } rand.Seed(time.Now().UnixNano()) counter := new(Counter) counter.Init() go counter.launch(rps) var input string fmt.Scanln(&input) }