Add pprof

Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
Jakub Sztandera 2020-06-26 22:18:43 +02:00
parent 04edeccbf4
commit 710286d6e7
No known key found for this signature in database
GPG Key ID: 9A9AF56F8B3879BA

View File

@ -7,6 +7,8 @@ import (
"io" "io"
"io/ioutil" "io/ioutil"
"math" "math"
"net/http"
_ "net/http/pprof"
"os" "os"
"runtime" "runtime"
"runtime/pprof" "runtime/pprof"
@ -249,6 +251,10 @@ var importAnalyzeCmd = &cli.Command{
return nil return nil
} }
go func() {
http.ListenAndServe("localhost:6060", nil)
}()
fi, err := os.Open(cctx.Args().First()) fi, err := os.Open(cctx.Args().First())
if err != nil { if err != nil {
return err return err
@ -282,6 +288,7 @@ var importAnalyzeCmd = &cli.Command{
} }
return return
} }
totalTime += tse.Duration totalTime += tse.Duration
for _, inv := range tse.Trace { for _, inv := range tse.Trace {
if inv.Duration > leastExpensiveInvoc { if inv.Duration > leastExpensiveInvoc {