summaryrefslogtreecommitdiff
path: root/src/or/main.c
diff options
context:
space:
mode:
authorDamian Johnson <atagar@torproject.org>2011-01-06 21:53:48 -0800
committerNick Mathewson <nickm@torproject.org>2011-01-07 12:15:14 -0500
commit6661e16e7ca677cc6063b5aaf25da512d7cda8ad (patch)
tree907f911566d075f7cfa6d93309f06ade64f8945c /src/or/main.c
parent3bc235d97975dfa17ca6732a930b28124b92eef5 (diff)
downloadtor-6661e16e7ca677cc6063b5aaf25da512d7cda8ad.tar.gz
tor-6661e16e7ca677cc6063b5aaf25da512d7cda8ad.zip
GETINFO options for querying traffic usage
This was originally a patch provided by pipe (http://www.mail-archive.com/or-talk@freehaven.net/msg13085.html) to provide a method for controllers to query the total amount of traffic tor has handled (this is a frequently requested piece of information by relay operators).
Diffstat (limited to 'src/or/main.c')
-rw-r--r--src/or/main.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/or/main.c b/src/or/main.c
index 4fcc7156e3..aa97609442 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -398,6 +398,20 @@ get_connection_array(void)
return connection_array;
}
+/** Provides the traffic read and written over the life of the process. */
+
+uint64_t
+get_bytes_read(void)
+{
+ return stats_n_bytes_read;
+}
+
+uint64_t
+get_bytes_written(void)
+{
+ return stats_n_bytes_written;
+}
+
/** Set the event mask on <b>conn</b> to <b>events</b>. (The event
* mask is a bitmask whose bits are READ_EVENT and WRITE_EVENT)
*/