Workaround for negative packet count bug in nuttcp

Change to 1024 based unit conversion;
Automatically fetch version string from vmtp.py;

Change-Id: I473a2a03eb4153326c8ee7394b2a71a2815622b8
This commit is contained in:
Yichen Wang 2015-03-03 14:55:49 -08:00
parent 95f89dd728
commit dc8719279a
4 changed files with 16 additions and 9 deletions

View File

@ -13,8 +13,9 @@
# serve to show the default.
import datetime
import sys
import os
import re
import sys
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
@ -57,9 +58,11 @@ copyright = u"%d, OpenStack Foundation" % datetime.datetime.now().year
# built documents.
#
# The short X.Y version.
version = '2.0.0'
vmtp_file = open("../../vmtp.py")
raw_text = vmtp_file.read()
version = re.search(r"__version__\s=\s'(\d+\.\d+\.\d+)'", raw_text).group(1)
# The full version, including alpha/beta/rc tags.
release = '2.0.0'
release = version
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.

View File

@ -19,7 +19,7 @@ VMTP Usage
[--udpbuf <udp_pkt_size1,...>] [--no-env] [-d] [-v]
[--stop-on-error] [--vm_image_url <url_to_image>]
OpenStack VM Throughput V2.0.0
OpenStack VM Throughput V2.0.1
optional arguments:
-h, --help show this help message and exit

View File

@ -166,15 +166,19 @@ class NuttcpTool(PerfTool):
# UDP output (unicast and multicast):
# megabytes=1.1924 real_seconds=10.01 rate_Mbps=0.9997 tx_cpu=99 rx_cpu=0
# drop=0 pkt=1221 data_loss=0.00000
re_udp = r'rate_Mbps=([\d\.]*) tx_cpu=\d* rx_cpu=\d* drop=(\d*) pkt=(\d*)'
re_udp = r'rate_Mbps=([\d\.]*) tx_cpu=\d* rx_cpu=\d* drop=(\-*\d*) pkt=(\d*)'
match = re.search(re_udp, cmd_out)
if match:
rate_mbps = float(match.group(1))
drop = float(match.group(2))
pkt = int(match.group(3))
# nuttcp uses multiple of 1000 for Kbps - not 1024
# Workaround for a bug of nuttcp that sometimes it will return a
# negative number for drop.
if drop < 0:
drop = 0
return [self.parse_results('UDP',
int(rate_mbps * 1000),
int(rate_mbps * 1024),
lossrate=round(drop * 100 / pkt, 2),
reverse_dir=reverse_dir,
msg_size=length,
@ -190,7 +194,7 @@ class NuttcpTool(PerfTool):
retrans = int(match.group(2))
rtt_ms = float(match.group(3))
return [self.parse_results('TCP',
int(rate_mbps * 1000),
int(rate_mbps * 1024),
retrans=retrans,
rtt_ms=rtt_ms,
reverse_dir=reverse_dir,

View File

@ -39,7 +39,7 @@ from neutronclient.v2_0 import client as neutronclient
from novaclient.client import Client
from novaclient.exceptions import ClientException
__version__ = '2.0.0'
__version__ = '2.0.1'
from perf_instance import PerfInstance as PerfInstance