v0.2.0 80c61e3

congestion_test.go RawHistoryFolder

1package dgram
2
3import (
4	"testing"
5	"time"
6)
7
8func TestCongestionControllerBoundsAndIntegerGrowth(t *testing.T) {
9	const mtu = 1200
10	c := newCongestionController(mtu)
11	if got, want := c.cwndBytes, initialCongestionPackets*mtu; got != want {
12		t.Fatalf("initial cwnd=%d, want %d", got, want)
13	}
14	if got, want := c.burstBytes(), dataBurstPackets*mtu; got != want {
15		t.Fatalf("initial burst=%d, want %d", got, want)
16	}
17	if got, want := c.bytesPerSecond(), initialCongestionPackets*mtu*int(time.Second/initialPacingRTT); got != want {
18		t.Fatalf("initial pacing rate=%d, want %d", got, want)
19	}
20
21	c.onLoss()
22	if got, want := c.cwndBytes, initialCongestionPackets*mtu/2; got != want {
23		t.Fatalf("cwnd after first loss=%d, want %d", got, want)
24	}
25	c.cwndBytes = 3 * mtu
26	c.onLoss()
27	if got, want := c.cwndBytes, minimumCongestionPackets*mtu; got != want {
28		t.Fatalf("minimum cwnd=%d, want %d", got, want)
29	}
30
31	c.cwndBytes = 10 * mtu
32	c.onACK(1)
33	if got, want := c.cwndBytes, 10*mtu+1; got != want {
34		t.Fatalf("minimum additive increase cwnd=%d, want %d", got, want)
35	}
36	c.onACK(10 * mtu)
37	if got, want := c.cwndBytes, 10*mtu+1+(mtu*10*mtu)/(10*mtu+1); got != want {
38		t.Fatalf("integer additive increase cwnd=%d, want %d", got, want)
39	}
40	c.cwndBytes = maximumCongestionBytes
41	c.onACK(maximumCongestionBytes)
42	if got := c.cwndBytes; got != maximumCongestionBytes {
43		t.Fatalf("maximum cwnd=%d, want %d", got, maximumCongestionBytes)
44	}
45
46	c.onRTT(500 * time.Microsecond)
47	if got, want := c.bytesPerSecond(), maximumCongestionBytes*1000; got != want {
48		t.Fatalf("sub-millisecond pacing rate=%d, want %d", got, want)
49	}
50}
51
52func BenchmarkCongestionControllerACK(b *testing.B) {
53	c := newCongestionController(defaultMTU)
54	b.ReportAllocs()
55	for b.Loop() {
56		c.onACK(defaultMTU)
57		if c.cwndBytes == c.maxBytes {
58			c = newCongestionController(defaultMTU)
59		}
60	}
61}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 12

Tags 11

↑↓ moveenter openesc close