Tor
0.4.6.0-alpha-dev
|
Header file for rephist.c. More...
Go to the source code of this file.
Macros | |
#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 } |
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_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_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) |
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) |
char * | rep_hist_get_hs_v2_stats_string (void) |
void | rep_hist_seen_new_rp_cell (bool is_v2) |
void | rep_hist_hsdir_stored_maybe_new_v2_onion (const crypto_pk_t *pubkey) |
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) |
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) |
Variables | |
uint64_t | rephist_total_alloc |
uint32_t | rephist_total_num |
#define REPHIST_CELL_PADDING_COUNTS_INTERVAL (24*60*60) |
enum padding_type_t |
Represents the type of a cell for padding accounting
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 1271 of file rephist.c.
Referenced by rep_hist_buffer_stats_add_circ().
void rep_hist_buffer_stats_add_circ | ( | circuit_t * | circ, |
time_t | end_of_interval | ||
) |
void rep_hist_buffer_stats_init | ( | time_t | now | ) |
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().
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.
void rep_hist_desc_stats_init | ( | time_t | now | ) |
Initialize descriptor stats.
Definition at line 1512 of file rephist.c.
Referenced by rep_hist_reset_desc_stats().
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 1535 of file rephist.c.
Referenced by rep_hist_reset_desc_stats().
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.
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 369 of file rephist.c.
Referenced by downrate_stability_callback().
void rep_hist_dump_stats | ( | time_t | now, |
int | severity | ||
) |
void rep_hist_exit_stats_init | ( | time_t | now | ) |
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().
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.
char* rep_hist_format_buffer_stats | ( | time_t | now | ) |
char* rep_hist_format_exit_stats | ( | time_t | now | ) |
void rep_hist_free_all | ( | void | ) |
int rep_hist_get_circuit_handshake_assigned | ( | uint16_t | type | ) |
Get the circuit handshake value that is assigned.
Definition at line 1686 of file rephist.c.
Referenced by getinfo_helper_rephist().
int rep_hist_get_circuit_handshake_requested | ( | uint16_t | type | ) |
char* rep_hist_get_padding_count_lines | ( | void | ) |
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 490 of file rephist.c.
Referenced by dirserv_thinks_router_is_unreliable().
long rep_hist_get_uptime | ( | 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_hs_stats_init | ( | time_t | now | ) |
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().
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.
void rep_hist_hsdir_stored_maybe_new_v2_onion | ( | const crypto_pk_t * | pubkey | ) |
void rep_hist_hsdir_stored_maybe_new_v3_onion | ( | const uint8_t * | blinded_key | ) |
void rep_hist_init | ( | void | ) |
Initialize the static data structures for tracking history.
Definition at line 220 of file rephist.c.
Referenced by tor_init().
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 776 of file rephist.c.
Referenced by options_act_dirauth_mtbf().
void rep_hist_log_circuit_handshake_stats | ( | time_t | now | ) |
void rep_hist_log_link_protocol_counts | ( | void | ) |
void rep_hist_make_router_pessimal | ( | const char * | id, |
time_t | when | ||
) |
void rep_hist_note_circuit_handshake_assigned | ( | uint16_t | type | ) |
void rep_hist_note_circuit_handshake_requested | ( | uint16_t | type | ) |
void rep_hist_note_desc_served | ( | const char * | desc | ) |
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 1218 of file rephist.c.
Referenced by record_num_bytes_transferred_impl().
void rep_hist_note_exit_stream_opened | ( | uint16_t | port | ) |
void rep_hist_note_negotiated_link_proto | ( | unsigned | link_proto, |
int | started_here | ||
) |
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 | ||
) |
We have just decided that this router is unreachable, meaning we are taking away its "Running" flag.
Definition at line 301 of file rephist.c.
Referenced by rep_hist_make_router_pessimal().
void rep_hist_padding_count_read | ( | padding_type_t | type | ) |
void rep_hist_padding_count_timers | ( | uint64_t | num_timers | ) |
void rep_hist_padding_count_write | ( | padding_type_t | type | ) |
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 613 of file rephist.c.
Referenced by save_stability_callback(), and tor_cleanup().
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 1348 of file rephist.c.
Referenced by rep_hist_buffer_stats_term().
void rep_hist_reset_exit_stats | ( | time_t | now | ) |
void rep_hist_reset_padding_counts | ( | void | ) |
void rep_hist_seen_new_rp_cell | ( | bool | is_v2 | ) |
void rep_history_clean | ( | time_t | before | ) |
Remove history info for routers/links that haven't changed since before.
Definition at line 580 of file rephist.c.
Referenced by clean_caches_callback(), and rep_hist_dump_stats().
|
extern |
Total number of bytes currently allocated in fields used by rephist.c.
Definition at line 92 of file rephist.c.
Referenced by dumpmemusage(), and free_or_history().
|
extern |
Number of or_history_t objects currently allocated.
Definition at line 94 of file rephist.c.
Referenced by dumpmemusage(), and free_or_history().