Tor 0.4.9.0-alpha-dev
Macros | Enumerations | Functions | Variables
rephist.h File Reference

Header file for rephist.c. More...

Go to the source code of this file.

Macros

#define MAX_ONION_STAT_TYPE   MAX_ONION_HANDSHAKE_TYPE
 
#define REPHIST_CELL_PADDING_COUNTS_INTERVAL   (24*60*60)
 

Enumerations

enum  padding_type_t {
  PADDING_TYPE_DROP , PADDING_TYPE_CELL , PADDING_TYPE_TOTAL , PADDING_TYPE_ENABLED_TOTAL ,
  PADDING_TYPE_ENABLED_CELL
}
 
enum  overload_type_t { OVERLOAD_GENERAL , OVERLOAD_READ , OVERLOAD_WRITE , OVERLOAD_FD_EXHAUSTED }
 

Functions

void rep_hist_init (void)
 
void rep_hist_dump_stats (time_t now, int severity)
 
void rep_hist_make_router_pessimal (const char *id, time_t when)
 
void rep_history_clean (time_t before)
 
void rep_hist_note_router_reachable (const char *id, const tor_addr_t *at_addr, const uint16_t at_port, time_t when)
 
void rep_hist_note_router_unreachable (const char *id, time_t when)
 
int rep_hist_record_mtbf_data (time_t now, int missing_means_down)
 
int rep_hist_load_mtbf_data (time_t now)
 
time_t rep_hist_downrate_old_runs (time_t now)
 
long rep_hist_get_uptime (const char *id, time_t when)
 
double rep_hist_get_stability (const char *id, time_t when)
 
double rep_hist_get_weighted_fractional_uptime (const char *id, time_t when)
 
long rep_hist_get_weighted_time_known (const char *id, time_t when)
 
int rep_hist_have_measured_enough_stability (void)
 
void rep_hist_exit_stats_init (time_t now)
 
void rep_hist_reset_exit_stats (time_t now)
 
void rep_hist_exit_stats_term (void)
 
char * rep_hist_format_exit_stats (time_t now)
 
time_t rep_hist_exit_stats_write (time_t now)
 
void rep_hist_note_exit_bytes (uint16_t port, size_t num_written, size_t num_read)
 
void rep_hist_note_exit_stream_opened (uint16_t port)
 
void rep_hist_note_conn_opened (bool initiated, unsigned int type, int af)
 
void rep_hist_note_conn_closed (bool initiated, unsigned int type, int af)
 
void rep_hist_note_conn_rejected (unsigned int type, int af)
 
uint64_t rep_hist_get_conn_created (bool initiated, unsigned int type, int af)
 
uint64_t rep_hist_get_conn_opened (bool initiated, unsigned int type, int af)
 
uint64_t rep_hist_get_conn_rejected (unsigned int type, int af)
 
void rep_hist_note_exit_stream (unsigned int cmd)
 
uint64_t rep_hist_get_exit_stream_seen (unsigned int cmd)
 
void rep_hist_buffer_stats_init (time_t now)
 
void rep_hist_buffer_stats_add_circ (circuit_t *circ, time_t end_of_interval)
 
time_t rep_hist_buffer_stats_write (time_t now)
 
void rep_hist_buffer_stats_term (void)
 
void rep_hist_add_buffer_stats (double mean_num_cells_in_queue, double mean_time_cells_in_queue, uint32_t processed_cells)
 
char * rep_hist_format_buffer_stats (time_t now)
 
void rep_hist_reset_buffer_stats (time_t now)
 
void rep_hist_desc_stats_init (time_t now)
 
void rep_hist_note_desc_served (const char *desc)
 
void rep_hist_desc_stats_term (void)
 
time_t rep_hist_desc_stats_write (time_t now)
 
void rep_hist_note_circuit_handshake_requested (uint16_t type)
 
void rep_hist_note_circuit_handshake_assigned (uint16_t type)
 
void rep_hist_note_circuit_handshake_dropped (uint16_t type)
 
void rep_hist_log_circuit_handshake_stats (time_t now)
 
int rep_hist_get_circuit_handshake_requested (uint16_t type)
 
