mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 15:20:54 +00:00
toolbox: fix the program name
This commit is contained in:
parent
3969cd3b40
commit
cad3da337a
@ -15,6 +15,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
"path"
|
||||||
"runtime"
|
"runtime"
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
"runtime/pprof"
|
"runtime/pprof"
|
||||||
@ -64,7 +65,8 @@ func MemProf(w io.Writer) {
|
|||||||
pprof.WriteHeapProfile(f)
|
pprof.WriteHeapProfile(f)
|
||||||
f.Close()
|
f.Close()
|
||||||
fmt.Fprintf(w, "create heap profile %s \n", filename)
|
fmt.Fprintf(w, "create heap profile %s \n", filename)
|
||||||
fmt.Fprintf(w, "Now you can use this to check it: go tool pprof <program> %s\n", filename)
|
_, fl := path.Split(os.Args[0])
|
||||||
|
fmt.Fprintf(w, "Now you can use this to check it: go tool pprof %s %s\n", fl, filename)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,7 +87,8 @@ func GetCPUProfile(rw http.ResponseWriter) {
|
|||||||
time.Sleep(time.Duration(sec) * time.Second)
|
time.Sleep(time.Duration(sec) * time.Second)
|
||||||
pprof.StopCPUProfile()
|
pprof.StopCPUProfile()
|
||||||
fmt.Fprintf(rw, "create cpu profile %s \n", filename)
|
fmt.Fprintf(rw, "create cpu profile %s \n", filename)
|
||||||
fmt.Fprintf(rw, "Now you can use this to check it: go tool pprof <program> %s\n", filename)
|
_, fl := path.Split(os.Args[0])
|
||||||
|
fmt.Fprintf(rw, "Now you can use this to check it: go tool pprof %s %s\n", fl, filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
// print gc information to io.Writer
|
// print gc information to io.Writer
|
||||||
|
Loading…
Reference in New Issue
Block a user