Skip to content

Commit

Permalink
add execution time measurement
Browse files Browse the repository at this point in the history
  • Loading branch information
eze-kiel committed Feb 24, 2021
1 parent 1556a3e commit 35433c3
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"os"
"time"

"github.com/briandowns/spinner"
"github.com/devops-works/slowql"
"github.com/sirupsen/logrus"
)
Expand All @@ -22,12 +21,8 @@ func main() {
}
p := slowql.NewParser(fd)

fmt.Println("Operations simulations...")
s := spinner.New(spinner.CharSets[9], 100*time.Millisecond)
s.Start()
time.Sleep(4 * time.Second)
s.Stop()

var count int
start := time.Now()
for {
q, err := p.GetNext()
if err != nil {
Expand All @@ -47,5 +42,9 @@ func main() {
q.RowsExamined,
q.Query,
)
count++
}

elapsed := time.Since(start)
fmt.Printf("parsed %d queries in %s\n", count, elapsed)
}

0 comments on commit 35433c3

Please sign in to comment.