int rep_hist_get_circuit_handshake_assigned (uint16_t type)
 
uint64_t rep_hist_get_circuit_n_handshake_assigned (uint16_t type)
 
uint64_t rep_hist_get_circuit_n_handshake_dropped (uint16_t type)
 
void rep_hist_hs_stats_init (time_t now)
 
void rep_hist_hs_stats_term (void)
 
time_t rep_hist_hs_stats_write (time_t now, bool is_v3)
 
void rep_hist_seen_new_rp_cell (bool is_v2)
 
char * rep_hist_get_hs_v3_stats_string (void)
 
void rep_hist_hsdir_stored_maybe_new_v3_onion (const uint8_t *blinded_key)
 
void rep_hist_free_all (void)
 
void rep_hist_note_negotiated_link_proto (unsigned link_proto, int started_here)
 
void rep_hist_log_link_protocol_counts (void)
 
uint64_t rep_hist_get_n_dns_error (int type, uint8_t error)
 
uint64_t rep_hist_get_n_dns_request (int type)
 
void rep_hist_note_dns_request (int type)
 
void rep_hist_note_dns_error (int type, uint8_t error)
 
void rep_hist_consensus_has_changed (const networkstatus_t *ns)
 
void rep_hist_padding_count_read (padding_type_t type)
 
void rep_hist_padding_count_write (padding_type_t type)
 
char * rep_hist_get_padding_count_lines (void)
 
void rep_hist_reset_padding_counts (void)
 
void rep_hist_prep_published_padding_counts (time_t now)
 
void rep_hist_padding_count_timers (uint64_t num_timers)
 
void rep_hist_note_overload (overload_type_t overload)
 
char * rep_hist_get_overload_general_line (void)
 
char * rep_hist_get_overload_stats_lines (void)
 
void rep_hist_note_tcp_exhaustion (void)
 
uint64_t rep_hist_get_n_tcp_exhaustion (void)
 
uint64_t rep_hist_get_n_read_limit_reached (void)
 
uint64_t rep_hist_get_n_write_limit_reached (void)
 
uint64_t rep_hist_get_drop_cell_received_count (void)
 

Variables

uint64_t rephist_total_alloc
 
uint32_t rephist_total_num
 

Detailed Description

Header file for rephist.c.

Definition in file rephist.h.

Macro Definition Documentation

◆ MAX_ONION_STAT_TYPE

#define MAX_ONION_STAT_TYPE   MAX_ONION_HANDSHAKE_TYPE

We combine ntor and ntorv3 stats, so we have 3 stat types: tap, fast, and ntor. The max type is ntor_v3 (3)

Definition at line 106 of file rephist.h.

◆ REPHIST_CELL_PADDING_COUNTS_INTERVAL

#define REPHIST_CELL_PADDING_COUNTS_INTERVAL   (24*60*60)

The amount of time over which the padding cell counts were counted

Definition at line 162 of file rephist.h.

Enumeration Type Documentation

◆ overload_type_t

Represents the various types of overload we keep track of and expose in our extra-info descriptor.

Definition at line 174 of file rephist.h.

◆ padding_type_t

Represents the type of a cell for padding accounting

Enumerator
PADDING_TYPE_DROP 

A RELAY_DROP cell

PADDING_TYPE_CELL 

A CELL_PADDING cell

PADDING_TYPE_TOTAL 

Total counts of padding and non-padding together

PADDING_TYPE_ENABLED_TOTAL 

Total cell counts for all padding-enabled channels

PADDING_TYPE_ENABLED_CELL 

CELL_PADDING counts for all padding-enabled channels

Definition at line 148 of file rephist.h.

Function Documentation

◆ rep_hist_add_buffer_stats()

void rep_hist_add_buffer_stats ( double  mean_num_cells_in_queue,
double  mean_time_cells_in_queue,
uint32_t  processed_cells 
)

Remember cell statistics mean_num_cells_in_queue, mean_time_cells_in_queue, and processed_cells of a circuit.

Definition at line 1853 of file rephist.c.

Referenced by rep_hist_buffer_stats_add_circ().

