mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
add agentNum to benchmark Init as well as run
This commit is contained in:
parent
5cebe8e043
commit
da024fb0d8
5 changed files with 9 additions and 9 deletions
|
|
@ -14,7 +14,7 @@ import (
|
|||
type Benchmark interface {
|
||||
// Init takes a list of hosts and is generally expected to set up a
|
||||
// connection to pilosa using whatever client it chooses.
|
||||
Init(hosts []string) error
|
||||
Init(hosts []string, agentNum int) error
|
||||
|
||||
// Run runs the benchmark. It takes an agentNum which should be used to
|
||||
// parameterize the benchmark if it is being run simultaneously on multiple
|
||||
|
|
@ -49,7 +49,7 @@ type parallelBenchmark struct {
|
|||
|
||||
// Init calls Init for each benchmark. If there are any errors, it will return a
|
||||
// non-nil error value.
|
||||
func (pb *parallelBenchmark) Init(hosts []string) error {
|
||||
func (pb *parallelBenchmark) Init(hosts []string, agentNum int) error {
|
||||
errors := make([]error, len(pb.benchmarkers))
|
||||
hadErr := false
|
||||
wg := sync.WaitGroup{}
|
||||
|
|
@ -57,7 +57,7 @@ func (pb *parallelBenchmark) Init(hosts []string) error {
|
|||
wg.Add(1)
|
||||
go func(i int, b Benchmark) {
|
||||
defer wg.Done()
|
||||
errors[i] = b.Init(hosts)
|
||||
errors[i] = b.Init(hosts, agentNum)
|
||||
if errors[i] != nil {
|
||||
hadErr = true
|
||||
}
|
||||
|
|
@ -105,11 +105,11 @@ type serialBenchmark struct {
|
|||
|
||||
// Init calls Init for each benchmark. If there are any errors, it will return a
|
||||
// non-nil error value.
|
||||
func (sb *serialBenchmark) Init(hosts []string) error {
|
||||
func (sb *serialBenchmark) Init(hosts []string, agentNum int) error {
|
||||
errors := make([]error, len(sb.benchmarkers))
|
||||
hadErr := false
|
||||
for i, b := range sb.benchmarkers {
|
||||
errors[i] = b.Init(hosts)
|
||||
errors[i] = b.Init(hosts, agentNum)
|
||||
if errors[i] != nil {
|
||||
hadErr = true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ func (b *DiagonalSetBits) ConsumeFlags(args []string) ([]string, error) {
|
|||
}
|
||||
|
||||
// Init connects to pilosa and sets the client on b.
|
||||
func (b *DiagonalSetBits) Init(hosts []string) (err error) {
|
||||
func (b *DiagonalSetBits) Init(hosts []string, agentNum int) (err error) {
|
||||
b.cli, err = pilosa.NewClient(hosts[0])
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ func (b *MultiDBSetBits) ConsumeFlags(args []string) ([]string, error) {
|
|||
}
|
||||
|
||||
// Init connects to pilosa and sets the client on b.
|
||||
func (b *MultiDBSetBits) Init(hosts []string) (err error) {
|
||||
func (b *MultiDBSetBits) Init(hosts []string, agentNum int) (err error) {
|
||||
b.cli, err = pilosa.NewClient(hosts[0])
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ func (b *RandomSetBits) ConsumeFlags(args []string) ([]string, error) {
|
|||
}
|
||||
|
||||
// Init connects to pilosa and sets the client on b.
|
||||
func (b *RandomSetBits) Init(hosts []string) (err error) {
|
||||
func (b *RandomSetBits) Init(hosts []string, agentNum int) (err error) {
|
||||
b.cli, err = pilosa.NewClient(hosts[0])
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
|||
|
|
@ -1369,7 +1369,7 @@ The following arguments are available:
|
|||
// Run executes the main program execution.
|
||||
func (cmd *BagentCommand) Run() error {
|
||||
sbm := bench.Serial(cmd.Benchmarks...)
|
||||
err := sbm.Init(cmd.Hosts)
|
||||
err := sbm.Init(cmd.Hosts, cmd.AgentNum)
|
||||
if err != nil {
|
||||
return fmt.Errorf("in cmd.Run initialization: %v", err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue