Skip to content

Commit

Permalink
Fix uperf RR reporting (#146)
Browse files Browse the repository at this point in the history
Uperf was reporting Mbps for RR throughput instead of op/s.
Fixed that in this patch.

fixes #144

Signed-off-by: venkataanil <[email protected]>
  • Loading branch information
venkataanil authored Jun 24, 2024
1 parent da7c88b commit 00cfd19
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
4 changes: 2 additions & 2 deletions cmd/k8s-netperf/k8s-netperf.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ func executeWorkload(nc config.Config, s config.PerfScenarios, hostNet bool, dri
if err != nil {
log.Fatal(err)
}
nr, err = driver.ParseResults(&r)
nr, err = driver.ParseResults(&r, nc)
if err != nil {
log.Error(err)
try := 0
Expand All @@ -377,7 +377,7 @@ func executeWorkload(nc config.Config, s config.PerfScenarios, hostNet bool, dri
log.Error(err)
continue
}
nr, err = driver.ParseResults(&r)
nr, err = driver.ParseResults(&r, nc)
if err != nil {
log.Error(err)
try++
Expand Down
2 changes: 1 addition & 1 deletion pkg/drivers/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
type Driver interface {
IsTestSupported(string) bool
Run(c *kubernetes.Clientset, rc rest.Config, nc config.Config, client apiv1.PodList, serverIP string) (bytes.Buffer, error)
ParseResults(stdout *bytes.Buffer) (sample.Sample, error)
ParseResults(stdout *bytes.Buffer, nc config.Config) (sample.Sample, error)
}

type netperf struct {
Expand Down
2 changes: 1 addition & 1 deletion pkg/drivers/iperf.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (i *iperf3) Run(c *kubernetes.Clientset, rc rest.Config, nc config.Config,

// ParseResults accepts the stdout from the execution of the benchmark.
// It will return a Sample struct or error
func (i *iperf3) ParseResults(stdout *bytes.Buffer) (sample.Sample, error) {
func (i *iperf3) ParseResults(stdout *bytes.Buffer, _ config.Config) (sample.Sample, error) {
sample := sample.Sample{}
sample.Driver = i.driverName
result := IperfResult{}
Expand Down
2 changes: 1 addition & 1 deletion pkg/drivers/netperf.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (n *netperf) Run(c *kubernetes.Clientset, rc rest.Config, nc config.Config,

// ParseResults accepts the stdout from the execution of the benchmark. It also needs
// It will return a Sample struct or error
func (n *netperf) ParseResults(stdout *bytes.Buffer) (sample.Sample, error) {
func (n *netperf) ParseResults(stdout *bytes.Buffer, _ config.Config) (sample.Sample, error) {
sample := sample.Sample{}
sample.Driver = n.driverName
send := 0.0
Expand Down
11 changes: 7 additions & 4 deletions pkg/drivers/uperf.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ func (u *uperf) Run(c *kubernetes.Clientset, rc rest.Config, nc config.Config, c

// ParseResults accepts the stdout from the execution of the benchmark.
// It will return a Sample struct or error
func (u *uperf) ParseResults(stdout *bytes.Buffer) (sample.Sample, error) {
func (u *uperf) ParseResults(stdout *bytes.Buffer, nc config.Config) (sample.Sample, error) {
sample := sample.Sample{}
sample.Driver = u.driverName
sample.Metric = "Mb/s"
Expand Down Expand Up @@ -218,10 +218,13 @@ func (u *uperf) ParseResults(stdout *bytes.Buffer) (sample.Sample, error) {

}
averageByte, _ := stats.Mean(byteSummary)
averageOps, _ := stats.Mean(opSummary)
sample.Throughput = float64(averageByte*8) / 1000000
if strings.Contains(nc.Profile, "STREAM") {
sample.Throughput = float64(averageByte*8) / 1000000
} else {
sample.Throughput, _ = stats.Mean(opSummary)
}
sample.Latency99ptile, _ = stats.Percentile(latSummary, 99)
log.Debugf("Storing uperf sample throughput: %f Mbps, P99 Latency %f, Average ops: %f ", sample.Throughput, sample.Latency99ptile, averageOps)
log.Debugf("Storing uperf sample Average bytes: %f , P99 Latency %f, Throughput: %f ", averageByte, sample.Latency99ptile, sample.Throughput)

return sample, nil

Expand Down

0 comments on commit 00cfd19

Please sign in to comment.