mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 14:23:30 +01:00
trace: Add four generic circuit tracepoints
Signed-off-by: David Goulet <dgoulet@torproject.org>
This commit is contained in:
parent
a706334577
commit
d36a44ffa9
@ -65,6 +65,7 @@
|
||||
#include "core/or/circuitpadding.h"
|
||||
#include "core/or/crypt_path.h"
|
||||
#include "core/or/extendinfo.h"
|
||||
#include "core/or/trace_probes_circuit.h"
|
||||
#include "core/mainloop/connection.h"
|
||||
#include "app/config/config.h"
|
||||
#include "core/or/connection_edge.h"
|
||||
@ -99,6 +100,7 @@
|
||||
#include "lib/compress/compress_zlib.h"
|
||||
#include "lib/compress/compress_zstd.h"
|
||||
#include "lib/buf/buffers.h"
|
||||
#include "lib/trace/events.h"
|
||||
|
||||
#include "core/or/ocirc_event.h"
|
||||
|
||||
@ -565,6 +567,8 @@ circuit_set_state(circuit_t *circ, uint8_t state)
|
||||
}
|
||||
if (state == CIRCUIT_STATE_GUARD_WAIT || state == CIRCUIT_STATE_OPEN)
|
||||
tor_assert(!circ->n_chan_create_cell);
|
||||
|
||||
tor_trace(circuit, change_state, circ, circ->state, state);
|
||||
circ->state = state;
|
||||
if (CIRCUIT_IS_ORIGIN(circ))
|
||||
circuit_state_publish(circ);
|
||||
@ -1253,6 +1257,10 @@ circuit_free_(circuit_t *circ)
|
||||
/* Clear all dangling handle references. */
|
||||
circuit_handles_clear(circ);
|
||||
|
||||
/* Tracepoint. Data within the circuit object is recorded so do this before
|
||||
* the actual memory free. */
|
||||
tor_trace(circuit, free, circ);
|
||||
|
||||
if (should_free) {
|
||||
memwipe(mem, 0xAA, memlen); /* poison memory */
|
||||
tor_free(mem);
|
||||
@ -2275,6 +2283,7 @@ circuit_mark_for_close_, (circuit_t *circ, int reason, int line,
|
||||
CIRCUIT_IS_ORIGIN(circ) ?
|
||||
TO_ORIGIN_CIRCUIT(circ)->global_identifier : 0,
|
||||
file, line, orig_reason, reason);
|
||||
tor_trace(circuit, mark_for_close, circ);
|
||||
}
|
||||
|
||||
/** Called immediately before freeing a marked circuit <b>circ</b> from
|
||||
|
@ -3144,6 +3144,7 @@ circuit_change_purpose(circuit_t *circ, uint8_t new_purpose)
|
||||
|
||||
old_purpose = circ->purpose;
|
||||
circ->purpose = new_purpose;
|
||||
tor_trace(circuit, change_purpose, circ, old_purpose, new_purpose);
|
||||
|
||||
if (CIRCUIT_IS_ORIGIN(circ)) {
|
||||
control_event_circuit_purpose_changed(TO_ORIGIN_CIRCUIT(circ),
|
||||
|
@ -163,6 +163,60 @@ TRACEPOINT_EVENT_INSTANCE(tor_circuit, origin_circuit_t_class, idle_timeout,
|
||||
TP_ARGS(const origin_circuit_t *, circ)
|
||||
)
|
||||
|
||||
/*
|
||||
* General circuit events.
|
||||
*/
|
||||
|
||||
TRACEPOINT_EVENT(tor_circuit, free,
|
||||
TP_ARGS(const circuit_t *, circ),
|
||||
TP_FIELDS(
|
||||
ctf_integer(uint32_t, circ_id,
|
||||
(CIRCUIT_IS_ORIGIN(circ) ?
|
||||
TO_ORIGIN_CIRCUIT(circ)->global_identifier : 0))
|
||||
ctf_enum(tor_circuit, purpose, int, purpose, circ->purpose)
|
||||
ctf_enum(tor_circuit, state, int, state, circ->state)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(tor_circuit, mark_for_close,
|
||||
TP_ARGS(const circuit_t *, circ),
|
||||
TP_FIELDS(
|
||||
ctf_integer(uint32_t, circ_id,
|
||||
(CIRCUIT_IS_ORIGIN(circ) ?
|
||||
TO_ORIGIN_CIRCUIT(circ)->global_identifier : 0))
|
||||
ctf_enum(tor_circuit, purpose, int, purpose, circ->purpose)
|
||||
ctf_enum(tor_circuit, state, int, state, circ->state)
|
||||
ctf_enum(tor_circuit, end_reason, int, close_reason,
|
||||
circ->marked_for_close_reason)
|
||||
ctf_enum(tor_circuit, end_reason, int, orig_close_reason,
|
||||
circ->marked_for_close_orig_reason)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(tor_circuit, change_purpose,
|
||||
TP_ARGS(const circuit_t *, circ, int, old_purpose, int, new_purpose),
|
||||
TP_FIELDS(
|
||||
ctf_integer(uint32_t, circ_id,
|
||||
(CIRCUIT_IS_ORIGIN(circ) ?
|
||||
TO_ORIGIN_CIRCUIT(circ)->global_identifier : 0))
|
||||
ctf_enum(tor_circuit, state, int, state, circ->state)
|
||||
ctf_enum(tor_circuit, purpose, int, purpose, old_purpose)
|
||||
ctf_enum(tor_circuit, purpose, int, new, new_purpose)
|
||||
)
|
||||
)
|
||||
|
||||
TRACEPOINT_EVENT(tor_circuit, change_state,
|
||||
TP_ARGS(const circuit_t *, circ, int, old_state, int, new_state),
|
||||
TP_FIELDS(
|
||||
ctf_integer(uint32_t, circ_id,
|
||||
(CIRCUIT_IS_ORIGIN(circ) ?
|
||||
TO_ORIGIN_CIRCUIT(circ)->global_identifier : 0))
|
||||
ctf_enum(tor_circuit, purpose, int, purpose, circ->purpose)
|
||||
ctf_enum(tor_circuit, state, int, old, old_state)
|
||||
ctf_enum(tor_circuit, state, int, new, new_state)
|
||||
)
|
||||
)
|
||||
|
||||
#endif /* TOR_TRACE_PROBES_CIRCUIT_H */
|
||||
|
||||
/* Must be include after the probes declaration. */
|
||||
|
Loading…
Reference in New Issue
Block a user