From 293621516efff8d0af9e36d20aaa55fae2862a8c Mon Sep 17 00:00:00 2001 From: jaffee Date: Fri, 16 Dec 2016 13:56:11 -0600 Subject: [PATCH] have bagent add metadata to results need this to differentiate multiple agents' output when it's all going to stdout. --- bench/diagonal.go | 8 ++++---- bench/multidb.go | 6 +++--- bench/random.go | 15 +++++++-------- cmd/pilosactl/main.go | 17 ++++++++++------- 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/bench/diagonal.go b/bench/diagonal.go index f8c592027..10ed20368 100644 --- a/bench/diagonal.go +++ b/bench/diagonal.go @@ -13,10 +13,10 @@ import ( // DiagonalSetBits sets bits with increasing profile id and bitmap id. type DiagonalSetBits struct { HasClient - BaseBitmapID int - BaseProfileID int - Iterations int - DB string + BaseBitmapID int `json:"base-bitmap-id"` + BaseProfileID int `json:"base-profile-id"` + Iterations int `json:"iterations"` + DB string `json:"db"` } func (b *DiagonalSetBits) Usage() string { diff --git a/bench/multidb.go b/bench/multidb.go index 65ad9c7a8..b8e4528cd 100644 --- a/bench/multidb.go +++ b/bench/multidb.go @@ -12,9 +12,9 @@ import ( // MultiDBSetBits sets bits with increasing profile id and bitmap id. type MultiDBSetBits struct { HasClient - BaseBitmapID int - BaseProfileID int - Iterations int + BaseBitmapID int `json:"base-bitmap-id"` + BaseProfileID int `json:"base-profile-id"` + Iterations int `json:"iterations"` } func (b *MultiDBSetBits) Usage() string { diff --git a/bench/random.go b/bench/random.go index 4d46484f1..a39d40106 100644 --- a/bench/random.go +++ b/bench/random.go @@ -14,14 +14,13 @@ import ( // RandomSetBits sets bits randomly and deterministically based on a seed. type RandomSetBits struct { HasClient - BaseBitmapID int64 - BaseProfileID int64 - BitmapIDRange int64 - ProfileIDRange int64 - Iterations int // number of bits that will be set - Seed int64 - DB string // DB to use in pilosa. - + BaseBitmapID int64 `json:"base-bitmap-id"` + BaseProfileID int64 `json:"base-profile-id"` + BitmapIDRange int64 `json:"bitmap-id-range"` + ProfileIDRange int64 `json:"profile-id-range"` + Iterations int `json:"iterations"` + Seed int64 `json:"seed"` + DB string `json:"db"` } func (b *RandomSetBits) Usage() string { diff --git a/cmd/pilosactl/main.go b/cmd/pilosactl/main.go index 92d75128b..5ea23aab6 100644 --- a/cmd/pilosactl/main.go +++ b/cmd/pilosactl/main.go @@ -1152,18 +1152,20 @@ func (cmd *CreateCommand) Run(ctx context.Context) error { // on the command line. type BagentCommand struct { // Slice of Benchmarks which will be run serially. - Benchmarks []bench.Benchmark + Benchmarks []bench.Benchmark `json:"benchmarks"` // AgentNum will be passed to each benchmark's Run method so that it can // parameterize its behavior. - AgentNum int - // Slice of pilosa hosts to run the Benchmarks against. - Hosts []string + AgentNum int `json:"agent-num"` + // Enable pretty printing of results, for human consumption. HumanReadable bool - Stdin io.Reader - Stdout io.Writer - Stderr io.Writer + // Slice of pilosa hosts to run the Benchmarks against. + Hosts []string `json:"hosts"` + + Stdin io.Reader `json:"-"` + Stdout io.Writer `json:"-"` + Stderr io.Writer `json:"-"` } // NewBagentCommand returns a new instance of BagentCommand. @@ -1280,6 +1282,7 @@ func (cmd *BagentCommand) Run(ctx context.Context) error { } res := sbm.Run(ctx, cmd.AgentNum) + res["metadata"] = cmd enc := json.NewEncoder(cmd.Stdout) enc.SetIndent("", " ") if cmd.HumanReadable {