From 3b4f1acc07ac867041dde6e2e544712f1c3e0c67 Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Tue, 17 Nov 2020 15:24:19 +0100 Subject: [PATCH] Print warp client no in detailed analysis Example output: ``` Operation: PUT (3558914). Concurrency: 512. Hosts: 4. Warp Instances: 4. .... ``` --- cli/analyze.go | 3 +++ pkg/aggregate/aggregate.go | 3 +++ pkg/bench/ops.go | 12 ++++++++++++ 3 files changed, 18 insertions(+) diff --git a/cli/analyze.go b/cli/analyze.go index dc83157d..d728b709 100644 --- a/cli/analyze.go +++ b/cli/analyze.go @@ -280,6 +280,9 @@ func printAnalysis(ctx *cli.Context, o bench.Operations) { if ops.Hosts > 1 { hostsString = fmt.Sprintf(" Hosts: %d.", ops.Hosts) } + if ops.Clients > 1 { + hostsString = fmt.Sprintf("%s Warp Instances: %d.", hostsString, ops.Clients) + } if opo > 1 { if details { console.Printf("Operation: %v (%d). Objects per operation: %d. Concurrency: %d.%s\n", typ, ops.N, opo, ops.Concurrency, hostsString) diff --git a/pkg/aggregate/aggregate.go b/pkg/aggregate/aggregate.go index c98a641d..212161af 100644 --- a/pkg/aggregate/aggregate.go +++ b/pkg/aggregate/aggregate.go @@ -51,6 +51,8 @@ type Operation struct { ObjectsPerOperation int `json:"objects_per_operation"` // Concurrency - total number of threads running. Concurrency int `json:"concurrency"` + // Number of warp clients. + Clients int `json:"clients"` // Numbers of hosts Hosts int `json:"hosts"` // Populated if requests are all of same object size. @@ -184,6 +186,7 @@ func Aggregate(o bench.Operations, dFn SegmentDurFn, skipDur time.Duration) Aggr a.Throughput.Segmented.fill(segs, total) a.ObjectsPerOperation = ops.FirstObjPerOp() a.Concurrency = ops.Threads() + a.Clients = ops.Clients() a.Hosts = ops.Hosts() if !ops.MultipleSizes() { diff --git a/pkg/bench/ops.go b/pkg/bench/ops.go index 6b3245b5..f736ef68 100644 --- a/pkg/bench/ops.go +++ b/pkg/bench/ops.go @@ -800,6 +800,18 @@ func (o Operations) Hosts() int { return len(endpoints) } +// Clients returns the number of clients. +func (o Operations) Clients() int { + if len(o) == 0 { + return 0 + } + clients := make(map[string]struct{}, 10) + for _, op := range o { + clients[op.ClientID] = struct{}{} + } + return len(clients) +} + // Endpoints returns the endpoints as a sorted slice. func (o Operations) Endpoints() []string { if len(o) == 0 {