Skip to content

Commit

Permalink
help
Browse files Browse the repository at this point in the history
  • Loading branch information
bojand committed Oct 21, 2020
1 parent a64ff50 commit faaec5d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
16 changes: 8 additions & 8 deletions cmd/ghz/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,35 +78,35 @@ var (

// Run
isAsyncSet = false
async = kingpin.Flag("async", "Make async requests.").
async = kingpin.Flag("async", "Make requests asynchronous as soon as possible. Does not wait for request to finish before sending next one.").
Default("false").IsSetByUser(&isAsyncSet).Bool()

isQSet = false
q = kingpin.Flag("qps", "Queries per second (QPS) rate limit for constant load. Default is no rate limit.").
q = kingpin.Flag("qps", "Queries per second (QPS) rate limit for constant load schedule. Default is no rate limit.").
Default("0").Short('q').IsSetByUser(&isQSet).Uint()

isScheduleSet = false
schedule = kingpin.Flag("load-schedule", "Specifies the load schedule. Options are const, step, or line. Default is const.").
Default("const").IsSetByUser(&isScheduleSet).String()

isLoadStartSet = false
loadStart = kingpin.Flag("load-start", "Specifies the load start value.").
loadStart = kingpin.Flag("load-start", "Specifies the qps load start value for step or line schedules.").
Default("0").IsSetByUser(&isLoadStartSet).Uint()

isLoadStepSet = false
loadStep = kingpin.Flag("load-step", "Specifies the load step value or slope value.").
Default("0").IsSetByUser(&isLoadStepSet).Int()

isLoadEndSet = false
loadEnd = kingpin.Flag("load-end", "Specifies the load end value.").
loadEnd = kingpin.Flag("load-end", "Specifies the load end value for step or line load schedules.").
Default("0").IsSetByUser(&isLoadEndSet).Uint()

isLoadStepDurSet = false
loadStepDuration = kingpin.Flag("load-step-duration", "Specifies the load step duration value for step load schedule.").
Default("0").IsSetByUser(&isLoadStepDurSet).Duration()

isLoadMaxDurSet = false
loadMaxDuration = kingpin.Flag("load-max-duration", "Specifies the max load duration value for step or line.").
loadMaxDuration = kingpin.Flag("load-max-duration", "Specifies the max load duration value for step or line load schedule.").
Default("0").IsSetByUser(&isLoadMaxDurSet).Duration()

// Concurrency
Expand All @@ -119,15 +119,15 @@ var (
Default("const").IsSetByUser(&isCScheduleSet).String()

isCMinSet = false
cmin = kingpin.Flag("concurrency-min", "Concurrency minimum / start value for step and line schedules.").
cmin = kingpin.Flag("concurrency-min", "Concurrency minimum / start value for step and line concurrency schedules.").
Default("0").IsSetByUser(&isCMinSet).Uint()

isCMaxSet = false
cmax = kingpin.Flag("concurrency-max", "Concurrency maximum / end value for step and line schedules.").
cmax = kingpin.Flag("concurrency-max", "Concurrency maximum / end value for step and line concurrency schedules.").
Default("0").IsSetByUser(&isCMaxSet).Uint()

isCStepSet = false
cstep = kingpin.Flag("concurrency-step", "Concurrency step / slope value for step and line schedules.").
cstep = kingpin.Flag("concurrency-step", "Concurrency step / slope value for step and line concurrency schedules.").
Default("1").IsSetByUser(&isCStepSet).Int()

isCStepDurSet = false
Expand Down
14 changes: 13 additions & 1 deletion load/pacer.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type ConstantPacer struct {
// String returns a pretty-printed description of the ConstantPacer's behaviour:
// ConstantPacer{Freq: 1} => Constant{1 hits/1s}
func (cp *ConstantPacer) String() string {
return fmt.Sprintf("Constant{%d hits/%f}", cp.Freq, nano)
return fmt.Sprintf("Constant{%d hits/1s}", cp.Freq)
}

// Pace determines the length of time to sleep until the next hit is sent.
Expand Down Expand Up @@ -257,6 +257,12 @@ func (p *StepPacer) hits(t time.Duration) float64 {
return s + c
}

// String returns a pretty-printed description of the StepPacer's behaviour:
// StepPacer{Step: 1, StepDuration: 5s} => Step{1 hits/5s}
func (p *StepPacer) String() string {
return fmt.Sprintf("Step{%d hits/%s}", p.Step, p.StepDuration.String())
}

// LinearPacer paces an attack by starting at a given request rate
// and increasing linearly with the given slope.
type LinearPacer struct {
Expand Down Expand Up @@ -320,3 +326,9 @@ func (p *LinearPacer) hits(t time.Duration) float64 {

return p.sp.hits(t)
}

// String returns a pretty-printed description of the LinearPacer's behaviour:
// LinearPacer{Slope: 1} => Linear{1 hits/1s}
func (p *LinearPacer) String() string {
return fmt.Sprintf("Linear{%d hits/1s}", p.Slope)
}

0 comments on commit faaec5d

Please sign in to comment.