Skip to content
Snippets Groups Projects
Commit 5238b9d4 authored by Alessandro Rubini's avatar Alessandro Rubini Committed by Adam Wujek
Browse files

kernel/wr_pstats: support "zeroing" of counters.


By writing anything to a port file, you zero the counters for that
port. By writing to "info" or "description" you zero counters for
all ports.

Zeroing is performed by copying the current values to a new array,
and always subytracting that array to the current counter values.

No zeroing is performed for network statistics, that still reads
the "real" counters, featuring an overflow at 4G but no zeroing ever.

To simplify a little the code, I turned the one-dimensional array
with index arithmetics into a two-dimensional array, so the compiler
makes the math for us, transparently.

NOTE: the spinlock must be audited, we are not safe yet, not only
because of this patch.

Signed-off-by: default avatarAlessandro Rubini <rubini@gnudd.com>
parent 7067fecc
Branches
Tags
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment