Hi,

On 5 Dec 2018, at 16:15, marziyeh latifi <marziyeh.latifi95@gmail.com> wrote:

I want to count the number of cells that are sent from circuit queue to the output buffer in each relay. How can I do this?
Any opinion?

You already asked this question in tor-relays:
https://lists.torproject.org/pipermail/tor-relays/2018-December/016696.html

Continuing on from that reply:

CIRC_BW events are only sent for origin circuits:
https://github.com/torproject/tor/blob/7d8e0cc9abf2a74789e635d2fd4d0e18b8e0d1fe/src/feature/control/control.c#L6082
An origin circuit starts at the tor instance sending the event.

Why do you want to see the number of cells?

Do you want to count cells on a public relay?
Tor is an anonymity network, so we ask relay operators to protect
user privacy. If you are running a Tor relay on the public network,
please don't collect this information.

If you need to collect this information for research, ask the Tor
research safety board for help:
https://research.torproject.org/safetyboard.html

The research safety board suggests using traffic simulation, rather
than experimenting on real tor users. The chutney and shadow tools
are useful for Tor traffic simulation:
https://gitweb.torproject.org/chutney.git
https://shadow.github.io/

In a simulated Tor network, with TestingTorNetwork 1, you can
use the CELL_STATS event to count cells:
https://github.com/torproject/torspec/blob/master/control-spec.txt#L3041

If you can't use a simulation, use a tool that protects user privacy,
like PrivCount:
https://github.com/privcount/privcount

T