Bench: opt-in nRF52 instrument for MCU awake time and CPU time per received packet
Changelog: - Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
22700192bd
commit
7a7c894e2d
4 files changed
+85
-1
No files matched your search
@@ -171,6 +171,34 @@ a half-drained `rxlog`/`pktlog` page would otherwise wait for the next
|
||||
connection event — the bridge drains those on a 2-minute duty cycle, so a slower
|
||||
drain directly costs collected frames.
|
||||
|
||||
### CPU time per received packet (`PWR_DUTY_INSTRUMENT`)
|
||||
|
||||
A bench build with `-D PWR_DUTY_INSTRUMENT` (nRF52 only, nothing changes
|
||||
without the flag) prints one line to the USB console every ~10 s:
|
||||
|
||||
```
|
||||
PWRDUTY awake_ms=… asleep_ms=… wakes=… duty_permille=… pkt_us=… pkt_n=…
|
||||
```
|
||||
|
||||
- `awake_ms`, `asleep_ms` and `duty_permille` are the time between a return
|
||||
from `NRF52Board::sleep()` and the next entry into it, against the WFE span
|
||||
inside it. This needs `powersaving on`: without it `sleep()` is never called.
|
||||
- `wakes` counts the passes through `sleep()`. BLE and USB events wake the
|
||||
core too, so the duty is not packet cost alone.
|
||||
- `pkt_us` and `pkt_n` are the CPU time spent in
|
||||
`Dispatcher::processRecvPacket()` (dedup, crypto, routing) and the number of
|
||||
packets. They do not depend on background wakes. This is the work a filter
|
||||
on the radio side could skip for a packet that is dropped anyway.
|
||||
|
||||
All counters are cumulative since boot, so take the difference between two
|
||||
lines.
|
||||
|
||||
Measured on the XIAO x4, 24. 11. 2026, live mesh, about 440 packets/h (all
|
||||
flood adverts): about **6.8 ms CPU per received packet**, mostly the Ed25519
|
||||
check of the advert signature. The duty went from 0.05 % at rest to 0.13 %.
|
||||
The awake time is a small part of a node's current; the radio's RX and the
|
||||
SoftDevice dominate.
|
||||
|
||||
## A mast that runs flat: bootlock and cutoff
|
||||
|
||||
A panel that gets no direct sun in winter (remote-mast faces east, 11/2026:
|
||||
|
||||
@@ -210,6 +210,7 @@ The ones that change what a node does; set in `platformio.ini` /
|
||||
| `LOGIN_FAIL_MAX`, `LOGIN_FAIL_SECS` | `4`, `180` (s) | after that many wrong passwords in the window no password is checked until it ends (an admin already in the ACL always gets in) |
|
||||
| `NRF52_POWER_MANAGEMENT`, `PWRMGT_RUNTIME` | upstream: off; on in `SenseCap_Solar_repeater` (the masts) | boot protection, and with `PWRMGT_RUNTIME` the runtime `pwr.bootlock` / `pwr.cutoff` above |
|
||||
| `PWRMGT_BOOTLOCK_DEFAULT`, `PWRMGT_CUTOFF_DEFAULT` | `PWRMGT_VOLTAGE_BOOTLOCK` (SenseCAP 3300), `0` (mV) | thresholds for a node without `/pwr_guard` |
|
||||
| `PWR_DUTY_INSTRUMENT` | unset | bench only, nRF52: every ~10 s a `PWRDUTY` line on the USB console with the time the MCU was awake and asleep, its wakes, and the CPU time spent on received packets. See [power.md](power.md#cpu-time-per-received-packet-pwr_duty_instrument) |
|
||||
|
||||
Prefs saved on the node override the build defaults: a reflash keeps what a
|
||||
node already has; only a new node or one after `erase` takes them.
|
||||
Reference in new issue
Block a user