[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] initial profiling by phobos says we spend a whole lot of time
- To: or-cvs@xxxxxxxxxxxxx
- Subject: [or-cvs] initial profiling by phobos says we spend a whole lot of time
- From: arma@xxxxxxxx (Roger Dingledine)
- Date: Sat, 25 Dec 2004 01:10:36 -0500 (EST)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Sat, 25 Dec 2004 01:10:57 -0500
- Reply-to: or-dev@xxxxxxxxxxxxx
- Sender: owner-or-cvs@xxxxxxxxxxxxx
Update of /home2/or/cvsroot/tor/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/tor/src/or
Modified Files:
command.c
Log Message:
initial profiling by phobos says we spend a whole lot of time
measuring how long each cell takes to process. make that optional.
Index: command.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/command.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -d -r1.78 -r1.79
--- command.c 1 Dec 2004 04:55:03 -0000 1.78
+++ command.c 25 Dec 2004 06:10:34 -0000 1.79
@@ -57,12 +57,15 @@
*time += time_passed;
}
+#define KEEP_TIMING_STATS 0
+
/** Process a <b>cell</b> that was just received on <b>conn</b>. Keep internal
* statistics about how many of each cell we've processed so far
* this second, and the total number of microseconds it took to
* process each type of cell.
*/
void command_process_cell(cell_t *cell, connection_t *conn) {
+#ifdef KEEP_TIMING_STATS
/* how many of each cell have we seen so far this second? needs better
* name. */
static int num_create=0, num_created=0, num_relay=0, num_destroy=0;
@@ -87,6 +90,7 @@
/* remember which second it is, for next time */
current_second = now;
}
+#endif
switch (cell->command) {
case CELL_PADDING:
@@ -95,27 +99,43 @@
break;
case CELL_CREATE:
++stats_n_create_cells_processed;
+#ifdef KEEP_TIMING_STATS
++num_create;
command_time_process_cell(cell, conn, &create_time,
command_process_create_cell);
+#else
+ command_process_create_cell(cell, conn);
+#endif
break;
case CELL_CREATED:
++stats_n_created_cells_processed;
+#ifdef KEEP_TIMING_STATS
++num_created;
command_time_process_cell(cell, conn, &created_time,
command_process_created_cell);
+#else
+ command_process_created_cell(cell, conn);
+#endif
break;
case CELL_RELAY:
++stats_n_relay_cells_processed;
+#ifdef KEEP_TIMING_STATS
++num_relay;
command_time_process_cell(cell, conn, &relay_time,
command_process_relay_cell);
+#else
+ command_process_relay_cell(cell, conn);
+#endif
break;
case CELL_DESTROY:
++stats_n_destroy_cells_processed;
+#ifdef KEEP_TIMING_STATS
++num_destroy;
command_time_process_cell(cell, conn, &destroy_time,
command_process_destroy_cell);
+#else
+ command_process_destroy_cell(cell, conn);
+#endif
break;
default:
log_fn(LOG_WARN,"Cell of unknown type (%d) received. Dropping.", cell->command);