-
Notifications
You must be signed in to change notification settings - Fork 82
CounterFile
CounterFile — Click element; measures packet count and writes it to file
CounterFile(FILENAME, [keywords BATCH_PRECISE])
Batching: Batching natively supported
Ports: 1 input, 1 output
Processing: agnostic
Drivers: userlevel
Passes packets unchanged from its input to its output, maintaining statistics information about packet count.
Keyword arguments are:
-
FILENAME — Path to the file which stats will be written into. If the file does not exist, it will be created. Parent directory of the file must exist. The file format is:
struct stats { uint64_t _count; uint64_t _byte_count; };
Outside readers should mmap this file and access uint64_t fields of the structure. They do not need to use atomic type (atomic_uint64_t) operations to access variables, as they do not change them. Reading or writing a quadword (uint64_t) aligned on a 64-bit boundary is guaranteed to be atomic on x86 and x64 since the Pentium processor (1993). This may not be the case on other than x86 32-bit architectures.
Reading using read() syscall instead of mmap is NOT guaranteed to be atomic.
If click is compiled with HAVE_MULTITHREAD, fields are 16-byte aligned.
-
BATCH_PRECISE — If true, will count packets one by one and hence call the handlers when the count is exactly the limit. The default is to count the whole batch at once and call the handlers if the limit has been reached.
- count (read-only) — Returns the number of packets that have passed through since the last reset.
- byte_count (read-only) — Returns the number of bytes that have passed through since the last reset.
- reset_counts (write-only) — Resets the counts and rates to zero.
- reset (write-only) — Same as 'reset_counts'.
Generated by click-elem2man from ../elements/userlevel/counterfile.hh:10
on 2022/11/25.