Skip to content

Commit

Permalink
trying to fix linter issues, removed unused vars
Browse files Browse the repository at this point in the history
  • Loading branch information
mchinta7 committed Jan 10, 2024
1 parent 169b003 commit 2ca8414
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 30 deletions.
7 changes: 1 addition & 6 deletions cmd/kperf/commands/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ var runCommand = cli.Command{
Name: "result",
Usage: "Path to the file which stores results",
},
cli.BoolFlag{
Name: "raw-data",
Usage: "Exports raw data as .json to specified file",
},
},
Action: func(cliCtx *cli.Context) error {
profileCfg, err := loadConfig(cliCtx)
Expand All @@ -83,7 +79,6 @@ var runCommand = cli.Command{
kubeCfgPath := cliCtx.String("kubeconfig")
userAgent := cliCtx.String("user-agent")
outputFilePath := cliCtx.String("result")
//rawData := cliCtx.Bool("raw-data")

conns := profileCfg.Spec.Conns
rate := profileCfg.Spec.Rate
Expand Down Expand Up @@ -159,5 +154,5 @@ func loadConfig(cliCtx *cli.Context) (*types.LoadProfile, error) {

// TODO: Complete this function
func printResponseStats(f *os.File, stats *request.Result) {

Check warning on line 156 in cmd/kperf/commands/runner/runner.go

View workflow job for this annotation

GitHub Actions / linter

unused-parameter: parameter 'stats' seems to be unused, consider removing or renaming it as _ (revive)

fmt.Fprint(f, "Response Stat: \n")
}
24 changes: 0 additions & 24 deletions metrics/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package metrics

import (
"container/list"
"math"
"sort"
"sync"
"sync/atomic"

Expand Down Expand Up @@ -64,7 +62,6 @@ func (m *responseMetricImpl) Gather() types.ResponseStats {
Latencies: latencies,
TotalReceivedBytes: atomic.LoadInt64(&m.receivedBytes),
}
//return latencies, buildPercentileLatencies(latencies), m.failureList, atomic.LoadInt64(&m.receivedBytes)
}

func (m *responseMetricImpl) dumpLatencies() []float64 {
Expand All @@ -76,24 +73,3 @@ func (m *responseMetricImpl) dumpLatencies() []float64 {
}
return res
}

var percentiles = []float64{0, 50, 90, 95, 99, 100}

func buildPercentileLatencies(latencies []float64) map[float64]float64 {
if len(latencies) == 0 {
return nil
}

res := make(map[float64]float64, len(percentiles))

n := len(latencies)
sort.Float64s(latencies)
for _, p := range percentiles {
idx := int(math.Ceil(float64(n) * p / 100))
if idx > 0 {
idx--
}
res[p] = latencies[idx]
}
return res
}

0 comments on commit 2ca8414

Please sign in to comment.