Skip to content

Commit

Permalink
core.link: Add dropped bytes counter
Browse files Browse the repository at this point in the history
  • Loading branch information
lukego committed Feb 8, 2017
1 parent aa9980a commit 8530942
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/core/link.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ struct link {
// http://en.wikipedia.org/wiki/Circular_buffer
struct packet *packets[LINK_RING_SIZE];
struct {
struct counter *dtime, *txbytes, *rxbytes, *txpackets, *rxpackets, *txdrop;
struct counter *dtime, *txbytes, *rxbytes, *txpackets, *rxpackets, *txdrop, *txdropbytes;
} stats;
// Two cursors:
// read: the next element to be read
Expand Down
3 changes: 2 additions & 1 deletion src/core/link.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ local size = C.LINK_RING_SIZE -- NB: Huge slow-down if this is not local
max = C.LINK_MAX_PACKETS

local provided_counters = {
"dtime", "rxpackets", "rxbytes", "txpackets", "txbytes", "txdrop"
"dtime", "rxpackets", "rxbytes", "txpackets", "txbytes", "txdrop", "txdropbytes"
}

function new (name)
Expand Down Expand Up @@ -60,6 +60,7 @@ function transmit (r, p)
-- assert(p)
if full(r) then
counter.add(r.stats.txdrop)
counter.add(r.stats.txdropbytes, p.length)
packet.free(p)
else
r.packets[r.write] = p
Expand Down

0 comments on commit 8530942

Please sign in to comment.