- print(u"##### statistics port 0 #####")
- print(json.dumps(xstats0, indent=4, separators=(u",", u": ")))
- print(u"##### statistics port 1 #####")
- print(json.dumps(xstats1, indent=4, separators=(u",", u": ")))
-
- tx_0, rx_0 = xstats0[u"tx_good_packets"], xstats0[u"rx_good_packets"]
- tx_1, rx_1 = xstats1[u"tx_good_packets"], xstats1[u"rx_good_packets"]
- lost_a, lost_b = tx_0 - rx_1, tx_1 - rx_0
+ for idx,stat in enumerate(zip(xstats[0::2], xstats[1::2])):
+ lost_r = stat[0]["tx_good_packets"] - stat[1]["rx_good_packets"]
+ lost_l = stat[1]["tx_good_packets"] - stat[0]["rx_good_packets"]
+ print(f"packets lost from {idx*2} --> {idx*2+1}: {lost_r} pkts")
+ print(f"packets lost from {idx*2+1} --> {idx*2}: {lost_l} pkts")