Skip to content

Commit d253a21

Browse files
authored
Merge branch 'main' into transport/pto-stop-stats
2 parents b6275f7 + d8f9615 commit d253a21

39 files changed

Lines changed: 964 additions & 260 deletions

‎.github/actions/check-android/action.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ inputs:
2424
runs:
2525
using: composite
2626
steps:
27-
- uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0
27+
- uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6.3.0
2828
with:
2929
distribution: zulu
3030
# renovate: depName=java-jdk datasource=java-version

‎.github/actions/check-vm/action.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ runs:
148148
echo "envs=CARGO_TERM_COLOR RUST_BACKTRACE RUST_LOG RUST_TEST_TIME_UNIT RUST_TEST_TIME_INTEGRATION RUST_TEST_TIME_DOCTEST WD" >> "$GITHUB_OUTPUT"
149149
150150
- if: ${{ inputs.platform == 'freebsd' }}
151-
uses: vmactions/freebsd-vm@c46abacb49f09938ca4e1702d15d836285d694cc # v1.5.9
151+
uses: vmactions/freebsd-vm@811efaaac0668df8bfb8308c3ec997b5ab50037b # v1.6.0
152152
with:
153153
release: "15.1"
154154
usesh: true
@@ -170,9 +170,9 @@ runs:
170170
run: ${{ steps.prep.outputs.run }}
171171

