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

feat: also save the lower and upper fences in the json data #46

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions src/pytest_codspeed/instruments/walltime.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,14 @@ def from_codspeed_config(cls, config: CodSpeedConfig) -> BenchmarkConfig:
class BenchmarkStats:
min_ns: float
max_ns: float
stdev_ns: float
mean_ns: float
stdev_ns: float

lower_fence_ns: float
q1_ns: float
median_ns: float
q3_ns: float
upper_fence_ns: float

rounds: int
total_time: float
Expand All @@ -76,17 +79,26 @@ def from_list(
stdev_ns = stdev(times_ns) if len(times_ns) > 1 else 0
mean_ns = mean(times_ns)
q1_ns, median_ns, q3_ns = quantiles(times_ns, n=4)
iqr_ns = q3_ns - q1_ns
lower_fence_ns = q1_ns - 1.5 * iqr_ns
upper_fence_ns = q3_ns + 1.5 * iqr_ns
outliers_rounds = sum(
1 for t in times_ns if t < lower_fence_ns or t > upper_fence_ns
)

return cls(
min_ns=min(times_ns),
max_ns=max(times_ns),
stdev_ns=stdev_ns,
mean_ns=mean_ns,
median_ns=median_ns,
lower_fence_ns=lower_fence_ns,
q1_ns=q1_ns,
median_ns=median_ns,
q3_ns=q3_ns,
upper_fence_ns=upper_fence_ns,
rounds=rounds,
total_time=total_time,
outlier_rounds=sum(1 for t in times_ns if abs(t - mean_ns) > stdev_ns),
outlier_rounds=outliers_rounds,
iter_per_round=iter_per_round,
warmup_iters=warmup_iters,
)
Expand Down
Loading