trace: Add four more circuit subsystem tracepoints

Signed-off-by: David Goulet <dgoulet@torproject.org>
This commit is contained in:
David Goulet 2020-01-15 12:26:54 -05:00
parent bf0e2ae0d0
commit a706334577
3 changed files with 27 additions and 1 deletions

View File

@ -50,6 +50,7 @@
#include "core/or/ocirc_event.h"
#include "core/or/policies.h"
#include "core/or/relay.h"
#include "core/or/trace_probes_circuit.h"
#include "core/or/crypt_path.h"
#include "feature/client/bridges.h"
#include "feature/client/circpathbias.h"
@ -71,6 +72,7 @@
#include "feature/rend/rendcommon.h"
#include "feature/stats/predict_ports.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "lib/trace/events.h"
#include "core/or/cell_st.h"
#include "core/or/cpath_build_state_st.h"
@ -497,6 +499,8 @@ circuit_establish_circuit(uint8_t purpose, extend_info_t *exit_ei, int flags)
circuit_mark_for_close(TO_CIRCUIT(circ), -err_reason);
return NULL;
}
tor_trace(circuit, establish, circ);
return circ;
}

View File

@ -840,6 +840,7 @@ circuit_expire_building(void)
-1);
circuit_log_path(LOG_INFO,LD_CIRC,TO_ORIGIN_CIRCUIT(victim));
tor_trace(circuit, timeout, TO_ORIGIN_CIRCUIT(victim));
if (victim->purpose == CIRCUIT_PURPOSE_C_MEASURE_TIMEOUT)
circuit_mark_for_close(victim, END_CIRC_REASON_MEASUREMENT_EXPIRED);
else
@ -1503,8 +1504,10 @@ circuit_expire_old_circuits_clientside(void)
circ->purpose);
/* Don't do this magic for testing circuits. Their death is governed
* by circuit_expire_building */
if (circ->purpose != CIRCUIT_PURPOSE_PATH_BIAS_TESTING)
if (circ->purpose != CIRCUIT_PURPOSE_PATH_BIAS_TESTING) {
tor_trace(circuit, idle_timeout, TO_ORIGIN_CIRCUIT(circ));
circuit_mark_for_close(circ, END_CIRC_REASON_FINISHED);
}
} else if (!circ->timestamp_dirty && circ->state == CIRCUIT_STATE_OPEN) {
if (timercmp(&circ->timestamp_began, &cutoff, OP_LT)) {
if (circ->purpose == CIRCUIT_PURPOSE_C_GENERAL ||
@ -1523,6 +1526,7 @@ circuit_expire_old_circuits_clientside(void)
" that has been unused for %ld msec.",
TO_ORIGIN_CIRCUIT(circ)->global_identifier,
tv_mdiff(&circ->timestamp_began, &now));
tor_trace(circuit, idle_timeout, TO_ORIGIN_CIRCUIT(circ));
circuit_mark_for_close(circ, END_CIRC_REASON_FINISHED);
} else if (!TO_ORIGIN_CIRCUIT(circ)->is_ancient) {
/* Server-side rend joined circuits can end up really old, because
@ -2207,6 +2211,8 @@ circuit_launch_by_extend_info(uint8_t purpose,
tor_fragile_assert();
return NULL;
}
tor_trace(circuit, cannibalized, circ);
return circ;
}
}

View File

@ -147,6 +147,22 @@ TRACEPOINT_EVENT_INSTANCE(tor_circuit, origin_circuit_t_class, opened,
TP_ARGS(const origin_circuit_t *, circ)
)
TRACEPOINT_EVENT_INSTANCE(tor_circuit, origin_circuit_t_class, establish,
TP_ARGS(const origin_circuit_t *, circ)
)
TRACEPOINT_EVENT_INSTANCE(tor_circuit, origin_circuit_t_class, cannibalized,
TP_ARGS(const origin_circuit_t *, circ)
)
TRACEPOINT_EVENT_INSTANCE(tor_circuit, origin_circuit_t_class, timeout,
TP_ARGS(const origin_circuit_t *, circ)
)
TRACEPOINT_EVENT_INSTANCE(tor_circuit, origin_circuit_t_class, idle_timeout,
TP_ARGS(const origin_circuit_t *, circ)
)
#endif /* TOR_TRACE_PROBES_CIRCUIT_H */
/* Must be include after the probes declaration. */