◆ rep_hist_buffer_stats_add_circ()

void rep_hist_buffer_stats_add_circ ( circuit_t circ,
time_t  end_of_interval 
)

Remember cell statistics for circuit circ at time end_of_interval and reset cell counters in case the circuit remains open in the next measurement interval.

Definition at line 1872 of file rephist.c.

◆ rep_hist_buffer_stats_init()

void rep_hist_buffer_stats_init ( time_t  now)

Initialize buffer stats.

Definition at line 1830 of file rephist.c.

◆ rep_hist_buffer_stats_term()

void rep_hist_buffer_stats_term ( void  )

Stop collecting cell stats in a way that we can re-start doing so in rep_hist_buffer_stats_init().

Definition at line 1922 of file rephist.c.

◆ rep_hist_buffer_stats_write()

time_t rep_hist_buffer_stats_write ( time_t  now)

If 24 hours have passed since the beginning of the current buffer stats period, write buffer stats to $DATADIR/stats/buffer-stats (possibly overwriting an existing file) and reset counters. Return when we would next want to write buffer stats or 0 if we never want to write.

Definition at line 2047 of file rephist.c.

◆ rep_hist_consensus_has_changed()

void rep_hist_consensus_has_changed ( const networkstatus_t ns)

Called just before the consensus will be replaced. Update the consensus parameters in case they changed.

Definition at line 3014 of file rephist.c.

◆ rep_hist_desc_stats_init()

void rep_hist_desc_stats_init ( time_t  now)

Initialize descriptor stats.

Definition at line 2094 of file rephist.c.

Referenced by rep_hist_reset_desc_stats().

◆ rep_hist_desc_stats_term()

void rep_hist_desc_stats_term ( void  )

Stop collecting served descs stats, so that rep_hist_desc_stats_init() is safe to be called again.

Definition at line 2117 of file rephist.c.

Referenced by rep_hist_reset_desc_stats().

◆ rep_hist_desc_stats_write()

time_t rep_hist_desc_stats_write ( time_t  now)

If WRITE_STATS_INTERVAL seconds have passed since the beginning of the current served desc stats interval, write the stats to $DATADIR/stats/served-desc-stats (possibly appending to an existing file) and reset the state for the next interval. Return when we would next want to write served desc stats or 0 if we won't want to write.

Definition at line 2184 of file rephist.c.

◆ rep_hist_downrate_old_runs()

time_t rep_hist_downrate_old_runs ( time_t  now)

Helper: Discount all old MTBF data, if it is time to do so. Return the time at which we should next discount MTBF data.

Definition at line 774 of file rephist.c.

Referenced by downrate_stability_callback().

◆ rep_hist_dump_stats()

void rep_hist_dump_stats ( time_t  now,
int  severity 
)

Log all the reliability data we have remembered, with the chosen severity.

Definition at line 946 of file rephist.c.

◆ rep_hist_exit_stats_init()

void rep_hist_exit_stats_init ( time_t  now)

Initialize exit port stats.

Definition at line 1396 of file rephist.c.

◆ rep_hist_exit_stats_term()

void rep_hist_exit_stats_term ( void  )

Stop collecting exit port stats in a way that we can re-start doing so in rep_hist_exit_stats_init().

Definition at line 1417 of file rephist.c.

◆ rep_hist_exit_stats_write()

time_t rep_hist_exit_stats_write ( time_t  now)

If 24 hours have passed since the beginning of the current exit port stats period, write exit stats to $DATADIR/stats/exit-stats (possibly overwriting an existing file) and reset counters. Return when we would next want to write exit stats or 0 if we never want to write.

Definition at line 1593 of file rephist.c.

◆ rep_hist_format_buffer_stats()

char * rep_hist_format_buffer_stats ( time_t  now)

Return a newly allocated string containing the buffer statistics until now, or NULL if we're not collecting buffer stats. Caller must ensure start_of_buffer_stats_interval is in the past.

Definition at line 1944 of file rephist.c.

◆ rep_hist_format_exit_stats()

char * rep_hist_format_exit_stats ( time_t  now)

