diff options
author | Karsten Loesing <karsten.loesing@gmx.net> | 2009-07-05 19:53:25 +0200 |
---|---|---|
committer | Karsten Loesing <karsten.loesing@gmx.net> | 2009-07-05 19:53:25 +0200 |
commit | b493a2ccb97e00f4fe3acb5c59c941c2babaeebb (patch) | |
tree | eec79d7610ffc84657bfed515cfd948970377e39 /src/or/or.h | |
parent | 4d6af73db88e409764f43fc6cdaa432d667becf3 (diff) | |
download | tor-b493a2ccb97e00f4fe3acb5c59c941c2babaeebb.tar.gz tor-b493a2ccb97e00f4fe3acb5c59c941c2babaeebb.zip |
If configured, write cell statistics to disk periodically.
Diffstat (limited to 'src/or/or.h')
-rw-r--r-- | src/or/or.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/or/or.h b/src/or/or.h index 935ea523df..2954b125bd 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -23,6 +23,9 @@ #ifndef ENABLE_GEOIP_STATS #define ENABLE_GEOIP_STATS 1 #endif +#ifndef ENABLE_BUFFER_STATS +#define ENABLE_BUFFER_STATS 1 +#endif #endif #ifdef MS_WINDOWS @@ -833,6 +836,9 @@ typedef struct var_cell_t { typedef struct packed_cell_t { struct packed_cell_t *next; /**< Next cell queued on this circuit. */ char body[CELL_NETWORK_SIZE]; /**< Cell as packed for network. */ +#ifdef ENABLE_BUFFER_STATS + struct timeval packed_timeval; /**< When was this cell packed? */ +#endif } packed_cell_t; /** A queue of cells on a circuit, waiting to be added to the @@ -2072,6 +2078,17 @@ typedef struct or_circuit_t { /** True iff this circuit was made with a CREATE_FAST cell. */ unsigned int is_first_hop : 1; + +#ifdef ENABLE_BUFFER_STATS + /** Number of cells that were removed from circuit queue; reset every + * time when writing buffer stats to disk. */ + uint32_t processed_cells; + + /** Total time in milliseconds that cells spent in both app-ward and + * exit-ward queues of this circuit; reset every time when writing + * buffer stats to disk. */ + uint64_t total_cell_waiting_time; +#endif } or_circuit_t; /** Convert a circuit subtype to a circuit_t.*/ @@ -2478,6 +2495,9 @@ typedef struct { /** If true, the user wants us to collect statistics on port usage. */ int ExitPortStatistics; + /** If true, the user wants us to collect cell statistics. */ + int CellStatistics; + /** If true, do not believe anybody who tells us that a domain resolves * to an internal address, or that an internal address has a PTR mapping. * Helps avoid some cross-site attacks. */ @@ -4026,6 +4046,12 @@ void hs_usage_note_fetch_successful(const char *service_id, time_t now); void hs_usage_write_statistics_to_file(time_t now); void hs_usage_free_all(void); +#ifdef ENABLE_BUFFER_STATS +#define DUMP_BUFFER_STATS_INTERVAL (24*60*60) +void add_circ_to_buffer_stats(circuit_t *circ, time_t end_of_interval); +void dump_buffer_stats(void); +#endif + /********************************* rendclient.c ***************************/ void rend_client_introcirc_has_opened(origin_circuit_t *circ); |