summaryrefslogtreecommitdiffstats
path: root/VNFs/DPPD-PROX/helper-scripts/rapid/prox_ctrl.py
diff options
context:
space:
mode:
Diffstat (limited to 'VNFs/DPPD-PROX/helper-scripts/rapid/prox_ctrl.py')
-rw-r--r--VNFs/DPPD-PROX/helper-scripts/rapid/prox_ctrl.py50
1 files changed, 32 insertions, 18 deletions
diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/prox_ctrl.py b/VNFs/DPPD-PROX/helper-scripts/rapid/prox_ctrl.py
index 3ee28c00..bda3e5d9 100644
--- a/VNFs/DPPD-PROX/helper-scripts/rapid/prox_ctrl.py
+++ b/VNFs/DPPD-PROX/helper-scripts/rapid/prox_ctrl.py
@@ -183,15 +183,21 @@ class prox_sock(object):
def reset_stats(self):
self._send('reset stats')
- def lat_stats(self, cores, task=0):
+ def lat_stats(self, cores, tasks={0}):
min_lat = 999999999
max_lat = avg_lat = 0
- self._send('lat stats %s %s' % (','.join(map(str, cores)), task))
+ self._send('lat stats %s %s' % (','.join(map(str, cores)), ','.join(map(str, tasks))))
for core in cores:
- stats = self._recv().split(',')
- min_lat = min(int(stats[0]),min_lat)
- max_lat = max(int(stats[1]),max_lat)
- avg_lat += int(stats[2])
+ for task in tasks:
+ stats = self._recv().split(',')
+ if stats[0].startswith('error'):
+ if stats[0].startswith('error: invalid syntax'):
+ log.critical("dp core stats error: unexpected invalid syntax (potential incompatibility between scripts and PROX)")
+ raise Exception("dp core stats error")
+ continue
+ min_lat = min(int(stats[0]),min_lat)
+ max_lat = max(int(stats[1]),max_lat)
+ avg_lat += int(stats[2])
avg_lat = avg_lat/len(cores)
self._send('stats latency(0).used')
used = float(self._recv())
@@ -211,19 +217,27 @@ class prox_sock(object):
buckets = buckets[:-1]
return buckets
- def core_stats(self, cores, task=0):
- rx = tx = drop = tsc = hz = rx_non_dp = tx_non_dp = 0
- self._send('dp core stats %s %s' % (','.join(map(str, cores)), task))
+ def core_stats(self, cores, tasks={0}):
+ rx = tx = drop = tsc = hz = rx_non_dp = tx_non_dp = tx_fail = 0
+ self._send('dp core stats %s %s' % (','.join(map(str, cores)), ','.join(map(str, tasks))))
for core in cores:
- stats = self._recv().split(',')
- rx += int(stats[0])
- tx += int(stats[1])
- rx_non_dp += int(stats[2])
- tx_non_dp += int(stats[3])
- drop += int(stats[4])
- tsc = int(stats[5])
- hz = int(stats[6])
- return rx-rx_non_dp, tx-tx_non_dp, drop, tsc, hz
+ for task in tasks:
+ stats = self._recv().split(',')
+ if stats[0].startswith('error'):
+ if stats[0].startswith('error: invalid syntax'):
+ log.critical("dp core stats error: unexpected invalid syntax (potential incompatibility between scripts and PROX)")
+ raise Exception("dp core stats error")
+ continue
+ rx += int(stats[0])
+ tx += int(stats[1])
+ rx_non_dp += int(stats[2])
+ tx_non_dp += int(stats[3])
+ drop += int(stats[4])
+ tx_fail += int(stats[5])
+ tsc = int(stats[6])
+ hz = int(stats[7])
+ return rx,rx_non_dp, tx,tx_non_dp, drop, tx_fail, tsc, hz
+ #return rx-rx_non_dp, tx-tx_non_dp, drop, tx_fail, tsc, hz
def set_random(self, cores, task, offset, mask, length):
self._send('set random %s %s %s %s %s' % (','.join(map(str, cores)), task, offset, mask, length))