r15161@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.


svn:r14350
This commit is contained in:
Nick Mathewson 2008-04-10 15:12:24 +00:00
parent c776da9537
commit b927ede48c
4 changed files with 29 additions and 0 deletions

View File

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

View File

@ -1346,3 +1346,14 @@ tor_tls_used_v1_handshake(tor_tls_t *tls)
return 1; 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;
}

View File

@ -73,6 +73,10 @@ size_t tor_tls_get_forced_write_size(tor_tls_t *tls);
void tor_tls_get_n_raw_bytes(tor_tls_t *tls, void tor_tls_get_n_raw_bytes(tor_tls_t *tls,
size_t *n_read, size_t *n_written); 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); int tor_tls_used_v1_handshake(tor_tls_t *tls);
/* Log and abort if there are unhandled TLS errors in OpenSSL's error stack. /* Log and abort if there are unhandled TLS errors in OpenSSL's error stack.

View File

@ -1611,6 +1611,7 @@ dumpstats(int severity)
{ {
time_t now = time(NULL); time_t now = time(NULL);
time_t elapsed; time_t elapsed;
int rbuf_cap, wbuf_cap, rbuf_len, wbuf_len;
log(severity, LD_GENERAL, "Dumping stats:"); log(severity, LD_GENERAL, "Dumping stats:");
@ -1638,6 +1639,17 @@ dumpstats(int severity)
(int)buf_datalen(conn->outbuf), (int)buf_datalen(conn->outbuf),
(int)buf_allocation(conn->outbuf), (int)buf_allocation(conn->outbuf),
(int)(now - conn->timestamp_lastwritten)); (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 circuit_dump_by_conn(conn, severity); /* dump info about all the circuits
* using this conn */ * using this conn */