Last active
May 13, 2021 23:24
-
-
Save netletic/7b1fd511318aaca5f664472d33f43c79 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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