Return a newly allocated string containing the exit port statistics until now, or NULL if we're not collecting exit stats. Caller must ensure start_of_exit_stats_interval is in the past.

Definition at line 1438 of file rephist.c.

◆ rep_hist_free_all()

void rep_hist_free_all ( void  )

Free all storage held by the OR/link history caches, by the bandwidth history arrays, by the port history, or by statistics .

Definition at line 2986 of file rephist.c.

◆ rep_hist_get_circuit_handshake_assigned()

int rep_hist_get_circuit_handshake_assigned ( uint16_t  type)

Get the circuit handshake value that is assigned.

Definition at line 2416 of file rephist.c.

Referenced by getinfo_helper_rephist().

◆ rep_hist_get_circuit_handshake_requested()

int rep_hist_get_circuit_handshake_requested ( uint16_t  type)

Get the circuit handshake value that is requested.

Definition at line 2409 of file rephist.c.

◆ rep_hist_get_circuit_n_handshake_assigned()

uint64_t rep_hist_get_circuit_n_handshake_assigned ( uint16_t  type)

Get the total number of circuit handshake value that is assigned.

Definition at line 2423 of file rephist.c.

◆ rep_hist_get_circuit_n_handshake_dropped()

uint64_t rep_hist_get_circuit_n_handshake_dropped ( uint16_t  type)

Get the total number of circuit handshake value that is dropped.

Definition at line 2430 of file rephist.c.

◆ rep_hist_get_conn_created()

uint64_t rep_hist_get_conn_created ( bool  from_listener,
unsigned int  type,
int  af 
)

Return number of created connections of the given type.

Definition at line 1777 of file rephist.c.

◆ rep_hist_get_conn_opened()

uint64_t rep_hist_get_conn_opened ( bool  from_listener,
unsigned int  type,
int  af 
)

Return number of opened connections of the given type.

Definition at line 1793 of file rephist.c.

◆ rep_hist_get_conn_rejected()

uint64_t rep_hist_get_conn_rejected ( unsigned int  type,
int  af 
)

Return number of opened connections of the given type.

Definition at line 1809 of file rephist.c.

◆ rep_hist_get_drop_cell_received_count()

uint64_t rep_hist_get_drop_cell_received_count ( void  )

Relay Only: return the total number of DROP cell received.

Definition at line 3032 of file rephist.c.

Referenced by fill_relay_drop_cell().

◆ rep_hist_get_exit_stream_seen()

uint64_t rep_hist_get_exit_stream_seen ( unsigned int  cmd)

Return number of stream seen for the given command.

Definition at line 1676 of file rephist.c.

Referenced by fill_single_stream_value().

◆ rep_hist_get_n_dns_error()

uint64_t rep_hist_get_n_dns_error ( int  type,
uint8_t  error 
)

Return the DNS error count for the given libevent DNS type and error code. The possible types are: DNS_IPv4_A, DNS_PTR, DNS_IPv6_AAAA.

Definition at line 317 of file rephist.c.

◆ rep_hist_get_n_dns_request()

uint64_t rep_hist_get_n_dns_request ( int  type)

Return the total number of DNS request seen for the given libevent DNS record type. Possible types are: DNS_IPv4_A, DNS_PTR, DNS_IPv6_AAAA.

Definition at line 358 of file rephist.c.

◆ rep_hist_get_n_read_limit_reached()

uint64_t rep_hist_get_n_read_limit_reached ( void  )

Return the stats_n_read_limit_reached counter.

Definition at line 461 of file rephist.c.

Referenced by fill_global_bw_limit_values().

◆ rep_hist_get_n_tcp_exhaustion()

uint64_t rep_hist_get_n_tcp_exhaustion ( void  )

Return the total number of TCP exhaustion times we've reached.

Definition at line 586 of file rephist.c.

Referenced by fill_tcp_exhaustion_values().

◆ rep_hist_get_n_write_limit_reached()

uint64_t rep_hist_get_n_write_limit_reached ( void  )

Return the stats_n_write_limit_reached counter.

Definition at line 468 of file rephist.c.

Referenced by fill_global_bw_limit_values().

◆ rep_hist_get_overload_general_line()

