From 108a9f65ed0792ccb427e081ef3068002443983e Mon Sep 17 00:00:00 2001 From: ahothan Date: Sun, 23 Jun 2019 09:24:54 -0700 Subject: NFVBENCH-95 Add HdrHistogram encodes returned by TRex to JSON results Change-Id: Id80da949f7b1f3736558facd0128a0bd82b35010 Signed-off-by: ahothan --- docs/development/building/build.rst | 2 ++ nfvbench/packet_stats.py | 2 ++ nfvbench/traffic_gen/traffic_base.py | 1 + nfvbench/traffic_gen/trex_gen.py | 65 +++++++++++++++++++++++++++++++++++- 4 files changed, 69 insertions(+), 1 deletion(-) diff --git a/docs/development/building/build.rst b/docs/development/building/build.rst index e195add..1b6bc0a 100644 --- a/docs/development/building/build.rst +++ b/docs/development/building/build.rst @@ -64,6 +64,8 @@ VM code has changed: - update VM version in the 2 locations - commit VM changes with gerrit to trigger VM build and publication to google storage +- IMPORTANT! wait for the VM image to be pushed to google storage before going to the next step + (otherwise the container build will fail as it will not find the VM image) - apply a new semver tag to trigger the container image build/publication To increase the TRex version: diff --git a/nfvbench/packet_stats.py b/nfvbench/packet_stats.py index 4b9eac5..3203b72 100644 --- a/nfvbench/packet_stats.py +++ b/nfvbench/packet_stats.py @@ -237,6 +237,8 @@ class PacketPathStats(object): results = {'lat_min_usec': latency.min_usec, 'lat_max_usec': latency.max_usec, 'lat_avg_usec': latency.avg_usec} + if latency.hdrh: + results['hdrh'] = latency.hdrh else: results = {} results['packets'] = counters diff --git a/nfvbench/traffic_gen/traffic_base.py b/nfvbench/traffic_gen/traffic_base.py index 434fdae..9c78d7e 100644 --- a/nfvbench/traffic_gen/traffic_base.py +++ b/nfvbench/traffic_gen/traffic_base.py @@ -30,6 +30,7 @@ class Latency(object): self.min_usec = sys.maxint self.max_usec = 0 self.avg_usec = 0 + self.hdrh = None if latency_list: for lat in latency_list: if lat.available(): diff --git a/nfvbench/traffic_gen/trex_gen.py b/nfvbench/traffic_gen/trex_gen.py index 989940a..036c899 100644 --- a/nfvbench/traffic_gen/trex_gen.py +++ b/nfvbench/traffic_gen/trex_gen.py @@ -245,11 +245,74 @@ class TRex(AbstractTrafficGenerator): else: latencies[port].min_usec = get_latency(lat['total_min']) latencies[port].avg_usec = get_latency(lat['average']) + # pick up the HDR histogram if present (otherwise will raise KeyError) + latencies[port].hdrh = lat['hdrh'] except KeyError: pass def __combine_latencies(self, in_stats, results, port_handle): - """Traverse TRex result dictionary and combines chosen latency stats.""" + """Traverse TRex result dictionary and combines chosen latency stats. + + example of latency dict returned by trex (2 chains): + 'latency': {256: {'err_cntrs': {'dropped': 0, + 'dup': 0, + 'out_of_order': 0, + 'seq_too_high': 0, + 'seq_too_low': 0}, + 'latency': {'average': 26.5, + 'hdrh': u'HISTFAAAAEx4nJNpmSgz...bFRgxi', + 'histogram': {20: 303, + 30: 320, + 40: 300, + 50: 73, + 60: 4, + 70: 1}, + 'jitter': 14, + 'last_max': 63, + 'total_max': 63, + 'total_min': 20}}, + 257: {'err_cntrs': {'dropped': 0, + 'dup': 0, + 'out_of_order': 0, + 'seq_too_high': 0, + 'seq_too_low': 0}, + 'latency': {'average': 29.75, + 'hdrh': u'HISTFAAAAEV4nJN...CALilDG0=', + 'histogram': {20: 261, + 30: 431, + 40: 3, + 50: 80, + 60: 225}, + 'jitter': 23, + 'last_max': 67, + 'total_max': 67, + 'total_min': 20}}, + 384: {'err_cntrs': {'dropped': 0, + 'dup': 0, + 'out_of_order': 0, + 'seq_too_high': 0, + 'seq_too_low': 0}, + 'latency': {'average': 18.0, + 'hdrh': u'HISTFAAAADR4nJNpm...MjCwDDxAZG', + 'histogram': {20: 987, 30: 14}, + 'jitter': 0, + 'last_max': 34, + 'total_max': 34, + 'total_min': 20}}, + 385: {'err_cntrs': {'dropped': 0, + 'dup': 0, + 'out_of_order': 0, + 'seq_too_high': 0, + 'seq_too_low': 0}, + 'latency': {'average': 19.0, + 'hdrh': u'HISTFAAAADR4nJNpm...NkYmJgDdagfK', + 'histogram': {20: 989, 30: 11}, + 'jitter': 0, + 'last_max': 38, + 'total_max': 38, + 'total_min': 20}}, + 'global': {'bad_hdr': 0, 'old_flow': 0}}, + """ total_max = 0 average = 0 total_min = float("inf") -- cgit 1.2.3-korg