[or-cvs] r14350: Make dumpstats() log the size and fullness of openssl-intern (in tor/trunk: . src/common src/or)

nickm at seul.org nickm at seul.org
Thu Apr 10 15:12:24 UTC 2008


Author: nickm
Date: 2008-04-10 11:12:24 -0400 (Thu, 10 Apr 2008)
New Revision: 14350

Modified:
   tor/trunk/
   tor/trunk/ChangeLog
   tor/trunk/src/common/tortls.c
   tor/trunk/src/common/tortls.h
   tor/trunk/src/or/main.c
Log:
 r15161 at 31-33-107:  nickm | 2008-04-10 11:11:58 -0400
 Make dumpstats() log the size and fullness of openssl-internal buffers, so I can test my hypothesis that many of them are empty, and my alternative hypothesis that many of them are mostly empty, against the null hypothesis that we really need to be burning 32K per open OR connection on this.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r15161] on 49666b30-7950-49c5-bedf-9dc8f3168102

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2008-04-10 15:12:17 UTC (rev 14349)
+++ tor/trunk/ChangeLog	2008-04-10 15:12:24 UTC (rev 14350)
@@ -60,6 +60,7 @@
       descriptors we need to keep around when we're cleaning out old
       router descriptors.  This speeds up the computation significantly, and
       may reduce fragmentation.
+    - Make dumpstats() log the fullness and size of openssl-internal buffers.
 
   o Code simplifications and refactoring:
     - Refactor code using connection_ap_handshake_attach_circuit() to
@@ -68,6 +69,7 @@
     - Add a macro to implement the common pattern of iterating through
       two parallel lists in lockstep.
 
+
 Changes in version 0.2.0.23-rc - 2008-03-24
   o Major bugfixes:
     - When a tunneled directory request is made to a directory server

Modified: tor/trunk/src/common/tortls.c
===================================================================
--- tor/trunk/src/common/tortls.c	2008-04-10 15:12:17 UTC (rev 14349)
+++ tor/trunk/src/common/tortls.c	2008-04-10 15:12:24 UTC (rev 14350)
@@ -1346,3 +1346,14 @@
   return 1;
 }
 
+/** DOCDOC */
+void
+tor_tls_get_buffer_sizes(tor_tls_t *tls,
+                         int *rbuf_capacity, int *rbuf_bytes,
+                         int *wbuf_capacity, int *wbuf_bytes)
+{
+  *rbuf_capacity = tls->ssl->s3->rbuf.len;
+  *wbuf_capacity = tls->ssl->s3->wbuf.len;
+  *rbuf_bytes = tls->ssl->s3->rbuf.left;
+  *wbuf_bytes = tls->ssl->s3->wbuf.left;
+}

Modified: tor/trunk/src/common/tortls.h
===================================================================
--- tor/trunk/src/common/tortls.h	2008-04-10 15:12:17 UTC (rev 14349)
+++ tor/trunk/src/common/tortls.h	2008-04-10 15:12:24 UTC (rev 14350)
@@ -73,6 +73,10 @@
 void tor_tls_get_n_raw_bytes(tor_tls_t *tls,
                              size_t *n_read, size_t *n_written);
 
+void tor_tls_get_buffer_sizes(tor_tls_t *tls,
+                              int *rbuf_capacity, int *rbuf_bytes,
+                              int *wbuf_capacity, int *wbuf_bytes);
+
 int tor_tls_used_v1_handshake(tor_tls_t *tls);
 
 /* Log and abort if there are unhandled TLS errors in OpenSSL's error stack.

Modified: tor/trunk/src/or/main.c
===================================================================
--- tor/trunk/src/or/main.c	2008-04-10 15:12:17 UTC (rev 14349)
+++ tor/trunk/src/or/main.c	2008-04-10 15:12:24 UTC (rev 14350)
@@ -1611,6 +1611,7 @@
 {
   time_t now = time(NULL);
   time_t elapsed;
+  int rbuf_cap, wbuf_cap, rbuf_len, wbuf_len;
 
   log(severity, LD_GENERAL, "Dumping stats:");
 
@@ -1638,6 +1639,17 @@
           (int)buf_datalen(conn->outbuf),
           (int)buf_allocation(conn->outbuf),
           (int)(now - conn->timestamp_lastwritten));
+      if (conn->type == CONN_TYPE_OR) {
+        or_connection_t *or_conn = TO_OR_CONN(conn);
+        if (or_conn->tls) {
+          tor_tls_get_buffer_sizes(or_conn->tls, &rbuf_cap, &rbuf_len,
+                                   &wbuf_cap, &wbuf_len);
+          log(severity, LD_GENERAL,
+              "Conn %d: %d/%d bytes used on openssl read buffer; "
+              "%d/%d bytes used on write buffer.",
+              i, rbuf_len, rbuf_cap, wbuf_len, wbuf_cap);
+        }
+      }
     }
     circuit_dump_by_conn(conn, severity); /* dump info about all the circuits
                                            * using this conn */



More information about the tor-commits mailing list