char * rep_hist_get_overload_general_line ( void  )

Returns an allocated string for server descriptor for publising information on whether we are overloaded or not.

Definition at line 476 of file rephist.c.

◆ rep_hist_get_overload_stats_lines()

char * rep_hist_get_overload_stats_lines ( void  )

Returns an allocated string for extra-info documents for publishing overload statistics.

Definition at line 494 of file rephist.c.

◆ rep_hist_get_padding_count_lines()

char * rep_hist_get_padding_count_lines ( void  )

Returns an allocated string for extra-info documents for publishing padding statistics from the last 24 hour interval.

Definition at line 2916 of file rephist.c.

◆ rep_hist_get_stability()

double rep_hist_get_stability ( const char *  id,
time_t  when 
)

Return an estimated MTBF for the router whose identity digest is id. Return 0 if the router is unknown.

Definition at line 895 of file rephist.c.

◆ rep_hist_get_uptime()

long rep_hist_get_uptime ( const char *  id,
time_t  when 
)

Return how long the router whose identity digest is id has been reachable. Return 0 if the router is unknown or currently deemed unreachable.

Definition at line 882 of file rephist.c.

◆ rep_hist_get_weighted_fractional_uptime()

double rep_hist_get_weighted_fractional_uptime ( const char *  id,
time_t  when 
)

Return an estimated percent-of-time-online for the router whose identity digest is id. Return 0 if the router is unknown.

Definition at line 907 of file rephist.c.

◆ rep_hist_get_weighted_time_known()

long rep_hist_get_weighted_time_known ( const char *  id,
time_t  when 
)

Return a number representing how long we've known about the router whose digest is id. Return 0 if the router is unknown.

Be careful: this measure increases monotonically as we know the router for longer and longer, but it doesn't increase linearly.

Definition at line 923 of file rephist.c.

◆ rep_hist_have_measured_enough_stability()

int rep_hist_have_measured_enough_stability ( void  )

Return true if we've been measuring MTBFs for long enough to pronounce on Stability.

Definition at line 935 of file rephist.c.

◆ rep_hist_hs_stats_init()

void rep_hist_hs_stats_init ( time_t  now)

Generic HS stats code Initialize v2 and v3 hidden service statistics.

Definition at line 2636 of file rephist.c.

◆ rep_hist_hs_stats_term()

void rep_hist_hs_stats_term ( void  )

Stop collecting hidden service stats in a way that we can re-start doing so in rep_hist_buffer_stats_init().

Definition at line 2656 of file rephist.c.

◆ rep_hist_hs_stats_write()

time_t rep_hist_hs_stats_write ( time_t  now,
bool  is_v3 
)

If 24 hours have passed since the beginning of the current HS stats period, write buffer stats to $DATADIR/stats/hidserv-v3-stats (possibly overwriting an existing file) and reset counters. Return when we would next want to write buffer stats or 0 if we never want to write. Function works for both v2 and v3 stats depending on is_v3.

Definition at line 2743 of file rephist.c.

◆ rep_hist_hsdir_stored_maybe_new_v3_onion()

void rep_hist_hsdir_stored_maybe_new_v3_onion ( const uint8_t *  blinded_key)

We just received a new descriptor with blinded_key. See if we've seen this blinded key before, and if not add it to the stats.

Definition at line 2595 of file rephist.c.

◆ rep_hist_init()

void rep_hist_init ( void  )

Initialize the static data structures for tracking history.

Definition at line 625 of file rephist.c.

Referenced by tor_init().

◆ rep_hist_load_mtbf_data()

int rep_hist_load_mtbf_data ( time_t  now)

Load MTBF data from disk. Returns 0 on success or recoverable error, -1 on failure.

Definition at line 1181 of file rephist.c.

Referenced by options_act_dirauth_mtbf().

◆ rep_hist_log_circuit_handshake_stats()

void rep_hist_log_circuit_handshake_stats ( time_t  now)

Log our onionskin statistics since the last time we were called.

Definition at line 2437 of file rephist.c.

◆ rep_hist_log_link_protocol_counts()

void rep_hist_log_link_protocol_counts ( void  )

