diff options
author | Damian Johnson <atagar@torproject.org> | 2011-01-06 21:53:48 -0800 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-01-07 12:15:14 -0500 |
commit | 6661e16e7ca677cc6063b5aaf25da512d7cda8ad (patch) | |
tree | 907f911566d075f7cfa6d93309f06ade64f8945c /src/or/control.c | |
parent | 3bc235d97975dfa17ca6732a930b28124b92eef5 (diff) | |
download | tor-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/control.c')
-rw-r--r-- | src/or/control.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/or/control.c b/src/or/control.c index 58f4135c82..c895a70a80 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -1350,6 +1350,10 @@ getinfo_helper_misc(control_connection_t *conn, const char *question, return -1; } *answer = tor_dup_ip(addr); + } else if (!strcmp(question, "traffic/read")) { + tor_asprintf(answer, U64_FORMAT, U64_PRINTF_ARG(get_bytes_read())); + } else if (!strcmp(question, "traffic/written")) { + tor_asprintf(answer, U64_FORMAT, U64_PRINTF_ARG(get_bytes_written())); } else if (!strcmp(question, "process/pid")) { int myPid = -1; @@ -1958,6 +1962,8 @@ static const getinfo_item_t getinfo_items[] = { "Number of versioning authorities agreeing on the status of the " "current version"), ITEM("address", misc, "IP address of this Tor host, if we can guess it."), + ITEM("traffic/read", misc, "Bytes read since the process was started."), + ITEM("traffic/written", misc, "Bytes written since the process was started."), ITEM("process/pid", misc, "Process id belonging to the main tor process."), ITEM("process/uid", misc, "User id running the tor process."), ITEM("process/user", misc,"Username under which the tor process is running."), |