Opened 9 years ago

Closed 9 years ago

Last modified 7 years ago

#2345 closed enhancement (implemented)

Total Traffic via GETINFO

Reported by: atagar Owned by:
Priority: Medium Milestone: Tor: 0.2.3.x-final
Component: Core Tor/Tor Version:
Severity: Keywords: tor-relay
Cc: nickm Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

A long while back pipe submitted a patch for fetching the total relayed bandwidth via the control port [1]. This is highly requested information and was part of proposal 173 (getinfo-option-expansion) as:
"relay/read-total" -- Total bytes relayed (download).
"relay/write-total" -- Total bytes relayed (upload).

If the patch looks fine then I'll tweak it to provide the values as the two options above. Cheers! -Damian

[1] http://www.mail-archive.com/or-talk@freehaven.net/msg13085.html

Child Tickets

Attachments (3)

0001-GETINFO-options-for-querying-traffic-usage.patch (3.5 KB) - added by atagar 9 years ago.
Slightly modified version of pipe's patch.
0002-Using-accessor-functions-rather-than-globals-for-tra.patch (2.5 KB) - added by atagar 9 years ago.
Using accessor functions rather than globals
0001-GETINFO-options-for-querying-traffic-usage.2.patch (3.4 KB) - added by atagar 9 years ago.
reapplied against master

Download all attachments as: .zip

Change History (15)

comment:1 Changed 9 years ago by nickm

Status: newneeds_review

comment:2 Changed 9 years ago by atagar

Summary: Total Bandwidth Usage via GETINFOTotal Traffic via GETINFO

Ack, inaccurate title - fixing.

comment:3 Changed 9 years ago by nickm

I'm not sure this belongs under "relay/*" -- it isn't just about how many bytes are relayed, but how many bytes have actually been read or written since the process started.

With respect to the code, it looks okay except that it should be using asprintf.

Changed 9 years ago by atagar

Slightly modified version of pipe's patch.

comment:4 Changed 9 years ago by atagar

I've attached a slightly modified version of pipe's patch that provides the information as responses for 'traffic/[read|written]' (and ran a basic sanity check). Cheers! -Damian

comment:5 Changed 9 years ago by nickm

Milestone: Tor: 0.2.3.x-final

comment:6 Changed 9 years ago by nickm

Looks good. One last request: can we have accessor functions rather than global variables here?

Changed 9 years ago by atagar

Using accessor functions rather than globals

comment:7 Changed 9 years ago by atagar

Good point - done.

comment:8 Changed 9 years ago by nickm

Looks like that still leaves the variables as global, since the first patch removed the "static" from their declarations and the patch didn't put it back in. I was about to merge then fix that up, but when I went to "git am" the first one onto tor master, it didn't apply. If you can throw together a fixed up patch that applies to master, i'll check it in: otherwise, I'll try to revise the patch to apply to master myself some time when I'm less sleepy.

Changed 9 years ago by atagar

reapplied against master

comment:9 Changed 9 years ago by atagar

Checked out master, reapplied, and retested. -Damian

comment:10 Changed 9 years ago by nickm

Resolution: implemented
Status: needs_reviewclosed

applied, thanks!

(Before applying, I re-wraped the commit message to not all be on the same line, and added a changes file.)

comment:11 Changed 7 years ago by nickm

Keywords: tor-relay added

comment:12 Changed 7 years ago by nickm

Component: Tor RelayTor
Note: See TracTickets for help on using tickets.