Log a heartbeat message explaining how many connections of each link protocol version we have used.

Definition at line 2962 of file rephist.c.

◆ rep_hist_make_router_pessimal()

void rep_hist_make_router_pessimal ( const char *  id,
time_t  when 
)

Mark a router with ID id as non-Running, and retroactively declare that it has never been running: give it no stability and no WFU.

Definition at line 760 of file rephist.c.

◆ rep_hist_note_circuit_handshake_assigned()

void rep_hist_note_circuit_handshake_assigned ( uint16_t  type)

We've sent an onionskin (using the type handshake) to a cpuworker.

Definition at line 2384 of file rephist.c.

◆ rep_hist_note_circuit_handshake_dropped()

void rep_hist_note_circuit_handshake_dropped ( uint16_t  type)

We've just drop an onionskin (using the type handshake) due to being overloaded.

Definition at line 2393 of file rephist.c.

◆ rep_hist_note_circuit_handshake_requested()

void rep_hist_note_circuit_handshake_requested ( uint16_t  type)

A new onionskin (using the type handshake) has arrived.

Definition at line 2365 of file rephist.c.

◆ rep_hist_note_conn_closed()

void rep_hist_note_conn_closed ( bool  from_listener,
unsigned int  type,
int  af 
)

Note that a connection has closed of the given type.

Definition at line 1733 of file rephist.c.

◆ rep_hist_note_conn_opened()

void rep_hist_note_conn_opened ( bool  from_listener,
unsigned int  type,
int  af 
)

Note that a connection has opened of the given type.

Definition at line 1710 of file rephist.c.

◆ rep_hist_note_conn_rejected()

void rep_hist_note_conn_rejected ( unsigned int  type,
int  af 
)

Note that a connection has rejected of the given type.

Definition at line 1758 of file rephist.c.

◆ rep_hist_note_desc_served()

void rep_hist_note_desc_served ( const char *  desc)

Called to note that we've served a given descriptor (by digest). Increments the count of descriptors served, and the number of times we've served this descriptor.

Definition at line 2215 of file rephist.c.

◆ rep_hist_note_dns_error()

void rep_hist_note_dns_error ( int  type,
uint8_t  error 
)

Note a DNS error for the given given libevent DNS record type and error code. Possible types are: DNS_IPv4_A, DNS_PTR, DNS_IPv6_AAAA.

NOTE: Libevent is not returning the type in case of an error and so if error is anything but DNS_ERR_NONE, the type is not usable and set to 0.

See: https://gitlab.torproject.org/tpo/core/tor/-/issues/40490

Definition at line 375 of file rephist.c.

◆ rep_hist_note_dns_request()

void rep_hist_note_dns_request ( int  type)

Note a DNS request for the given given libevent DNS record type.

Definition at line 434 of file rephist.c.

◆ rep_hist_note_exit_bytes()

void rep_hist_note_exit_bytes ( uint16_t  port,
size_t  num_written,
size_t  num_read 
)

Note that we wrote num_written bytes and read num_read bytes to/from an exit connection to port.

Definition at line 1623 of file rephist.c.

Referenced by record_num_bytes_transferred_impl().

◆ rep_hist_note_exit_stream()

void rep_hist_note_exit_stream ( unsigned int  cmd)

Note a stream as seen for the given relay command.

Definition at line 1656 of file rephist.c.

Referenced by connection_exit_begin_resolve().

◆ rep_hist_note_exit_stream_opened()

void rep_hist_note_exit_stream_opened ( uint16_t  port)

Note that we opened an exit stream to port.

Definition at line 1637 of file rephist.c.

◆ rep_hist_note_negotiated_link_proto()

void rep_hist_note_negotiated_link_proto ( unsigned  link_proto,
int  started_here 
)

Note that we negotiated link protocol version link_proto, on a connection that started here iff started_here is true.

Definition at line 2786 of file rephist.c.

◆ rep_hist_note_overload()

void rep_hist_note_overload ( overload_type_t  overload)

Note down an overload event of type overload.

Definition at line 541 of file rephist.c.

Referenced by rep_hist_note_tcp_exhaustion(), and socket_failed_from_fd_exhaustion().

