Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: GlasgowEmbedded/glasgow
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 39ece2a05ed3
Choose a base ref
...
head repository: GlasgowEmbedded/glasgow
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2190ecf4307c
Choose a head ref
  • 2 commits
  • 2 files changed
  • 2 contributors

Commits on Sep 27, 2019

  1. device.hardware: start USB poller thread only after enumeration.

    USB poller threads are unfortunately deadlock-prone (see 4de7004),
    so if we start it before enumeration and enumeration fails, we have
    to clean it up. Since we only use synchronous API during enumeration,
    it's easier to delay starting the poller thread.
    whitequark committed Sep 27, 2019
    Copy the full SHA
    2813263 View commit details
  2. Copy the full SHA
    2190ecf View commit details
Showing with 8 additions and 6 deletions.
  1. +3 −2 software/glasgow/applet/internal/benchmark/__init__.py
  2. +5 −4 software/glasgow/device/hardware.py
5 changes: 3 additions & 2 deletions software/glasgow/applet/internal/benchmark/__init__.py
Original file line number Diff line number Diff line change
@@ -229,10 +229,11 @@ async def counter():
self.logger.error("mode %s failed at %#x!", mode, count)
else:
if mode == "latency":
self.logger.info("mode %s: %.2f µs stddev: %.2f µs",
self.logger.info("mode %s: mean: %.2f µs stddev: %.2f µs worst: %.2f µs",
mode,
statistics.mean(roundtriptime),
statistics.pstdev(roundtriptime))
statistics.pstdev(roundtriptime),
max(roundtriptime))
else:
self.logger.info("mode %s: %.2f MiB/s (%.2f Mb/s)",
mode,
9 changes: 5 additions & 4 deletions software/glasgow/device/hardware.py
Original file line number Diff line number Diff line change
@@ -55,17 +55,15 @@ def run(self):

class GlasgowHardwareDevice:
def __init__(self, serial=None, firmware_filename=None, *, _factory_rev=None):
self.usb_context = usb1.USBContext()
self.usb_poller = _PollerThread(self.usb_context)
self.usb_poller.start()
usb_context = usb1.USBContext()

firmware = None
handles = {}
discover = True
while discover:
discover = False

for device in self.usb_context.getDeviceIterator():
for device in usb_context.getDeviceIterator():
vendor_id = device.getVendorID()
product_id = device.getProductID()
device_id = device.getbcdDevice()
@@ -127,6 +125,9 @@ def __init__(self, serial=None, firmware_filename=None, *, _factory_rev=None):
raise GlasgowDeviceError("device with serial number {} not found"
.format(serial))

self.usb_context = usb_context
self.usb_poller = _PollerThread(self.usb_context)
self.usb_poller.start()
if serial is None:
self.revision, self.usb_handle = next(iter(handles.values()))
else: