NFVBENCH-95 Add HdrHistogram encodes returned by TRex to JSON results 93/68093/1
authorahothan <ahothan@cisco.com>
Sun, 23 Jun 2019 16:24:54 +0000 (09:24 -0700)
committerahothan <ahothan@cisco.com>
Sun, 23 Jun 2019 16:32:08 +0000 (09:32 -0700)
Change-Id: Id80da949f7b1f3736558facd0128a0bd82b35010
Signed-off-by: ahothan <ahothan@cisco.com>
docs/development/building/build.rst
nfvbench/packet_stats.py
nfvbench/traffic_gen/traffic_base.py
nfvbench/traffic_gen/trex_gen.py

index e195add..1b6bc0a 100644 (file)
@@ -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:
index 4b9eac5..3203b72 100644 (file)
@@ -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
index 434fdae..9c78d7e 100644 (file)
@@ -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():
index 989940a..036c899 100644 (file)
@@ -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")