◆ rep_hist_note_router_reachable()

void rep_hist_note_router_reachable ( const char *  id,
const tor_addr_t at_addr,
const uint16_t  at_port,
time_t  when 
)

We have just decided that this router with identity digest id is reachable, meaning we will give it a "Running" flag for the next while.

Definition at line 633 of file rephist.c.

◆ rep_hist_note_router_unreachable()

void rep_hist_note_router_unreachable ( const char *  id,
time_t  when 
)

We have just decided that this router is unreachable, meaning we are taking away its "Running" flag.

Definition at line 706 of file rephist.c.

Referenced by rep_hist_make_router_pessimal().

◆ rep_hist_note_tcp_exhaustion()

void rep_hist_note_tcp_exhaustion ( void  )

Note down that we've reached a TCP port exhaustion. This triggers an overload general event.

Definition at line 578 of file rephist.c.

Referenced by socket_failed_from_tcp_port_exhaustion().

◆ rep_hist_padding_count_read()

void rep_hist_padding_count_read ( padding_type_t  type)

Count a cell that we've received for padding overhead statistics.

RELAY_COMMAND_DROP and CELL_PADDING are accounted separately. Both should be counted for PADDING_TYPE_TOTAL.

Definition at line 2846 of file rephist.c.

◆ rep_hist_padding_count_timers()

void rep_hist_padding_count_timers ( uint64_t  num_timers)

Update the maximum count of total pending channel padding timers in this period.

Definition at line 2802 of file rephist.c.

◆ rep_hist_padding_count_write()

void rep_hist_padding_count_write ( padding_type_t  type)

Count a cell that we sent for padding overhead statistics.

RELAY_COMMAND_DROP and CELL_PADDING are accounted separately. Both should be counted for PADDING_TYPE_TOTAL.

Definition at line 2816 of file rephist.c.

◆ rep_hist_prep_published_padding_counts()

void rep_hist_prep_published_padding_counts ( time_t  now)

Definition at line 2885 of file rephist.c.

◆ rep_hist_record_mtbf_data()

int rep_hist_record_mtbf_data ( time_t  now,
int  missing_means_down 
)

Write MTBF data to disk. Return 0 on success, negative on failure.

If missing_means_down, then if we're about to write an entry that is still considered up but isn't in our routerlist, consider it to be down.

Definition at line 1018 of file rephist.c.

Referenced by save_stability_callback(), and tor_cleanup().

◆ rep_hist_reset_buffer_stats()

void rep_hist_reset_buffer_stats ( time_t  now)

Clear history of circuit statistics and set the measurement interval start to now.

Definition at line 1930 of file rephist.c.

Referenced by rep_hist_buffer_stats_term().

◆ rep_hist_reset_exit_stats()

void rep_hist_reset_exit_stats ( time_t  now)

Reset counters for exit port statistics.

Definition at line 1406 of file rephist.c.

◆ rep_hist_reset_padding_counts()

void rep_hist_reset_padding_counts ( void  )

Reset our current padding statistics. Called once every 24 hours.

Definition at line 2871 of file rephist.c.

◆ rep_hist_seen_new_rp_cell()

void rep_hist_seen_new_rp_cell ( bool  is_v2)

We saw a new HS relay cell: count it! If is_v2 is set then it's a v2 RP cell, otherwise it's a v3.

Definition at line 2621 of file rephist.c.

◆ rep_history_clean()

void rep_history_clean ( time_t  before)

Remove history info for routers/links that haven't changed since before.

Definition at line 985 of file rephist.c.

Referenced by clean_caches_callback(), and rep_hist_dump_stats().

Variable Documentation

◆ rephist_total_alloc

uint64_t rephist_total_alloc
extern

Total number of bytes currently allocated in fields used by rephist.c.

Definition at line 95 of file rephist.c.

Referenced by dumpmemusage(), and free_or_history().

◆ rephist_total_num

uint32_t rephist_total_num
extern

Number of or_history_t objects currently allocated.

Definition at line 97 of file rephist.c.

Referenced by dumpmemusage(), and free_or_history().