Created
June 18, 2015 00:39
-
-
Save mundya/2cead20016c7aa8ed23b 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
import argparse | |
from rig.machine_control import MachineController | |
import sys | |
def count_dropped_mc(hostname): | |
"""Retrieve a count of the dropped packets on a given SpiNNaker machine.""" | |
# Construct a controller for the machine | |
mc = MachineController(hostname) | |
# Retrieve a machine description | |
machine = mc.get_machine() | |
# For every chip retrieve the router diagnostics and display the number of | |
# dropped packets if any packets have been dropped. | |
any_dropped = False | |
for x, y in machine: | |
rtr_diag = mc.get_router_diagnostics(x, y) | |
if rtr_diag.dropped_multicast > 0: | |
sys.stdout.write("({}, {}): {} dropped MC packets\n".format( | |
x, y, rtr_diag.dropped_multicast)) | |
any_dropped = True | |
if not any_dropped: | |
sys.stdout.write("No dropped packets.\n") | |
if __name__ == "__main__": | |
parser = argparse.ArgumentParser() | |
parser.add_argument("hostname") | |
args = parser.parse_args() | |
count_dropped_mc(args.hostname) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment