Skip to content
Snippets Groups Projects
Select Git revision
  • 859e8e7ee2694df64d11e3f540e87bacd645f7a8
  • release default protected
  • 11-22-implement-kv-interface-defined-in-collectiveversionedkvgo
  • hotfix/TestHostPool_UpdateNdf_AddFilter
  • XX-4719/announcementChannels
  • xx-4717/logLevel
  • jonah/noob-channel
  • master protected
  • XX-4707/tagDiskJson
  • xx-4698/notification-retry
  • hotfix/notifylockup
  • syncNodes
  • hotfix/localCB
  • XX-4677/NewChanManagerMobile
  • XX-4689/DmSync
  • duplicatePrefix
  • XX-4601/HavenInvites
  • finalizedUICallbacks
  • XX-4673/AdminKeySync
  • debugNotifID
  • anne/test
  • v4.7.5
  • v4.7.4
  • v4.7.3
  • v4.7.2
  • v4.7.1
  • v4.6.3
  • v4.6.1
  • v4.5.0
  • v4.4.4
  • v4.3.11
  • v4.3.8
  • v4.3.7
  • v4.3.6
  • v4.3.5
  • v4.2.0
  • v4.3.0
  • v4.3.4
  • v4.3.3
  • v4.3.2
  • v4.3.1
41 results

byID_test.go

Blame
  • benchmark.go 1.60 KiB
    package cmd
    
    import (
    	"fmt"
    	"github.com/spf13/cobra"
    	"gitlab.com/privategrity/server/benchmark"
    	"time"
    )
    
    var benchBatchSize uint64
    var nodeCount int
    var iterations int
    var debug bool
    
    func init() {
    	benchmarkCmd.Flags().Uint64VarP(&benchBatchSize, "batch", "b", 1,
    		"Batch size to use for node server rounds")
    	benchmarkCmd.Flags().IntVarP(&nodeCount, "numnodes", "n", 1,
    		"Number of nodes for the benchmark")
    	benchmarkCmd.Flags().IntVarP(&iterations, "iterations", "i", 100,
    		"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)
    }
    
    var benchmarkCmd = &cobra.Command{
    	Use:   "benchmark",
    	Short: "Server benchmarking tests",
    	Long:  `Run internal benchmark funcs by specifying node and batch sizes`,
    	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)
    
    		if debug {
    			jww.SetLogThreshold(jww.LevelDebug)
    		} else {
    			jww.SetLogThreshold(jww.LevelError)
    		}
    
    		start := time.Now()
    		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)
    		realtimeDelta := (float64(time.Since(start)) / 1000000000) / float64(iterations)
    		fmt.Printf("Realtime took an average of %f s\n", realtimeDelta)
    	},
    }