golint toolbox
This commit is contained in:
@@ -34,7 +34,7 @@ func init() {
|
||||
pid = os.Getpid()
|
||||
}
|
||||
|
||||
// parse input command string
|
||||
// ProcessInput parse input command string
|
||||
func ProcessInput(input string, w io.Writer) {
|
||||
switch input {
|
||||
case "lookup goroutine":
|
||||
@@ -58,7 +58,7 @@ func ProcessInput(input string, w io.Writer) {
|
||||
}
|
||||
}
|
||||
|
||||
// record memory profile in pprof
|
||||
// MemProf record memory profile in pprof
|
||||
func MemProf(w io.Writer) {
|
||||
filename := "mem-" + strconv.Itoa(pid) + ".memprof"
|
||||
if f, err := os.Create(filename); err != nil {
|
||||
@@ -74,7 +74,7 @@ func MemProf(w io.Writer) {
|
||||
}
|
||||
}
|
||||
|
||||
// start cpu profile monitor
|
||||
// GetCPUProfile start cpu profile monitor
|
||||
func GetCPUProfile(w io.Writer) {
|
||||
sec := 30
|
||||
filename := "cpu-" + strconv.Itoa(pid) + ".pprof"
|
||||
@@ -92,7 +92,7 @@ func GetCPUProfile(w io.Writer) {
|
||||
fmt.Fprintf(w, "Now you can use this to check it: go tool pprof %s %s\n", fl, filename)
|
||||
}
|
||||
|
||||
// print gc information to io.Writer
|
||||
// PrintGCSummary print gc information to io.Writer
|
||||
func PrintGCSummary(w io.Writer) {
|
||||
memStats := &runtime.MemStats{}
|
||||
runtime.ReadMemStats(memStats)
|
||||
|
||||
Reference in New Issue
Block a user