Skip to content

Instantly share code, notes, and snippets.

@netletic
Last active May 13, 2021 23:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save netletic/7b1fd511318aaca5f664472d33f43c79 to your computer and use it in GitHub Desktop.
Save netletic/7b1fd511318aaca5f664472d33f43c79 to your computer and use it in GitHub Desktop.
rx = {}
delta = {}
with open("t2.txt") as f_t2:
for line in f_t2.readlines():
if "Chassis/Slot/Port" in line:
port = line.split()[1].strip()
rx[port] = {}
if "Bytes Received" in line:
t2_bytes_rx = line.split(":")[1].strip().rstrip(", Unicast Frames ")
rx[port]["t2"] = int(t2_bytes_rx)
with open("t1.txt") as f_t1:
for line in f_t1.readlines():
if "Chassis/Slot/Port" in line:
port = line.split()[1].strip()
if "Bytes Received" in line:
t1_bytes_rx = line.split(":")[1].strip().rstrip(", Unicast Frames ")
rx[port]["t1"] = int(t1_bytes_rx)
bytes_received_during_delta_t = rx.get(port).get("t2") - rx.get(port).get(
"t1"
)
delta[port] = bytes_received_during_delta_t
print(sorted(delta, key=delta.get, reverse=True)[:5])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment