aboutsummaryrefslogtreecommitdiff
path: root/src/or/command.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2003-10-02 20:00:38 +0000
committerNick Mathewson <nickm@torproject.org>2003-10-02 20:00:38 +0000
commit985a3e14923e4d8a8b9e2914a66a800f89713da6 (patch)
tree38ed8d05e0291ac896f38d63a6f2e975686abc68 /src/or/command.c
parent6ac42f5ec059421fdfbeb3ef8f2b4448c14b2947 (diff)
downloadtor-985a3e14923e4d8a8b9e2914a66a800f89713da6.tar.gz
tor-985a3e14923e4d8a8b9e2914a66a800f89713da6.zip
Add new cell fullness and bandwidth stats.
svn:r533
Diffstat (limited to 'src/or/command.c')
-rw-r--r--src/or/command.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/or/command.c b/src/or/command.c
index 157da99f64..6195e5c135 100644
--- a/src/or/command.c
+++ b/src/or/command.c
@@ -6,6 +6,12 @@
extern or_options_t options; /* command-line and config-file options */
+unsigned long stats_n_padding_cells_processed = 0;
+unsigned long stats_n_create_cells_processed = 0;
+unsigned long stats_n_created_cells_processed = 0;
+unsigned long stats_n_relay_cells_processed = 0;
+unsigned long stats_n_destroy_cells_processed = 0;
+
static void command_process_create_cell(cell_t *cell, connection_t *conn);
static void command_process_created_cell(cell_t *cell, connection_t *conn);
static void command_process_relay_cell(cell_t *cell, connection_t *conn);
@@ -32,6 +38,8 @@ static void command_time_process_cell(cell_t *cell, connection_t *conn,
*time += time_passed;
}
+
+
void command_process_cell(cell_t *cell, connection_t *conn) {
static int num_create=0, num_created=0, num_relay=0, num_destroy=0;
static int create_time=0, created_time=0, relay_time=0, destroy_time=0;
@@ -58,21 +66,26 @@ void command_process_cell(cell_t *cell, connection_t *conn) {
switch(cell->command) {
case CELL_PADDING:
+ ++stats_n_padding_cells_processed;
/* do nothing */
break;
case CELL_CREATE:
+ ++stats_n_create_cells_processed;
command_time_process_cell(cell, conn, &num_create, &create_time,
command_process_create_cell);
break;
case CELL_CREATED:
+ ++stats_n_created_cells_processed;
command_time_process_cell(cell, conn, &num_created, &created_time,
command_process_created_cell);
break;
case CELL_RELAY:
+ ++stats_n_relay_cells_processed;
command_time_process_cell(cell, conn, &num_relay, &relay_time,
command_process_relay_cell);
break;
case CELL_DESTROY:
+ ++stats_n_destroy_cells_processed;
command_time_process_cell(cell, conn, &num_destroy, &destroy_time,
command_process_destroy_cell);
break;