From 7a863b4f5e113aa31155045c7d1e66f37fa3c1d5 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 13 Dec 2023 13:08:54 +0800 Subject: [PATCH] core: add trigger_analyzer_proxy API --- artiq/coredevice/core.py | 26 ++++++++++++++++++- artiq/examples/kasli/device_db.py | 6 ++++- .../kasli_drtioswitching/device_db.py | 6 ++++- artiq/examples/kasli_suservo/device_db.py | 6 ++++- artiq/examples/kc705_nist_clock/device_db.py | 6 ++++- artiq/frontend/artiq_ddb_template.py | 8 +++++- 6 files changed, 52 insertions(+), 6 deletions(-) diff --git a/artiq/coredevice/core.py b/artiq/coredevice/core.py index 7fc853bed..9377af682 100644 --- a/artiq/coredevice/core.py +++ b/artiq/coredevice/core.py @@ -84,7 +84,10 @@ class Core: "core", "ref_period", "coarse_ref_period", "ref_multiplier", } - def __init__(self, dmgr, host, ref_period, ref_multiplier=8, + def __init__(self, dmgr, + host, ref_period, + analyzer_proxy=None, + ref_multiplier=8, target="rv32g", satellite_cpu_targets={}): self.ref_period = ref_period self.ref_multiplier = ref_multiplier @@ -95,6 +98,10 @@ class Core: self.comm = CommKernelDummy() else: self.comm = CommKernel(host) + if analyzer_proxy is None: + self.analyzer_proxy = None + else: + self.analyzer_proxy = dmgr.get(analyzer_proxy) self.first_run = True self.dmgr = dmgr @@ -288,3 +295,20 @@ class Core: min_now = rtio_get_counter() + 125000 if now_mu() < min_now: at_mu(min_now) + + def trigger_analyzer_proxy(self): + """Causes the core analyzer proxy to retrieve a dump from the device, + and distribute it to all connected clients (typically dashboards). + + Returns only after the dump has been retrieved from the device. + + Raises IOError if no analyzer proxy has been configured, or if the + analyzer proxy fails. In the latter case, more details would be + available in the proxy log. + """ + if self.analyzer_proxy is None: + raise IOError("No analyzer proxy configured") + else: + success = self.analyzer_proxy.trigger() + if not success: + raise IOError("Analyzer proxy reported failure") diff --git a/artiq/examples/kasli/device_db.py b/artiq/examples/kasli/device_db.py index 34da8282f..274fed61e 100644 --- a/artiq/examples/kasli/device_db.py +++ b/artiq/examples/kasli/device_db.py @@ -7,7 +7,11 @@ device_db = { "type": "local", "module": "artiq.coredevice.core", "class": "Core", - "arguments": {"host": core_addr, "ref_period": 1e-9} + "arguments": { + "host": core_addr, + "ref_period": 1e-9, + "analyzer_proxy": "core_analyzer" + } }, "core_log": { "type": "controller", diff --git a/artiq/examples/kasli_drtioswitching/device_db.py b/artiq/examples/kasli_drtioswitching/device_db.py index 1605e1988..43dc22a0f 100644 --- a/artiq/examples/kasli_drtioswitching/device_db.py +++ b/artiq/examples/kasli_drtioswitching/device_db.py @@ -5,7 +5,11 @@ device_db = { "type": "local", "module": "artiq.coredevice.core", "class": "Core", - "arguments": {"host": core_addr, "ref_period": 1/(8*150e6)} + "arguments": { + "host": core_addr, + "ref_period": 1e-9, + "analyzer_proxy": "core_analyzer" + } }, "core_log": { "type": "controller", diff --git a/artiq/examples/kasli_suservo/device_db.py b/artiq/examples/kasli_suservo/device_db.py index 2b3bb8a08..ded4ada96 100644 --- a/artiq/examples/kasli_suservo/device_db.py +++ b/artiq/examples/kasli_suservo/device_db.py @@ -5,7 +5,11 @@ device_db = { "type": "local", "module": "artiq.coredevice.core", "class": "Core", - "arguments": {"host": core_addr, "ref_period": 1e-9} + "arguments": { + "host": core_addr, + "ref_period": 1e-9, + "analyzer_proxy": "core_analyzer" + } }, "core_log": { "type": "controller", diff --git a/artiq/examples/kc705_nist_clock/device_db.py b/artiq/examples/kc705_nist_clock/device_db.py index 804d8a163..f21d1c5ef 100644 --- a/artiq/examples/kc705_nist_clock/device_db.py +++ b/artiq/examples/kc705_nist_clock/device_db.py @@ -9,7 +9,11 @@ device_db = { "type": "local", "module": "artiq.coredevice.core", "class": "Core", - "arguments": {"host": core_addr, "ref_period": 1e-9} + "arguments": { + "host": core_addr, + "ref_period": 1e-9, + "analyzer_proxy": "core_analyzer" + } }, "core_log": { "type": "controller", diff --git a/artiq/frontend/artiq_ddb_template.py b/artiq/frontend/artiq_ddb_template.py index c795c9073..e55637d37 100755 --- a/artiq/frontend/artiq_ddb_template.py +++ b/artiq/frontend/artiq_ddb_template.py @@ -55,7 +55,13 @@ def process_header(output, description): "type": "local", "module": "artiq.coredevice.core", "class": "Core", - "arguments": {{"host": core_addr, "ref_period": {ref_period}, "target": "{cpu_target}", "satellite_cpu_targets": {{}} }}, + "arguments": {{ + "host": core_addr, + "ref_period": {ref_period}, + "analyzer_proxy": "core_analyzer" + "target": "{cpu_target}", + "satellite_cpu_targets": {{}} + }}, }}, "core_log": {{ "type": "controller",