util: pprof: Improve pprof for ease of use
This makes it slightly cleaner.
This commit is contained in:
20
main.go
20
main.go
@@ -77,16 +77,6 @@ func main() {
|
||||
return // for safety
|
||||
}
|
||||
|
||||
// Run profiling if it's activated.
|
||||
// TODO: Should we pass a logger into this?
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
if err := pprof.Run(ctx); err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
//return // redundant
|
||||
}
|
||||
defer cancel()
|
||||
|
||||
cliUtil.LogSetup(debug)
|
||||
data := &cliUtil.Data{
|
||||
Program: program,
|
||||
@@ -102,6 +92,16 @@ func main() {
|
||||
Args: os.Args,
|
||||
}
|
||||
|
||||
// Run profiling if it's activated.
|
||||
// TODO: Should we pass a logger into this?
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
if err := pprof.Run(ctx); err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
//return // redundant
|
||||
}
|
||||
defer cancel()
|
||||
|
||||
name := ""
|
||||
if len(data.Args) > 1 {
|
||||
name = data.Args[1]
|
||||
|
||||
Reference in New Issue
Block a user