Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
server
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
server
Commits
8afba7a8
Commit
8afba7a8
authored
Mar 8, 2018
by
Richard T. Carback III
Browse files
Options
Downloads
Patches
Plain Diff
Add benchmark subcommand with appropriate flags
parent
9333ec2f
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
cmd/benchmark.go
+31
-0
31 additions, 0 deletions
cmd/benchmark.go
cmd/root.go
+7
-7
7 additions, 7 deletions
cmd/root.go
with
38 additions
and
7 deletions
cmd/benchmark.go
0 → 100644
+
31
−
0
View file @
8afba7a8
package
cmd
import
(
"fmt"
"github.com/spf13/cobra"
)
var
benchBatchSize
uint64
var
nodeCount
int
var
iterations
int
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
.
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
.
Println
(
"Hugo Static Site Generator v0.9 -- HEAD"
)
},
}
This diff is collapsed.
Click to expand it.
cmd/root.go
+
7
−
7
View file @
8afba7a8
...
...
@@ -54,18 +54,18 @@ func init() {
// Here you will define your flags and configuration settings.
// Cobra supports persistent flags, which, if defined here,
// will be global for your application.
rootCmd
.
Persistent
Flags
()
.
StringVar
(
&
cfgFile
,
"config"
,
""
,
rootCmd
.
Flags
()
.
StringVar
(
&
cfgFile
,
"config"
,
""
,
"config file (default is $HOME/.privategrity/server.yaml)"
)
rootCmd
.
Persistent
Flags
()
.
BoolVarP
(
&
verbose
,
"verbose"
,
"v"
,
false
,
rootCmd
.
Flags
()
.
BoolVarP
(
&
verbose
,
"verbose"
,
"v"
,
false
,
"Verbose mode for debugging"
)
rootCmd
.
Persistent
Flags
()
.
IntVarP
(
&
serverIdx
,
"index"
,
"i"
,
0
,
rootCmd
.
Flags
()
.
IntVarP
(
&
serverIdx
,
"index"
,
"i"
,
0
,
"Config index to use for local server"
)
rootCmd
.
Persistent
Flags
()
.
Uint64VarP
(
&
batchSize
,
"batch"
,
"b"
,
1
,
rootCmd
.
Flags
()
.
Uint64VarP
(
&
batchSize
,
"batch"
,
"b"
,
1
,
"Batch size to use for node server rounds"
)
rootCmd
.
Persistent
Flags
()
.
Uint64VarP
(
&
nodeID
,
"nodeID"
,
"n"
,
rootCmd
.
Flags
()
.
Uint64VarP
(
&
nodeID
,
"nodeID"
,
"n"
,
math
.
MaxUint64
,
"Unique identifier for this node"
)
viper
.
BindPFlag
(
"batchSize"
,
rootCmd
.
Persistent
Flags
()
.
Lookup
(
"batch"
))
viper
.
BindPFlag
(
"nodeID"
,
rootCmd
.
Persistent
Flags
()
.
Lookup
(
"nodeID"
))
viper
.
BindPFlag
(
"batchSize"
,
rootCmd
.
Flags
()
.
Lookup
(
"batch"
))
viper
.
BindPFlag
(
"nodeID"
,
rootCmd
.
Flags
()
.
Lookup
(
"nodeID"
))
}
// initConfig reads in config file and ENV variables if set.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment