Skip to content
Snippets Groups Projects
Commit 01255ecc authored by Richard T. Carback III's avatar Richard T. Carback III
Browse files

Add debug flag to benchmarks

parent c941e1ef
Branches
Tags
No related merge requests found
...@@ -10,6 +10,7 @@ import ( ...@@ -10,6 +10,7 @@ import (
var benchBatchSize uint64 var benchBatchSize uint64
var nodeCount int var nodeCount int
var iterations int var iterations int
var debug bool
func init() { func init() {
benchmarkCmd.Flags().Uint64VarP(&benchBatchSize, "batch", "b", 1, benchmarkCmd.Flags().Uint64VarP(&benchBatchSize, "batch", "b", 1,
...@@ -18,6 +19,8 @@ func init() { ...@@ -18,6 +19,8 @@ func init() {
"Number of nodes for the benchmark") "Number of nodes for the benchmark")
benchmarkCmd.Flags().IntVarP(&iterations, "iterations", "i", 100, benchmarkCmd.Flags().IntVarP(&iterations, "iterations", "i", 100,
"Number of times to iterate the benchmark") "Number of times to iterate the benchmark")
rootCmd.Flags().BoolVar(&debug, "debug", false,
"Show debug and warning info (default is to only show errors and above)")
rootCmd.AddCommand(benchmarkCmd) rootCmd.AddCommand(benchmarkCmd)
} }
...@@ -30,6 +33,12 @@ var benchmarkCmd = &cobra.Command{ ...@@ -30,6 +33,12 @@ var benchmarkCmd = &cobra.Command{
fmt.Printf("Running benchmarks for %d nodes with %d batch size and %d"+ fmt.Printf("Running benchmarks for %d nodes with %d batch size and %d"+
" iterations...\n", nodeCount, benchBatchSize, iterations) " iterations...\n", nodeCount, benchBatchSize, iterations)
if debug {
jww.SetLogThreshold(jww.LevelDebug)
} else {
jww.SetLogThreshold(jww.LevelError)
}
start := time.Now() start := time.Now()
benchmark.PrecompIterations(nodeCount, benchBatchSize, iterations) benchmark.PrecompIterations(nodeCount, benchBatchSize, iterations)
precompDelta := (float64(time.Since(start)) / 1000000000) / float64(iterations) precompDelta := (float64(time.Since(start)) / 1000000000) / float64(iterations)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment