Skip to content

Commit

Permalink
Only profile if asked
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan Lowe committed Dec 19, 2018
1 parent b5081c8 commit 7e06004
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions aoc2018.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,14 @@ var rootCmd = &cobra.Command{
}
start = time.Now()

profiler = profile.Start()
if viper.GetBool("profile") {
profiler = profile.Start()
}
},
PersistentPostRun: func(_ *cobra.Command, _ []string) {
profiler.Stop()
if profiler != nil {
profiler.Stop()
}
fmt.Printf("Took %s\n", time.Since(start))
},
}
Expand Down

0 comments on commit 7e06004

Please sign in to comment.