172172
- if: ${{ inputs.platform == 'netbsd' }}
173-
uses: vmactions/netbsd-vm@c8a0d7ddb84619a7a8cc4e652efa7950b3fd9f92 # v1.5.2
173+
uses: vmactions/netbsd-vm@5957cf330aef2e6ddc63c604364c99ce2e02b91d # v1.5.3
174174
with:
175-
release: "11.0"
175+
release: "11.1"
176176
usesh: true
177177
disable-cache: true
178178
copyback: true
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Prepare huge-page text
2+
description: >
3+
Build elfremapper. Preloaded into a benchmark, it moves the executable's code and data onto
4+
2 MiB pages, so their physical placement, which otherwise differs between copies of the same
5+
binary, stops affecting the timings.
6+
outputs:
7+
preload:
8+
description: Library to preload into a benchmark
9+
value: ${{ steps.build.outputs.preload }}
10+
runs:
11+
using: composite
12+
steps:
13+
- id: build
14+
shell: bash
15+
env:
16+
REV: 8e19b343deabe6c9e05d5882e173afa846d3832a # dmitriy-philimonov/elfremapper
17+
run: |
18+
[ "$APT_UPDATED" ] || sudo apt-get update && echo "APT_UPDATED=1" >> "$GITHUB_ENV"
19+
sudo apt-get install -y --no-install-recommends cmake g++
20+
src="$RUNNER_TEMP/elfremapper"
21+
mkdir -p "$src"
22+
curl -fsSL "https://github.com/dmitriy-philimonov/elfremapper/archive/$REV.tar.gz" | tar -xz -C "$src" --strip-components=1
23+
# THPs via `MADV_COLLAPSE`: CodSpeed can't symbolize hugetlb pages, and enabling THP slows
24+
# the kernel's send path.
25+
# TODO: Drop the patch once a release has https://github.com/dmitriy-philimonov/elfremapper/issues/5.
26+
patch -d "$src" -p1 < "$GITHUB_ACTION_PATH/collapse.patch"
27+
cmake -S "$src" -B "$src/build" -DCMAKE_BUILD_TYPE=Release -DMAKE_LD_PRELOAD_LIBRARY=1
28+
cmake --build "$src/build"
29+
echo "preload=$(find "$src/build" -name 'libelfremapper.so.*' -type f)" >> "$GITHUB_OUTPUT"
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
--- a/src/elfremapper.cc
2+
+++ b/src/elfremapper.cc
3+
@@ -467,9 +467,7 @@
4+
size_t hugeSize = addrEnd - addrBeg;
5+
size_t hugePerm = perm | PROT_WRITE;
6+
void *huge = mmap((void *)addrBeg, hugeSize, hugePerm,
7+
- MAP_HUGETLB | MAP_HUGE_2MB | MAP_PRIVATE | MAP_ANONYMOUS |
8+
- MAP_FIXED,
9+
- -1, 0);
10+
+ MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0);
11+
if (huge == MAP_FAILED) {
12+
/* can't print error */
13+
err = errno;
14+
@@ -495,6 +493,11 @@
15+
const TRegionInfo &ri = info[i];
16+
memcpy(ri.RealAddr, ri.RemapAddr, ri.RemapSize);
17+
munmap(ri.RemapAddr, ri.RemapSize);
18+
+ }
19+
+ /* THPs regardless of the THP sysfs settings (Linux 6.1+) */
20+
+ int collapseErr = 0;
21+
+ if (madvise(huge, hugeSize, 25 /* MADV_COLLAPSE */) == -1) {
22+
+ collapseErr = errno;
23+
}
24+
25+
/* remove PROT_WRITE from the mapping */
26+
@@ -518,6 +521,11 @@
27+
PRINT_ERROR_ERRNO_IMPL(err, "Drop write access (mprotect(%p, %#lx, %d))",
28+
huge, hugeSize, static_cast<int>(perm));
29+
}
30+
+ if (collapseErr) {
31+
+ PRINT_ERROR_ERRNO_IMPL(collapseErr, "MADV_COLLAPSE(%p, %#lx)", huge,
32+
+ hugeSize);
33+
+ return 0;
34+
+ }
35+
36+
hugeSize /= HUGE_PAGE_SIZE;
37+
DEBUG("Remapped [%#lx, %#lx) to %lu pages (2M)", addrBeg, addrEnd,

‎.github/actions/install-build-deps/action.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ runs:
5151
using: composite
5252
steps:
5353
- id: rust
54-
uses: mozilla/actions/rust@21f6d303fcbd4e418481d01cf738591b847037b7 # v3.2.0
54+
uses: mozilla/actions/rust@80429d96b44ae13c8cfe2a2dbec978ffc31c3720 # v3.3.0
5555
with:
5656
version: ${{ inputs.version }}
5757
components: ${{ inputs.components }}

‎.github/actions/quic-interop-runner/action.yml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ runs:
4848

4949
- name: Install dependencies
5050
run: |
51-
sudo add-apt-repository ppa:wireshark-dev/nightly
5251
sudo apt-get update
5352
sudo apt-get install -y --no-install-recommends tshark
5453
shell: bash

‎.github/scripts/bench-compare.py‎

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
#!/usr/bin/env python3
2+
"""Compare the baseline and PR builds of a benchmark over several criterion processes.
3+
4+
Each argument is a directory holding `<side>/<run>/{benchmark,estimates}.json`, one run
5+
per process, for the sides `neqo-baseline` and `neqo`. Prints each comparison in
6+
criterion's own text format, which format-bench-results.py and the regression gate parse.
7+
"""
8+
9+
import json
10+
import sys
11+
from pathlib import Path
12+
from statistics import median
13+
14+
from scipy.stats import mannwhitneyu
15+
16+
SIGNIFICANCE = 0.05
17+
# Criterion's default, and the `noise_threshold` that the walltime benchmark groups set.
18+
NOISE_THRESHOLD = 0.01
19+
GROUP_NOISE_THRESHOLDS = {
20+
"streams": 0.03,
21+
"streams-flow-controlled": 0.03,
22+
"transfer": 0.03,
23+
}
24+
25+
26+
def short(n: float, sign: str = "") -> str:
27+
"""Format a number like criterion's `format::short` or `signed_short`."""
28+
for limit, digits in ((10, 4), (100, 3), (1000, 2), (10000, 1)):
29+
if abs(n) < limit:
30+
return f"{n:{sign}.{digits}f}"
31+
return f"{n:{sign}.0f}"
32+
33+
34+
def time(ns: float) -> str:
35+
"""Format nanoseconds like criterion's `format::time`."""
36+
for scale, unit in ((1e9, "s"), (1e6, "ms"), (1e3, "µs"), (1, "ns")):
37+
if ns >= scale:
38+
return f"{short(ns / scale):>6} {unit}"
39+
return f"{short(ns * 1e3):>6} ps"
40+
41+
42+
def change(ratio: float) -> str:
43+
"""Format a relative change like criterion's `format::change`."""
44+
return f"{short(ratio * 1e2, '+'):>6}%"
45+
46+
47+
def bracket(values: list[float], fmt) -> str:
48+
"""Format the minimum, median and maximum of `values`."""
49+
return f"[{fmt(min(values))} {fmt(median(values))} {fmt(max(values))}]"
50+
51+
52+
def read(path: Path) -> dict:
53+
"""Read a JSON file criterion wrote."""
54+
return json.loads(path.read_text(encoding="utf-8"))
55+
56+
57+
def means(side: Path) -> list[float]:
58+
"""Return each run's mean, in nanoseconds."""
59+
return [read(f)["mean"]["point_estimate"] for f in side.glob("*/estimates.json")]
60+
61+
62+
def compare(path: Path) -> list[str]:
63+
"""Return criterion's output lines for one benchmark."""
64+
pr = means(path / "neqo")
65+
if not pr:
66+
return []
67+
base = means(path / "neqo-baseline")
68+
bench = read(next(path.glob("neqo/*/benchmark.json")))
69+
title = bench["title"]
70+
pad = " " * 24
71+
timing = f"time: {bracket(pr, time)}"
72+
# Criterion puts ids of more than 23 characters on a line of their own.
73+
lines = [title, pad + timing] if len(title) > 23 else [f"{title:<24}{timing}"]
74+
if not base:
75+
return lines
76+
77+
p = mannwhitneyu(base, pr, alternative="two-sided", method="exact").pvalue
78+
delta = median(pr) / median(base) - 1
79+
if p >= SIGNIFICANCE:
80+
verdict = "No change in performance detected."
81+
elif abs(delta) <= GROUP_NOISE_THRESHOLDS.get(bench["group_id"], NOISE_THRESHOLD):
82+
verdict = "Change within noise threshold."
83+
else:
84+
verdict = f"Performance has {'regressed' if delta > 0 else 'improved'}."
85+
relative = [v / median(base) - 1 for v in pr]
86+
p_text = f"p = {p:.2f} {'<' if p < SIGNIFICANCE else '>'} {SIGNIFICANCE:.2f}"
87+
return [
88+
*lines,
89+
f"{pad}baseline: {bracket(base, time)}",
90+
f"{' ' * 17}change:",
91+
f"{pad}time: {bracket(relative, change)} ({p_text})",
92+
pad + verdict,
93+
]
94+
95+
96+
def main() -> None:
97+
"""Print the comparison for each benchmark directory given."""
98+
for arg in sys.argv[1:]:
99+
for line in compare(Path(arg)):
100+
print(line)
101+
102+
103+
if __name__ == "__main__":
104+
main()

0 commit comments

Comments
 (0)