Skip to content

Instantly share code, notes, and snippets.

@mundya
Created June 18, 2015 00:39
Show Gist options
  • Save mundya/2cead20016c7aa8ed23b to your computer and use it in GitHub Desktop.
Save mundya/2cead20016c7aa8ed23b to your computer and use it in GitHub Desktop.
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