Skip to content

Commit

Permalink
Make profiling optional
Browse files Browse the repository at this point in the history
  • Loading branch information
GraDKh committed Jan 31, 2024
1 parent 97e4ff8 commit 0658452
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions cmd/blockimporter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ func main() {
)
flag.Parse()

f, err := os.Create(*cpuprofile)
if err != nil {
log.Fatal(err)
if *cpuprofile != "" {
f, err := os.Create(*cpuprofile)
if err != nil {
log.Fatal(err)
}
pprof.StartCPUProfile(f)
defer pprof.StopCPUProfile()
}
pprof.StartCPUProfile(f)
defer pprof.StopCPUProfile()

logger := logging.GetLogger("blockimporter")
settings := Settings{
Expand Down

0 comments on commit 0658452

Please sign in to comment.