Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add offset to the histogram of the response time #495

Merged
merged 4 commits into from
Nov 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions fortio_main.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ var (
durationFlag = flag.Duration("t", defaults.Duration, "How long to run the test or 0 to run until ^C")
percentilesFlag = flag.String("p", "50,75,90,99,99.9", "List of pXX to calculate")
resolutionFlag = flag.Float64("r", defaults.Resolution, "Resolution of the histogram lowest buckets in seconds")
offsetFlag = flag.Duration("o", defaults.Offset, "Offset duration of the histogram data")
goMaxProcsFlag = flag.Int("gomaxprocs", 0, "Setting for runtime.GOMAXPROCS, <1 doesn't change the default")
profileFlag = flag.String("profile", "", "write .cpu and .mem profiles to `file`")
grpcFlag = flag.Bool("grpc", false, "Use GRPC (health check by default, add -ping for ping) for load testing")
Expand Down Expand Up @@ -387,6 +388,7 @@ func fortioLoad(justCurl bool, percList []float64) {
Exactly: *exactlyFlag,
Jitter: *jitterFlag,
RunID: *bincommon.RunIDFlag,
Offset: *offsetFlag,
}
var res periodic.HasRunnerResult
var err error
Expand Down
4 changes: 3 additions & 1 deletion periodic/periodic.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ type RunnerOptions struct {
Jitter bool
// Optional run id; used by the server to identify runs.
RunID int64
// Optional Offect Duration; to offset the histogram function duration
Offset time.Duration
}

// RunnerResults encapsulates the actual QPS observed and duration histogram.
Expand Down Expand Up @@ -406,7 +408,7 @@ func (r *periodicRunner) Run() RunnerResults {
}
start := time.Now()
// Histogram and stats for Function duration - millisecond precision
functionDuration := stats.NewHistogram(0, r.Resolution)
functionDuration := stats.NewHistogram(r.Offset.Seconds(), r.Resolution)
// Histogram and stats for Sleep time (negative offset to capture <0 sleep in their own bucket):
sleepTime := stats.NewHistogram(-0.001, 0.001)
if r.NumThreads <= 1 {
Expand Down