Tor
0.4.7.0-alpha-dev
|
Header for feature/stats/bwhist.c. More...
Go to the source code of this file.
Functions | |
void | bwhist_init (void) |
void | bwhist_free_all (void) |
void | bwhist_note_bytes_read (uint64_t num_bytes, time_t when, bool ipv6) |
void | bwhist_note_bytes_written (uint64_t num_bytes, time_t when, bool ipv6) |
void | bwhist_note_dir_bytes_read (uint64_t num_bytes, time_t when) |
void | bwhist_note_dir_bytes_written (uint64_t num_bytes, time_t when) |
int | bwhist_bandwidth_assess (void) |
char * | bwhist_get_bandwidth_lines (void) |
void | bwhist_update_state (struct or_state_t *state) |
int | bwhist_load_state (struct or_state_t *state, char **err) |
Header for feature/stats/bwhist.c.
Definition in file bwhist.h.
int bwhist_bandwidth_assess | ( | void | ) |
Find the largest sums in the past NUM_SECS_BW_SUM_IS_VALID (roughly) seconds. Find one sum for reading and one for writing. They don't have to be at the same time.
Return the smaller of these sums, divided by NUM_SECS_ROLLING_MEASURE.
Definition at line 233 of file bwhist.c.
Referenced by check_descriptor_bandwidth_changed().
char* bwhist_get_bandwidth_lines | ( | void | ) |
void bwhist_init | ( | void | ) |
Set up structures for bandwidth history, clearing them if they already exist.
Definition at line 139 of file bwhist.c.
Referenced by tor_init().
int bwhist_load_state | ( | or_state_t * | state, |
char ** | err | ||
) |
void bwhist_note_bytes_read | ( | uint64_t | num_bytes, |
time_t | when, | ||
bool | ipv6 | ||
) |
Remember that we wrote num_bytes bytes in second when. (like bwhist_note_bytes_written() above)
Definition at line 183 of file bwhist.c.
Referenced by record_num_bytes_transferred_impl().
void bwhist_note_bytes_written | ( | uint64_t | num_bytes, |
time_t | when, | ||
bool | ipv6 | ||
) |
Remember that we read num_bytes bytes in second when.
Add num_bytes to the current running total for when.
when can go back to time, but it's safe to ignore calls earlier than the latest when you've heard of.
Definition at line 164 of file bwhist.c.
Referenced by record_num_bytes_transferred_impl().
void bwhist_note_dir_bytes_read | ( | uint64_t | num_bytes, |
time_t | when | ||
) |
Remember that we read num_bytes directory bytes in second when. (like bwhist_note_bytes_written() above)
Definition at line 204 of file bwhist.c.
Referenced by record_num_bytes_transferred_impl().
void bwhist_note_dir_bytes_written | ( | uint64_t | num_bytes, |
time_t | when | ||
) |
Remember that we wrote num_bytes directory bytes in second when. (like bwhist_note_bytes_written() above)
Definition at line 195 of file bwhist.c.
Referenced by record_num_bytes_transferred_impl().
void bwhist_update_state | ( | or_state_t * | state | ) |