From 6661e16e7ca677cc6063b5aaf25da512d7cda8ad Mon Sep 17 00:00:00 2001 From: Damian Johnson Date: Thu, 6 Jan 2011 21:53:48 -0800 Subject: 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). --- src/or/main.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/or/main.c') 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 conn to events. (The event * mask is a bitmask whose bits are READ_EVENT and WRITE_EVENT) */ -- cgit v1.2.3-54-g00ecf