aboutsummaryrefslogtreecommitdiff
path: root/src/or/control.h
diff options
context:
space:
mode:
authorKarsten Loesing <karsten.loesing@gmx.net>2013-05-31 15:51:25 +0200
committerKarsten Loesing <karsten.loesing@gmx.net>2013-05-31 16:12:28 +0200
commite39292f21dd363bd7601b63b4f43a95705c3332b (patch)
treea54ba8d1b8a066f556113968fdcde05b7f22df2b /src/or/control.h
parentb33b366a7f8bcab1c9b4859788e3b2c7d3dcf180 (diff)
downloadtor-e39292f21dd363bd7601b63b4f43a95705c3332b.tar.gz
tor-e39292f21dd363bd7601b63b4f43a95705c3332b.zip
Test functions used for TB_EMPTY and CELL_STATS events.
Diffstat (limited to 'src/or/control.h')
-rw-r--r--src/or/control.h26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/or/control.h b/src/or/control.h
index c79c432ef1..1773a87374 100644
--- a/src/or/control.h
+++ b/src/or/control.h
@@ -97,9 +97,33 @@ void control_event_bootstrap_problem(const char *warn, int reason);
void control_event_clients_seen(const char *controller_str);
#ifdef CONTROL_PRIVATE
-/* Used only by control.c and test.c */
+/* Used only by control.c and test*.c */
size_t write_escaped_data(const char *data, size_t len, char **out);
size_t read_escaped_data(const char *data, size_t len, char **out);
+
+/** Helper structure: temporarily stores cell statistics for a circuit. */
+typedef struct cell_stats_t {
+ /** Number of cells added in app-ward direction by command. */
+ uint64_t added_cells_appward[CELL_COMMAND_MAX_ + 1];
+ /** Number of cells added in exit-ward direction by command. */
+ uint64_t added_cells_exitward[CELL_COMMAND_MAX_ + 1];
+ /** Number of cells removed in app-ward direction by command. */
+ uint64_t removed_cells_appward[CELL_COMMAND_MAX_ + 1];
+ /** Number of cells removed in exit-ward direction by command. */
+ uint64_t removed_cells_exitward[CELL_COMMAND_MAX_ + 1];
+ /** Total waiting time of cells in app-ward direction by command. */
+ uint64_t total_time_appward[CELL_COMMAND_MAX_ + 1];
+ /** Total waiting time of cells in exit-ward direction by command. */
+ uint64_t total_time_exitward[CELL_COMMAND_MAX_ + 1];
+} cell_stats_t;
+void sum_up_cell_stats_by_command(circuit_t *circ,
+ cell_stats_t *cell_stats);
+void append_cell_stats_by_command(smartlist_t *event_parts,
+ const char *key,
+ uint64_t *include_if_non_zero,
+ uint64_t *number_to_include);
+void format_cell_stats(char **event_string, circuit_t *circ,
+ cell_stats_t *cell_stats);
#endif
#endif