diff --git a/bench/diagonal.go b/bench/diagonal.go index 10ed20368..fb782e97c 100644 --- a/bench/diagonal.go +++ b/bench/diagonal.go @@ -13,12 +13,18 @@ import ( // DiagonalSetBits sets bits with increasing profile id and bitmap id. type DiagonalSetBits struct { HasClient + Name string `json:"name"` BaseBitmapID int `json:"base-bitmap-id"` BaseProfileID int `json:"base-profile-id"` Iterations int `json:"iterations"` DB string `json:"db"` } +func (b *DiagonalSetBits) Init(hosts []string, agentNum int) error { + b.Name = "DiagonalSetBits" + return b.HasClient.Init(hosts, agentNum) +} + func (b *DiagonalSetBits) Usage() string { return ` diagonal-set-bits sets bits with increasing profile id and bitmap id. diff --git a/bench/import.go b/bench/import.go index 8a249abbb..b3708d1a4 100644 --- a/bench/import.go +++ b/bench/import.go @@ -22,6 +22,7 @@ func NewImport(stdin io.Reader, stdout, stderr io.Writer) *Import { // Import sets bits with increasing profile id and bitmap id. type Import struct { + Name string `json:"name"` BaseBitmapID int64 `json:"base-bitmap-id"` MaxBitmapID int64 `json:"max-bitmap-id"` BaseProfileID int64 `json:"base-profile-id"` @@ -107,6 +108,7 @@ func (b *Import) Init(hosts []string, agentNum int) error { if len(hosts) == 0 { return fmt.Errorf("Need at least one host") } + b.Name = "Import" b.Host = hosts[0] // generate csv data baseBitmapID, maxBitmapID, baseProfileID, maxProfileID := b.BaseBitmapID, b.MaxBitmapID, b.BaseProfileID, b.MaxProfileID diff --git a/bench/multidb.go b/bench/multidb.go index b8e4528cd..36e672219 100644 --- a/bench/multidb.go +++ b/bench/multidb.go @@ -12,9 +12,15 @@ import ( // MultiDBSetBits sets bits with increasing profile id and bitmap id. type MultiDBSetBits struct { HasClient - BaseBitmapID int `json:"base-bitmap-id"` - BaseProfileID int `json:"base-profile-id"` - Iterations int `json:"iterations"` + Name string `json:"name"` + BaseBitmapID int `json:"base-bitmap-id"` + BaseProfileID int `json:"base-profile-id"` + Iterations int `json:"iterations"` +} + +func (b *MultiDBSetBits) Init(hosts []string, agentNum int) error { + b.Name = "MultiDBSetBits" + return b.HasClient.Init(hosts, agentNum) } func (b *MultiDBSetBits) Usage() string { diff --git a/bench/random.go b/bench/random.go index a39d40106..cf0b55832 100644 --- a/bench/random.go +++ b/bench/random.go @@ -14,6 +14,7 @@ import ( // RandomSetBits sets bits randomly and deterministically based on a seed. type RandomSetBits struct { HasClient + Name string `json:"name"` BaseBitmapID int64 `json:"base-bitmap-id"` BaseProfileID int64 `json:"base-profile-id"` BitmapIDRange int64 `json:"bitmap-id-range"` @@ -23,6 +24,11 @@ type RandomSetBits struct { DB string `json:"db"` } +func (b *RandomSetBits) Init(hosts []string, agentNum int) error { + b.Name = "RandomSetBits" + return b.HasClient.Init(hosts, agentNum) +} + func (b *RandomSetBits) Usage() string { return ` random-set-bits sets random bits diff --git a/bench/randquery.go b/bench/randquery.go index 3d6228f74..5f54e1a1e 100644 --- a/bench/randquery.go +++ b/bench/randquery.go @@ -12,6 +12,7 @@ import ( // RandomQuery queries randomly and deterministically based on a seed. type RandomQuery struct { HasClient + Name string `json:"name"` MaxDepth int `json:"max-depth"` MaxArgs int `json:"max-args"` MaxN int `json:"max-n"` @@ -22,6 +23,11 @@ type RandomQuery struct { DBs []string `json:"dbs"` } +func (b *RandomQuery) Init(hosts []string, agentNum int) error { + b.Name = "RandomQuery" + return b.HasClient.Init(hosts, agentNum) +} + func (b *RandomQuery) Usage() string { return ` random-query constructs random queries diff --git a/bench/sliceheight.go b/bench/sliceheight.go index 31aad4531..94d97c419 100644 --- a/bench/sliceheight.go +++ b/bench/sliceheight.go @@ -26,6 +26,7 @@ type SliceHeight struct { MaxTime time.Duration `json:"max-time"` hosts []string + Name string `json:"name"` MinBitsPerMap int64 `json:"min-bits-per-map"` MaxBitsPerMap int64 `json:"max-bits-per-map"` Seed int64 `json:"seed"` @@ -84,6 +85,7 @@ func (b *SliceHeight) ConsumeFlags(args []string) ([]string, error) { } func (b *SliceHeight) Init(hosts []string, agentNum int) error { + b.Name = "SliceHeight" b.hosts = hosts return nil } diff --git a/bench/zipf.go b/bench/zipf.go index b3f443706..c487ee667 100644 --- a/bench/zipf.go +++ b/bench/zipf.go @@ -17,6 +17,7 @@ import ( // It also uses PermutationGenerator to permute IDs randomly. type ZipfSetBits struct { HasClient + Name string BaseBitmapID int64 BaseProfileID int64 BitmapIDRange int64 @@ -122,6 +123,7 @@ func getZipfOffset(N int64, exp, ratio float64) float64 { } func (b *ZipfSetBits) Init(hosts []string, agentNum int) error { + b.Name = "ZipfSetBits" rnd := rand.New(rand.NewSource(b.Seed + int64(agentNum))) bitmapOffset := getZipfOffset(b.BitmapIDRange, b.BitmapExponent, b.BitmapRatio) b.BitmapRng = rand.NewZipf(rnd, b.BitmapExponent, bitmapOffset, uint64(b.BitmapIDRange-1))