Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resetting device stats on X552 #77

Open
SharleneFletcher opened this issue Jul 31, 2018 · 2 comments
Open

resetting device stats on X552 #77

SharleneFletcher opened this issue Jul 31, 2018 · 2 comments

Comments

@SharleneFletcher
Copy link

Hi,

running the following script:

local device	= require "device"
local lm	= require "libmoon"
local log	= require "log"
local memory	= require "memory"
local stats	= require "stats"
local timer	= require "timer"

local DST_MAC	= "01:23:45:67:89:AB"
local SRC_IP	= "10.0.0.10"
local DST_IP	= "10.1.0.10"
local SRC_PORT	= 1234
local DST_PORT	= 319

function configure(parser)
	parser:description("Generates UDP traffic.")
	parser:argument("txDev", "Device to transmit from."):convert(tonumber)
	parser:argument("rxDev", "Device to receive from."):convert(tonumber)
end

function master(args)
	txDev = device.config{port = args.txDev, rxQueues = 3, txQueues = 3}
	rxDev = device.config{port = args.rxDev, rxQueues = 3, txQueues = 3}
	device.waitForLinks()
	local rate, size = 100, 100
	txDev:getTxQueue(0):setRate(rate - (size + 4) * 8 / 1000)
	lm.startTask("loadSlave", txDev:getTxQueue(0), rxDev, size)
	lm.waitForTasks()
end

local function fillUdpPacket(buf, len)
	buf:getUdpPacket():fill{
		ethSrc = queue,
		ethDst = DST_MAC,
		ip4Src = SRC_IP,
		ip4Dst = DST_IP,
		udpSrc = SRC_PORT,
		udpDst = DST_PORT,
		pktLength = len
	}
end

function loadSlave(queue, rxDev, size)
	local mempool = memory.createMemPool(function(buf)
		fillUdpPacket(buf, size)
	end)
	local bufs = mempool:bufArray()
	local txCtr = stats:newDevTxCounter(queue, "plain")
	log:info('finalize immediately')
	txCtr:finalize()
	log:info('new txDev counter (1)')
	txCtr = stats:newDevTxCounter(queue, "plain")
	local time = timer:new(1)
	while lm.running() and not time:expired() do
		bufs:alloc(size)
		bufs:offloadUdpChecksums()
		queue:send(bufs)
		txCtr:update()
	end
	log:info('finalize after while')
	txCtr:finalize()
	lm.sleepMillis(5000)
	log:info('new txDev counter (2)')
	txCtr = stats:newDevTxCounter(queue, "plain")
	log:info('update & finalize')
	txCtr:update()
	txCtr:finalize()
end

produces as output:

$ ./build/MoonGen test.lua 0 1
# <snip>
[INFO]  Found 2 usable devices:
   Device 0: E0:DF:84:9B:C2:50 (Intel Corporation Ethernet Connection X552 10 GbE SFP+)
   Device 1: 9B:90:24:EC:46:42 (Intel Corporation Ethernet Connection X552 10 GbE SFP+)
# <snip>
[INFO]  finalize immediately
[Device: id=0] TX: nan (StdDev 0.00) Mpps, nan (StdDev 0) Mbit/s (nan Mbit/s with framing), total 0 packets with 0 bytes (incl. CRC)
[INFO]  new txDev counter (1)
[Device: id=0] TX: 0.12 Mpps, 99 Mbit/s (118 Mbit/s with framing)
[INFO]  finalize after while
[Device: id=0] TX: nan (StdDev 0.00) Mpps, nan (StdDev 0) Mbit/s (nan Mbit/s with framing), total 120078 packets with 12488112 bytes (incl. CRC)
[INFO]  new txDev counter (2)
[INFO]  update & finalize
[Device: id=0] TX: nan (StdDev 0.00) Mpps, nan (StdDev 0) Mbit/s (nan Mbit/s with framing), total 120078 packets with 12488112 bytes (incl. CRC)

which is, in my opinion, unexpected.
I'd expect the last line to report 0 packets/bytes, since stats:newDevTxCounter

obj:getThroughput() -- reset stats on the NIC

promises to reset stats.

Am I missing something?

Thanks!

Regards,
Sharlene

@scholzd
Copy link

scholzd commented Aug 30, 2018

@emmericp ?

@emmericp
Copy link
Member

getThroughput() no longer resets the stats, this was changed because we moved to using the DPDK stats functions on some NICs to support more NICs; so the comment is wrong.

What would be needed is an explizit reset for the device counters; current the device counters are just that: count everything the device has seen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants