Tor 0.4.9.0-alpha-dev
lttng_cc.inc
Go to the documentation of this file.
1/* Copyright (c) 2021, The Tor Project, Inc. */
2/* See LICENSE for licensing information */
3
4/**
5 * \file lttng_cc.inc
6 * \brief LTTng tracing probe declaration for the congestion control subsystem.
7 * It is in this .inc file due to the non C standard syntax and the way
8 * we guard the header with the LTTng specific
9 * TRACEPOINT_HEADER_MULTI_READ.
10 **/
11
12#include "orconfig.h"
13
14/* We only build the following if LTTng instrumentation has been enabled. */
15#ifdef USE_TRACING_INSTRUMENTATION_LTTNG
16
17/* The following defines are LTTng-UST specific. */
18#undef TRACEPOINT_PROVIDER
19#define TRACEPOINT_PROVIDER tor_cc
20
21#undef TRACEPOINT_INCLUDE
22#define TRACEPOINT_INCLUDE "./src/core/or/lttng_cc.inc"
23
24#if !defined(LTTNG_CC_INC) || defined(TRACEPOINT_HEADER_MULTI_READ)
25#define LTTNG_CC_INC
26
27#include <lttng/tracepoint.h>
28
29/*
30 * Flow Control
31 */
32
33/* Emitted every time the flow_control_decide_xon() function is called. */
34TRACEPOINT_EVENT(tor_cc, flow_decide_xon,
35 TP_ARGS(const edge_connection_t *, stream, size_t, n_written),
36 TP_FIELDS(
37 ctf_integer(uint64_t, stream_id, TO_CONN(stream)->global_identifier)
38 ctf_integer(size_t, written_bytes, n_written)
39 ctf_integer(uint32_t, drained_bytes_current, stream->drained_bytes)
40 ctf_integer(uint32_t, drained_bytes_previous, stream->prev_drained_bytes)
41 ctf_integer(uint32_t, ewma_drain_rate_last, stream->ewma_rate_last_sent)
42 ctf_integer(uint32_t, ewma_drain_rate_current, stream->ewma_drain_rate)
43 ctf_integer(size_t, outbuf_len,
44 connection_get_outbuf_len(TO_CONN(stream)))
45 )
46)
47
48/* Emitted when flow control starts measuring the drain rate. */
49TRACEPOINT_EVENT(tor_cc, flow_decide_xon_drain_start,
50 TP_ARGS(const edge_connection_t *, stream),
51 TP_FIELDS(
52 ctf_integer(uint64_t, stream_id, TO_CONN(stream)->global_identifier)
53 ctf_integer(uint32_t, drained_bytes_current, stream->drained_bytes)
54 ctf_integer(uint32_t, drained_bytes_previous, stream->prev_drained_bytes)
55 ctf_integer(uint32_t, ewma_drain_rate_last, stream->ewma_rate_last_sent)
56 ctf_integer(uint32_t, ewma_drain_rate_current, stream->ewma_drain_rate)
57 ctf_integer(size_t, outbuf_len,
58 connection_get_outbuf_len(TO_CONN(stream)))
59 )
60)
61
62/* Emitted when the drain rate is updated. The new_drain_rate value is what was
63 * just computed. */
64TRACEPOINT_EVENT(tor_cc, flow_decide_xon_drain_update,
65 TP_ARGS(const edge_connection_t *, stream, uint32_t, drain_rate),
66 TP_FIELDS(
67 ctf_integer(uint64_t, stream_id, TO_CONN(stream)->global_identifier)
68 ctf_integer(uint32_t, drained_bytes_current, stream->drained_bytes)
69 ctf_integer(uint32_t, drained_bytes_previous, stream->prev_drained_bytes)
70 ctf_integer(uint32_t, new_drain_rate, drain_rate)
71 ctf_integer(uint32_t, ewma_drain_rate_last, stream->ewma_rate_last_sent)
72 ctf_integer(uint32_t, ewma_drain_rate_current, stream->ewma_drain_rate)
73 ctf_integer(size_t, outbuf_len,
74 connection_get_outbuf_len(TO_CONN(stream)))
75 )
76)
77
78/* Emitted when an XON cell is sent due to a notice in a drain rate change. */
79TRACEPOINT_EVENT(tor_cc, flow_decide_xon_rate_change,
80 TP_ARGS(const edge_connection_t *, stream),
81 TP_FIELDS(
82 ctf_integer(uint64_t, stream_id, TO_CONN(stream)->global_identifier)
83 ctf_integer(uint32_t, drained_bytes_current, stream->drained_bytes)
84 ctf_integer(uint32_t, drained_bytes_previous, stream->prev_drained_bytes)
85 ctf_integer(uint32_t, ewma_drain_rate_last, stream->ewma_rate_last_sent)
86 ctf_integer(uint32_t, ewma_drain_rate_current, stream->ewma_drain_rate)
87 ctf_integer(size_t, outbuf_len,
88 connection_get_outbuf_len(TO_CONN(stream)))
89 )
90)
91
92/* Emitted when an XON cell is sent because we partially or fully drained the
93 * edge connection buffer. */
94TRACEPOINT_EVENT(tor_cc, flow_decide_xon_partial_drain,
95 TP_ARGS(const edge_connection_t *, stream),
96 TP_FIELDS(
97 ctf_integer(uint64_t, stream_id, TO_CONN(stream)->global_identifier)
98 ctf_integer(uint32_t, drained_bytes_current, stream->drained_bytes)
99 ctf_integer(uint32_t, drained_bytes_previous, stream->prev_drained_bytes)
100 ctf_integer(uint32_t, ewma_drain_rate_last, stream->ewma_rate_last_sent)
101 ctf_integer(uint32_t, ewma_drain_rate_current, stream->ewma_drain_rate)
102 ctf_integer(size_t, outbuf_len,
103 connection_get_outbuf_len(TO_CONN(stream)))
104 )
105)
106
107/* Emitted when we double the drain rate which is an attempt to see if we can
108 * speed things up. */
109TRACEPOINT_EVENT(tor_cc, flow_decide_xon_drain_doubled,
110 TP_ARGS(const edge_connection_t *, stream),
111 TP_FIELDS(
112 ctf_integer(uint64_t, stream_id, TO_CONN(stream)->global_identifier)
113 ctf_integer(uint32_t, drained_bytes_current, stream->drained_bytes)
114 ctf_integer(uint32_t, drained_bytes_previous, stream->prev_drained_bytes)
115 ctf_integer(uint32_t, ewma_drain_rate_last, stream->ewma_rate_last_sent)
116 ctf_integer(uint32_t, ewma_drain_rate_current, stream->ewma_drain_rate)
117 ctf_integer(size_t, outbuf_len,
118 connection_get_outbuf_len(TO_CONN(stream)))
119 )
120)
121
122/* XOFF */
123
124/* Emitted when we send an XOFF cell. */
125TRACEPOINT_EVENT(tor_cc, flow_decide_xoff_sending,
126 TP_ARGS(const edge_connection_t *, stream),
127 TP_FIELDS(
128 ctf_integer(uint64_t, stream_id, TO_CONN(stream)->global_identifier)
129 ctf_integer(uint32_t, drained_bytes_current, stream->drained_bytes)
130 ctf_integer(uint32_t, drained_bytes_previous, stream->prev_drained_bytes)
131 ctf_integer(uint32_t, ewma_drain_rate_last, stream->ewma_rate_last_sent)
132 ctf_integer(uint32_t, ewma_drain_rate_current, stream->ewma_drain_rate)
133 ctf_integer(size_t, outbuf_len,
134 connection_get_outbuf_len(TO_CONN(stream)))
135 )
136)
137
138/*
139 * Congestion Control
140 */
141
142/* Emitted when the BDP value has been updated. */
143TRACEPOINT_EVENT(tor_cc, bdp_update,
144 TP_ARGS(const circuit_t *, circ, const congestion_control_t *, cc,
145 uint64_t, curr_rtt_usec),
146 TP_FIELDS(
147 ctf_integer(uint64_t, circuit_ptr, circ)
148 ctf_integer(uint32_t, n_circ_id, circ->n_circ_id)
149 ctf_integer(uint64_t, min_rtt_usec, cc->min_rtt_usec)
150 ctf_integer(uint64_t, curr_rtt_usec, curr_rtt_usec)
151 ctf_integer(uint64_t, ewma_rtt_usec, cc->ewma_rtt_usec)
152 ctf_integer(uint64_t, max_rtt_usec, cc->max_rtt_usec)
153 ctf_integer(uint64_t, bdp_cwnd_rtt, cc->bdp)
154 )
155)
156
157#endif /* LTTNG_CC_INC || TRACEPOINT_HEADER_MULTI_READ */
158
159/* Must be included after the probes declaration. */
160#include <lttng/tracepoint-event.h>
161
162#endif /* USE_TRACING_INSTRUMENTATION_LTTNG */
#define TO_CONN(c)
Definition: or.h:612