aboutsummaryrefslogtreecommitdiff
path: root/src/or/rephist.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-10-31 19:17:07 +0000
committerNick Mathewson <nickm@torproject.org>2006-10-31 19:17:07 +0000
commit1bf1f9d2fca917099c7e26e8f46df36329cd5c65 (patch)
tree756676cc8fc30d175869b579fad56d05a1d5ce06 /src/or/rephist.c
parent058ae90539de12b2486bc4032b11bc1d79357f41 (diff)
downloadtor-1bf1f9d2fca917099c7e26e8f46df36329cd5c65.tar
tor-1bf1f9d2fca917099c7e26e8f46df36329cd5c65.tar.gz
r9449@Kushana: nickm | 2006-10-31 00:12:02 -0500
Dump breakdown of PK operations when we get a USR2 signal. This should help us figure out of we are doing some of them for stupid reasons. svn:r8881
Diffstat (limited to 'src/or/rephist.c')
-rw-r--r--src/or/rephist.c83
1 files changed, 83 insertions, 0 deletions
diff --git a/src/or/rephist.c b/src/or/rephist.c
index aedb0072d..68c99123e 100644
--- a/src/or/rephist.c
+++ b/src/or/rephist.c
@@ -934,6 +934,89 @@ rep_hist_circbuilding_dormant(time_t now)
return 1;
}
+static uint32_t n_signed_dir_objs = 0;
+static uint32_t n_signed_routerdescs = 0;
+static uint32_t n_verified_dir_objs = 0;
+static uint32_t n_verified_routerdescs = 0;
+static uint32_t n_onionskins_encrypted = 0;
+static uint32_t n_onionskins_decrypted = 0;
+static uint32_t n_tls_client_handshakes = 0;
+static uint32_t n_tls_server_handshakes = 0;
+static uint32_t n_rend_client_ops = 0;
+static uint32_t n_rend_mid_ops = 0;
+static uint32_t n_rend_server_ops = 0;
+
+void
+note_crypto_pk_op(pk_op_t operation)
+{
+ switch (operation)
+ {
+ case SIGN_DIR:
+ n_signed_dir_objs++;
+ break;
+ case SIGN_RTR:
+ n_signed_routerdescs++;
+ break;
+ case VERIFY_DIR:
+ n_verified_dir_objs++;
+ break;
+ case VERIFY_RTR:
+ n_verified_routerdescs++;
+ break;
+ case ENC_ONIONSKIN:
+ n_onionskins_encrypted++;
+ break;
+ case DEC_ONIONSKIN:
+ n_onionskins_decrypted++;
+ break;
+ case TLS_HANDSHAKE_C:
+ n_tls_client_handshakes++;
+ break;
+ case TLS_HANDSHAKE_S:
+ n_tls_client_handshakes++;
+ break;
+ case REND_CLIENT:
+ n_rend_client_ops++;
+ break;
+ case REND_MID:
+ n_rend_mid_ops++;
+ break;
+ case REND_SERVER:
+ n_rend_server_ops++;
+ break;
+ default:
+ log_warn(LD_BUG, "Unknown pk operation %d", operation);
+ }
+}
+
+void
+dump_pk_ops(int severity)
+{
+ log(severity, LD_GENERAL,
+ "PK operations: %lu directory objects signed, "
+ "%lu directory objects verified, "
+ "%lu routerdescs signed, "
+ "%lu routerdescs verified, "
+ "%lu onionskins encrypted, "
+ "%lu onionskins decrypted, "
+ "%lu client-side TLS handshakes, "
+ "%lu server-side TLS handshakes, "
+ "%lu rendezvous client operations, "
+ "%lu rendezvous middle operations, "
+ "%lu rendezvous server operations.",
+ (unsigned long) n_signed_dir_objs,
+ (unsigned long) n_verified_dir_objs,
+ (unsigned long) n_signed_routerdescs,
+ (unsigned long) n_verified_routerdescs,
+ (unsigned long) n_onionskins_encrypted,
+ (unsigned long) n_onionskins_decrypted,
+ (unsigned long) n_tls_client_handshakes,
+ (unsigned long) n_tls_server_handshakes,
+ (unsigned long) n_rend_client_ops,
+ (unsigned long) n_rend_mid_ops,
+ (unsigned long) n_rend_server_ops);
+}
+
/** Free all storage held by the OR/link history caches, by the
* bandwidth history arrays, or by the port history. */
void