Skip to content

Commit

Permalink
Added profiling to CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
asticode committed Nov 26, 2017
1 parent 5d9f513 commit 207bfb4
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions astits/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,24 @@ import (
"github.com/asticode/go-astitools/flag"
"github.com/asticode/go-astits"
"github.com/pkg/errors"
"github.com/pkg/profile"
)

// Flags
var (
ctx, cancel = context.WithCancel(context.Background())
dataTypes = astiflag.NewStringsMap()
format = flag.String("f", "", "the format")
inputPath = flag.String("i", "", "the input path")
ctx, cancel = context.WithCancel(context.Background())
dataTypes = astiflag.NewStringsMap()
format = flag.String("f", "", "the format")
inputPath = flag.String("i", "", "the input path")
profileEnabled = flag.Bool("p", false, "if yes, profiling is enabled")
)

func main() {
// Start profiling
if *profileEnabled {
defer profile.Start(profile.MemProfile, profile.CPUProfile, profile.ProfilePath(".")).Stop()
}

// Init
flag.Var(dataTypes, "d", "the datatypes whitelist")
var s = astiflag.Subcommand()
Expand Down

0 comments on commit 207bfb4

Please sign in to comment.