import ()
var cfg = profile.Config{ MemProfile: true, ProfilePath: ".", // store profiles in current directory NoShutdownHook: true, // do not hook SIGINT}
var p = profile.Start(&cfg)
func main() {
rand.Seed(time.Now().Unix())
spawnNPCs() loadAllItemData()
//I'm sharing this code because I'm not sure if the fact that all the functions are on separate threads might be the problem. go listenOn843() go getConsoleInput() go moveBullets() go updatePlayers() go updateNPCs() go sendData() listenForPlayers()}
//I then stop the profile later on in the program via a command entered in the console--
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...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I tried that and I just get a web page that says "Could not enable CPU profiling: cpu profiling already in use"Do you know what that means?
The issue is you're now using different methods. The net/pprof import enables almost everything and you can fetch it on the fly. Dave Cheney's package is more explicit and only enables certain profiles, but it's more powerful on which ones it helps you enable. Enabling both will cause the error you're seeing.
My recommendation would be to remove all of your profiling specific code with exception to what you see in the net/pprof documentation which is the import and the http listener (if you didn't have one already)
--
var cfg = profile.Config{ MemProfile: true, ProfilePath: ".", // store profiles in current directory NoShutdownHook: true, // do not hook SIGINT}
func main() {
p := profile.Start(&cfg)
rand.Seed(time.Now().Unix())
spawnNPCs() loadAllItemData()
go listenOn843() go getConsoleInput() go moveBullets() go updatePlayers() go updateNPCs() go sendData() listenForPlayers()
p.Stop()}The program runs until I enter the command "stop", so it has enough time to collect data.But it still doesn't give as much information I feel like it should:( I'll attach the new pdf.