1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//! Test-only observation of the bytes one connection retains.
//!
//! A socket-level back-pressure test can show that a peer blocks without
//! showing what the server was holding when it did. These endpoints let a test
//! arm one aggregate limit and read the highest total recorded against it, so
//! the assertion names the budget it is checking instead of inferring it from
//! timing.
use ;
/// Aggregate limit the observing test armed; zero when nothing is armed.
static ARMED_LIMIT: AtomicUsize = new;
/// Highest retained total recorded against [`ARMED_LIMIT`].
static PEAK: AtomicUsize = new;
/// Start observing connections whose aggregate limit is `limit`.
///
/// Recording is scoped by the limit so another scenario running concurrently in
/// the same test binary, with its own budgets, cannot contribute to this peak.
/// Stop observing, leaving the recorded peak readable.
/// Report the bytes one connection retains while a chunk waits for admission.
///
/// The total covers every holder the connection counts: chunks queued or
/// reserved on the byte account, bytes retained by assembly, fragmentation and
/// parked messages, and the chunk still awaiting admission.
pub
/// Return the highest retained total recorded since [`arm`].
///
/// Zero means no connection with the armed limit reached an admission drive,
/// which is a failed observation rather than a connection that held nothing.