|
Tor 0.4.9.8
|
Portable wrappers for finding out the current time, running timers, etc. More...
#include "lib/time/compat_time.h"#include "lib/err/torerr.h"#include "lib/log/log.h"#include "lib/log/util_bug.h"#include "lib/intmath/muldiv.h"#include "lib/intmath/bits.h"#include "lib/fs/winlib.h"#include "lib/wallclock/timeval.h"#include <errno.h>#include <stdlib.h>#include <string.h>Go to the source code of this file.
Macros | |
| #define | COMPAT_TIME_PRIVATE |
| #define | ONE_MILLION ((int64_t) (1000 * 1000)) |
| #define | ONE_BILLION ((int64_t) (1000 * 1000 * 1000)) |
| #define | initialized_at_coarse initialized_at |
Functions | |
| void | tor_sleep_msec (int msec) |
| void | monotime_init (void) |
| void | monotime_zero (monotime_t *out) |
| int64_t | monotime_diff_usec (const monotime_t *start, const monotime_t *end) |
| int64_t | monotime_diff_msec (const monotime_t *start, const monotime_t *end) |
| uint64_t | monotime_absolute_nsec (void) |
| uint64_t | monotime_absolute_usec (void) |
| uint64_t | monotime_absolute_msec (void) |
| uint64_t | monotime_absolute_sec (void) |
| uint32_t | monotime_coarse_get_stamp (void) |
| uint64_t | monotime_coarse_stamp_units_to_approx_msec (uint64_t units) |
| uint64_t | monotime_msec_to_approx_coarse_stamp_units (uint64_t msec) |
Variables | |
| static int | monotime_initialized = 0 |
| static monotime_t | initialized_at |
Portable wrappers for finding out the current time, running timers, etc.
Definition in file compat_time.c.
| #define COMPAT_TIME_PRIVATE |
Definition at line 12 of file compat_time.c.
| #define initialized_at_coarse initialized_at |
Definition at line 858 of file compat_time.c.
| #define ONE_BILLION ((int64_t) (1000 * 1000 * 1000)) |
Definition at line 78 of file compat_time.c.
| #define ONE_MILLION ((int64_t) (1000 * 1000)) |
Definition at line 77 of file compat_time.c.
| uint64_t monotime_absolute_msec | ( | void | ) |
Return the number of milliseconds since the timer system was initialized. The returned value may be equal to zero. Fractional units are truncated, not rounded.
Definition at line 811 of file compat_time.c.
| uint64_t monotime_absolute_nsec | ( | void | ) |
Return the number of nanoseconds since the timer system was initialized. The returned value may be equal to zero.
Definition at line 793 of file compat_time.c.
Referenced by monotime_absolute_msec(), monotime_absolute_sec(), and monotime_absolute_usec().
| uint64_t monotime_absolute_sec | ( | void | ) |
Return the number of seconds since the timer system was initialized. The returned value may be equal to zero. Fractional units are truncated, not rounded.
Definition at line 817 of file compat_time.c.
| uint64_t monotime_absolute_usec | ( | void | ) |
Return the number of microseconds since the timer system was initialized. The returned value may be equal to zero. Fractional units are truncated, not rounded.
Definition at line 805 of file compat_time.c.
Referenced by circpad_estimate_circ_rtt_on_received(), circpad_estimate_circ_rtt_on_send(), circpad_machine_remove_token(), circpad_machine_schedule_padding(), compute_drain_rate(), conflux_circuit_has_opened(), conflux_process_link(), congestion_control_note_cell_sent(), congestion_control_update_circuit_estimates(), connection_half_edge_add(), connection_half_edge_is_valid_data(), connection_half_edges_waiting(), flow_control_decide_xoff(), flow_control_decide_xon(), record_rtt_client(), and record_rtt_exit().
| uint32_t monotime_coarse_get_stamp | ( | void | ) |
Return the current time "stamp" as described by monotime_coarse_to_stamp.
Definition at line 865 of file compat_time.c.
Referenced by buf_add_chunk_with_capacity(), cell_queue_append_packed_copy(), channel_flush_from_first_active_circuit(), circuits_handle_oom(), connection_bucket_init(), connection_handle_read_impl(), connection_handle_write_impl(), connection_or_update_token_buckets_helper(), destroy_cell_queue_append(), edge_connection_new(), and entry_connection_new().
| uint64_t monotime_coarse_stamp_units_to_approx_msec | ( | uint64_t | units | ) |
Convert a difference, expressed in the units of monotime_coarse_to_stamp, into an approximate number of milliseconds.
The returned value may be equal to zero. Fractional units are truncated, not rounded.
Definition at line 891 of file compat_time.c.
Referenced by channel_flush_from_first_active_circuit(), and rate_per_sec_to_rate_per_step().
| int64_t monotime_diff_msec | ( | const monotime_t * | start, |
| const monotime_t * | end ) |
Return the number of milliseconds between start and end. The returned value may be equal to zero. Fractional units are truncated, not rounded.
Definition at line 785 of file compat_time.c.
| int64_t monotime_diff_usec | ( | const monotime_t * | start, |
| const monotime_t * | end ) |
Return the number of microseconds between start and end. The returned value may be equal to zero. Fractional units are truncated, not rounded.
Definition at line 777 of file compat_time.c.
Referenced by hs_pow_solve(), and timer_advance_to_cur_time().
| void monotime_init | ( | void | ) |
Initialize the monotonic timer subsystem. Must be called before any monotonic timer functions. This function is idempotent.
Definition at line 751 of file compat_time.c.
Referenced by monotime_absolute_nsec(), and timers_initialize().
| uint64_t monotime_msec_to_approx_coarse_stamp_units | ( | uint64_t | msec | ) |
Definition at line 896 of file compat_time.c.
| void monotime_zero | ( | monotime_t * | out | ) |
Set out to zero.
Definition at line 764 of file compat_time.c.
| void tor_sleep_msec | ( | int | msec | ) |
Delay for msec milliseconds.
Definition at line 58 of file compat_time.c.
Referenced by worker_thread_main().
|
static |
Definition at line 83 of file compat_time.c.
|
static |
True iff monotime_init has been called.
Definition at line 81 of file compat_time.c.
Referenced by monotime_absolute_nsec(), and monotime_init().