Categorygithub.com/go-while/go-cpu-mem-profiler
modulepackage
0.0.0-20240612221627-856954a5fc83
Repository: https://github.com/go-while/go-cpu-mem-profiler.git
Documentation: pkg.go.dev

# README

go-cpu-mem-profiler

a hopefully simple to use cpu and mem profiler for GOlang

import (
	"github.com/go-while/go-cpu-mem-profiler"
)

var (
	Prof *prof.Profiler
)

func main() {
	Prof = prof.NewProf()

	// start a webserver
	go Prof.PprofWeb(":1234")

	// start a cpu profiler
	// _ is 'CPUfile' = the open file handle
	_, err := Prof.StartCPUProfile()
	if err != nil {
		os.Exit(1)
	}

	// stops the running cpu profiler
	Prof.StopCPUProfile()

	// starts a memory profiler for runtime
	// use waittime to delay the start
	Prof.StartMemProfile(runtime, waittime)
}

Contributing

Contributions to this code are welcome.

If you have suggestions for improvements or find issues, please feel free to open an issue or submit a pull request.

License

This code is provided under the MIT License. See the LICENSE file for details.

Footer

GitHub Profile Trophy

🏆 Add dynamically generated GitHub Stat Trophies on your readme

# Functions

No description provided by the author

# Structs

No description provided by the author