From 4c015d383d287812c86faf003e2c6776f580451b Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 17 Feb 2015 16:14:18 -0700 Subject: [PATCH] put benchmarks in separate folder --- benchmarks/all.py | 16 ++++++++++++++++ .../pulse_rate.py | 10 +++------- {examples => benchmarks}/rtio_skew.py | 10 ++-------- 3 files changed, 21 insertions(+), 15 deletions(-) create mode 100644 benchmarks/all.py rename examples/pulse_performance.py => benchmarks/pulse_rate.py (72%) rename {examples => benchmarks}/rtio_skew.py (74%) diff --git a/benchmarks/all.py b/benchmarks/all.py new file mode 100644 index 000000000..a2bc069f7 --- /dev/null +++ b/benchmarks/all.py @@ -0,0 +1,16 @@ +from artiq import * + +import pulse_rate, rtio_skew + + +_units = [pulse_rate.PulseRate, rtio_skew.RTIOSkew] + +class AllBenchmarks(AutoDB): + def build(self): + self.se = [] + for unit in _units: + self.se.append(unit(self.dbh)) + + def run(self): + for se in self.se: + se.run() diff --git a/examples/pulse_performance.py b/benchmarks/pulse_rate.py similarity index 72% rename from examples/pulse_performance.py rename to benchmarks/pulse_rate.py index 08c982d89..9594b4be0 100644 --- a/examples/pulse_performance.py +++ b/benchmarks/pulse_rate.py @@ -2,13 +2,10 @@ from artiq import * from artiq.coredevice.runtime_exceptions import RTIOUnderflow -def print_min_period(p): - print("Minimum square wave output period: {} ns".format(p)) - - -class PulsePerformance(AutoDB): +class PulseRate(AutoDB): class DBKeys: ttl0 = Device() + pulse_rate = Result() @kernel def run(self): @@ -22,6 +19,5 @@ class PulsePerformance(AutoDB): T += 1 self.core.recover_underflow() else: - print_min_period(int(cycles_to_time(2*T)/(1*ns))) + self.pulse_rate = cycles_to_time(2*T) break - diff --git a/examples/rtio_skew.py b/benchmarks/rtio_skew.py similarity index 74% rename from examples/rtio_skew.py rename to benchmarks/rtio_skew.py index 9be1078c5..4c34146e5 100644 --- a/examples/rtio_skew.py +++ b/benchmarks/rtio_skew.py @@ -9,13 +9,7 @@ class RTIOSkew(AutoDB): class DBKeys: pmt0 = Device() ttl0 = Device() - io_skew = Result() - - @staticmethod - def realtime_results(): - return { - "io_skew": "raw" - } + rtio_skew = Result() @kernel def run(self): @@ -28,4 +22,4 @@ class RTIOSkew(AutoDB): in_t = self.pmt0.timestamp() if in_t < 0*s: raise PulseNotReceived - self.io_skew = out_t - in_t + self.rtio_skew = out_t - in_t