Skip to content

Commit 9755d43

Browse files
committed
Update bench tests
1 parent b692a14 commit 9755d43

File tree

5 files changed

+847
-187
lines changed

5 files changed

+847
-187
lines changed

.metadata/metadata.org

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,56 @@ arena-interface switch-grayscale 0 # 0=binary, 1=grayscale
287287

288288
**** benchmarking
289289

290+
Benchmarks are available as *methods* on =ArenaInterface= so you can run them
291+
from IPython, scripts, or the CLI. The host-side numbers are most useful when
292+
paired with QS log capture to compare firmware-side =PERF_*= events.
293+
294+
***** Python / IPython
295+
296+
#+BEGIN_SRC python
297+
from arena_interface import ArenaInterface
298+
299+
ai = ArenaInterface(debug=True)
300+
ai.set_ethernet_mode("192.168.10.104")
301+
302+
# 1) Small command RTT (latency)
303+
ai.bench_command_rtt(iters=2000)
304+
305+
# 2) SPF update loop (paced vs max)
306+
ai.bench_spf_updates(rate_hz=200, seconds=5, pattern_id=10, pacing="target")
307+
ai.bench_spf_updates(rate_hz=200, seconds=5, pattern_id=10, pacing="max")
308+
309+
# 3) Stream frames (throughput) - accepts .pat or .pattern
310+
ai.bench_stream_frames("./patterns/pat0004.pat", frame_rate=200, seconds=5, progress_interval_s=0)
311+
312+
# 4) Full suite + save JSONL for later comparison across switches/hosts
313+
suite = ai.bench_suite(
314+
label="lab-switch-A / laptop-1",
315+
include_connect=True,
316+
stream_path="./patterns/pat0004.pat",
317+
)
318+
ai.write_bench_jsonl("bench_results.jsonl", suite)
319+
#+END_SRC
320+
321+
***** CLI
322+
290323
#+BEGIN_SRC sh
291-
arena-interface --ethernet 192.168.10.104 bench --stream-path ./patterns/pat0004.pat
324+
arena-interface --ethernet 192.168.10.104 bench \
325+
--label "lab-switch-A / laptop-1" \
326+
--json-out bench_results.jsonl \
327+
--include-connect \
328+
--cmd-connect-mode persistent \
329+
--spf-pacing target \
330+
--stream-path ./patterns/pat0004.pat
292331
#+END_SRC
293332

333+
Tips for comparing Ethernet switches/hosts/LANs:
334+
335+
- Keep the firmware build and the pattern file constant across runs.
336+
- Vary only the network path (switch/cable/VLAN/host) and change =--label=.
337+
- Capture QS logs in parallel so you can analyze device-side =PERF_UPD= and
338+
=PERF_NET= alongside the host-side results.
339+
294340
* Installation
295341

296342
[[https://github.com/janelia-python/python_setup]]

README.md

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,14 @@ ai.set_ethernet_mode(ip_address='192.168.10.62')
5656
ai.all_on()
5757
ai.all_off()
5858
ai.stream_frame(path='./patterns/pat0004.pat', frame_index=0, analog_output_value=2048)
59-
ai.stream_frames(path='./patterns/pat0004.pat', frame_rate=20, runtime_duration=50)
59+
ai.stream_frames(
60+
pattern_path='./patterns/pat0004.pat',
61+
frame_rate=20,
62+
runtime_duration=50,
63+
analog_out_waveform='constant',
64+
analog_update_rate=1.0,
65+
analog_frequency=0.0,
66+
)
6067
ai.play_pattern(pattern_id=3, frame_rate=20, runtime_duration=50)
6168
ai.play_pattern(pattern_id=3, frame_rate=-20, runtime_duration=50)
6269
ai.play_pattern(pattern_id=3, frame_rate=20, runtime_duration=50, initial_frame_index=4)
@@ -149,10 +156,53 @@ Options:
149156

150157
3. benchmarking
151158

159+
Benchmarks are available as methods on `ArenaInterface` (handy in IPython)
160+
and via the CLI. Host-side results are most useful paired with QS log
161+
capture so you can compare firmware-side `PERF_*` events alongside the
162+
host-side timings.
163+
164+
```python
165+
from arena_interface import ArenaInterface
166+
167+
ai = ArenaInterface(debug=True)
168+
ai.set_ethernet_mode("192.168.10.104")
169+
170+
# 1) Small command RTT (latency)
171+
ai.bench_command_rtt(iters=2000)
172+
173+
# 2) SPF update loop (paced vs max)
174+
ai.bench_spf_updates(rate_hz=200, seconds=5, pattern_id=10, pacing="target")
175+
ai.bench_spf_updates(rate_hz=200, seconds=5, pattern_id=10, pacing="max")
176+
177+
# 3) Stream frames (throughput) - accepts .pat or .pattern
178+
ai.bench_stream_frames("./patterns/pat0004.pat", frame_rate=200, seconds=5, progress_interval_s=0)
179+
180+
# 4) Full suite + save JSONL for later comparison across switches/hosts
181+
suite = ai.bench_suite(
182+
label="lab-switch-A / laptop-1",
183+
include_connect=True,
184+
stream_path="./patterns/pat0004.pat",
185+
)
186+
ai.write_bench_jsonl("bench_results.jsonl", suite)
187+
```
188+
152189
```sh
153-
python -m arena_interface.cli --ethernet 192.168.x.x bench --stream-path my.pattern
190+
arena-interface --ethernet 192.168.10.104 bench \
191+
--label "lab-switch-A / laptop-1" \
192+
--json-out bench_results.jsonl \
193+
--include-connect \
194+
--cmd-connect-mode persistent \
195+
--spf-pacing target \
196+
--stream-path ./patterns/pat0004.pat
154197
```
155198

199+
Tips for comparing Ethernet switches/hosts/LANs:
200+
201+
- Keep the firmware build and the pattern file constant across runs.
202+
- Vary only the network path (switch/cable/VLAN/host) and change `--label`.
203+
- Capture QS logs in parallel so you can analyze device-side `PERF_UPD` and
204+
`PERF_NET` alongside the host-side results.
205+
156206

157207
<a id="org024f908"></a>
158208

0 commit comments

Comments
 (0)