From 54e55386955a5e3763f1b72f16e952a87616c563 Mon Sep 17 00:00:00 2001 From: Matthieu Herrb Date: Sat, 18 Feb 2023 14:20:08 +0100 Subject: [PATCH] add ability to sum a list of interfaces before sorting --- plog95.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plog95.py b/plog95.py index a35cee1..2f0a54f 100755 --- a/plog95.py +++ b/plog95.py @@ -21,7 +21,7 @@ def to_datetime(xd): b_or_p=sys.argv[1] # "b" or "p" txrx=int(sys.argv[2]) # 0 for RX 1 for TX -iface95=sys.argv[3] +iface95_l = sys.argv[3].split(':') #=== Thu Jun 28 22:00:08 UTC 2012 === #Inter-| Receive | Transmit @@ -62,7 +62,7 @@ for fname in sys.argv[4:]: print(line_i) #raise iface=header.strip(" ") - if iface!=iface95: continue + if not iface in iface95_l: continue bytes=[int(x) for x in re.findall(r'\w+', data)] d[t_s][iface]={"b":[bytes[0],bytes[8]],"p":[bytes[1],bytes[9]]} @@ -75,7 +75,7 @@ for t in t_l: iface_l=iface_d.keys() #iface_l.sort() -#print(len(iface_l)) +#print(iface_l) #print "T,",",".join(iface_l) prev={} @@ -89,6 +89,7 @@ for t in t_l: if tn<=tn0 and t!=t0: continue tn0=tn s="%f"%t + tot_mbit_s = 0.0; for i in iface_l: y=0 x=None @@ -101,8 +102,9 @@ for t in t_l: mbit_s=float(y)*8.0/300.0e6 #if mbit_s>600.0: print to_datetime(t),mbit_s if mbit_s>10000.0: mbit_s=0.0 - mb_l.append(mbit_s) + tot_mbit_s += mbit_s; prev[i]=x + mb_l.append(tot_mbit_s) #print(s) mb_l.sort()