aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/network_services/traffic_profile
diff options
context:
space:
mode:
authorRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2018-08-16 12:20:10 +0100
committerRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2018-08-20 11:02:56 +0100
commitb103e6a8544d727ea155ec2c2bc71dbf91a36219 (patch)
tree908282719f2540549d7a2f62a116578596609676 /yardstick/network_services/traffic_profile
parentf32d9e5e452429905c8099db9b5d4a0fa14dff13 (diff)
Improvie TRex RFC2544 throughput calculation
Improve TRex RFC2544 throughput calculation by using the in/out packets instead of using the throughput samples. JIRA: YARDSTICK-1387 Change-Id: I877e901c3226d31c6435a877a2924bb95deb1cf0 Signed-off-by: Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
Diffstat (limited to 'yardstick/network_services/traffic_profile')
-rw-r--r--yardstick/network_services/traffic_profile/rfc2544.py23
1 files changed, 10 insertions, 13 deletions
diff --git a/yardstick/network_services/traffic_profile/rfc2544.py b/yardstick/network_services/traffic_profile/rfc2544.py
index b54fc575f..898315671 100644
--- a/yardstick/network_services/traffic_profile/rfc2544.py
+++ b/yardstick/network_services/traffic_profile/rfc2544.py
@@ -247,19 +247,16 @@ class RFC2544Profile(trex_traffic_profile.TrexProfile):
correlated_traffic):
"""Calculate the drop percentage and run the traffic"""
completed = False
- tx_rate_fps = 0
- rx_rate_fps = 0
- for sample in samples:
- tx_rate_fps += sum(
- port['tx_throughput_fps'] for port in sample.values())
- rx_rate_fps += sum(
- port['rx_throughput_fps'] for port in sample.values())
- tx_rate_fps = round(float(tx_rate_fps) / len(samples), 2)
- rx_rate_fps = round(float(rx_rate_fps) / len(samples), 2)
-
- # TODO(esm): RFC2544 doesn't tolerate packet loss, why do we?
- out_packets = sum(port['out_packets'] for port in samples[-1].values())
- in_packets = sum(port['in_packets'] for port in samples[-1].values())
+ out_pkt_end = sum(port['out_packets'] for port in samples[-1].values())
+ in_pkt_end = sum(port['in_packets'] for port in samples[-1].values())
+ out_pkt_ini = sum(port['out_packets'] for port in samples[0].values())
+ in_pkt_ini = sum(port['in_packets'] for port in samples[0].values())
+ time_diff = (list(samples[-1].values())[0]['timestamp'] -
+ list(samples[0].values())[0]['timestamp']).total_seconds()
+ out_packets = out_pkt_end - out_pkt_ini
+ in_packets = in_pkt_end - in_pkt_ini
+ tx_rate_fps = float(out_packets) / time_diff
+ rx_rate_fps = float(in_packets) / time_diff
drop_percent = 100.0
# https://tools.ietf.org/html/rfc2544#section-26.3