Add Name field to benchmarks

This commit is contained in:
Alan Bernstein 2016-12-19 17:59:49 -06:00
parent b1795eb04e
commit 7898f67164
7 changed files with 33 additions and 3 deletions

View file

@ -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.

View file

@ -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

View file

@ -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 {

View file

@ -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

View file

@ -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

View file

@ -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
}

View file

@ -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))