Skip to content

Commit

Permalink
use duration for offset
Browse files Browse the repository at this point in the history
  • Loading branch information
debbyku committed Nov 14, 2021
1 parent a841089 commit bf7b0ef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion fortio_main.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +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.Float64("o", defaults.Offset, "Offset of the histogram data 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
7 changes: 4 additions & 3 deletions periodic/periodic.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ type RunnerOptions struct {
Jitter bool
// Optional run id; used by the server to identify runs.
RunID int64
// Optional Offect; to offset the histogram function duration
Offset float64
// 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 @@ -408,7 +408,8 @@ func (r *periodicRunner) Run() RunnerResults {
}
start := time.Now()
// Histogram and stats for Function duration - millisecond precision
functionDuration := stats.NewHistogram(r.Offset, r.Resolution)
offsetSec := float64(r.Offset) / float64(time.Second)
functionDuration := stats.NewHistogram(offsetSec, 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

0 comments on commit bf7b0ef

Please sign in to comment.