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

add timing info to benchmark command

parent 26337528
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,8 @@ package cmd ...@@ -3,6 +3,8 @@ package cmd
import ( import (
"gitlab.com/privategrity/server/benchmark" "gitlab.com/privategrity/server/benchmark"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"time"
"fmt"
) )
var benchBatchSize uint64 var benchBatchSize uint64
...@@ -25,7 +27,17 @@ var benchmarkCmd = &cobra.Command{ ...@@ -25,7 +27,17 @@ var benchmarkCmd = &cobra.Command{
Short: "Server benchmarking tests", Short: "Server benchmarking tests",
Long: `Run internal benchmark funcs by specifying node and batch sizes`, Long: `Run internal benchmark funcs by specifying node and batch sizes`,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("Running benchmarks for %d nodes with %d batch size and %d" +
" iterations...\n", nodeCount, benchBatchSize, iterations)
start := time.Now()
benchmark.PrecompIterations(nodeCount, benchBatchSize, iterations) benchmark.PrecompIterations(nodeCount, benchBatchSize, iterations)
precompDelta := (float64(time.Since(start))/1000000000)/float64(iterations)
fmt.Printf("Precomp took an average of %f s\n", precompDelta)
start = time.Now()
benchmark.RealtimeIterations(nodeCount, benchBatchSize, iterations) benchmark.RealtimeIterations(nodeCount, benchBatchSize, iterations)
realtimeDelta := (float64(time.Since(start))/1000000000)/float64(iterations)
fmt.Printf("Realtime took an average of %f s\n", realtimeDelta)
}, },
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment