v0.6.0: CPU monitoring, CSV with CPU, docs update, cleanup
New in v0.6.0: - CPU usage: local/remote shown per interval (cpu: 12%/33%) - Warning indicator (!) when CPU > 70% on either side - MikroTik CPU encoding: 0x80 | percentage in status byte 1 - CSV includes local_cpu_pct and remote_cpu_pct columns - Status message format corrected to match MikroTik wire format: [type:1][cpu:1][00:2][seq:4 LE][bytes:4 LE] - Removed btest-opensource submodule (fully reimplemented) - Deleted research/ecsrp5 branch - Updated all docs: architecture, user-guide, man page, protocol - Version bumped to 0.6.0 58 tests, all passing. Zero warnings. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -99,7 +99,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "btest-rs"
|
||||
version = "0.5.0"
|
||||
version = "0.6.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bytes",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "btest-rs"
|
||||
version = "0.5.0"
|
||||
version = "0.6.0"
|
||||
edition = "2021"
|
||||
description = "MikroTik Bandwidth Test (btest) server and client with EC-SRP5 auth — a Rust reimplementation"
|
||||
license = "MIT AND Apache-2.0"
|
||||
|
||||
@@ -11,6 +11,7 @@ A Rust reimplementation of the [MikroTik Bandwidth Test (btest)](https://wiki.mi
|
||||
- **Bidirectional testing** -- simultaneous upload and download
|
||||
- **Syslog logging** -- send structured events (auth, test start/end) to a remote syslog server
|
||||
- **CSV output** -- append machine-readable test results to a CSV file
|
||||
- **CPU usage monitoring** -- local and remote CPU shown per interval, warning at >70%
|
||||
- **Timed tests** -- `--duration` flag to automatically stop after N seconds
|
||||
- **Quiet mode** -- suppress terminal output for scripted/automated use
|
||||
- **NAT traversal** -- probe packet to open firewall holes for UDP receive
|
||||
|
||||
@@ -219,6 +219,14 @@ IPv6 requires special handling on macOS:
|
||||
- NDP probe packet sent before data blast to populate neighbor cache
|
||||
- Adaptive backoff on ENOBUFS (200μs→10ms, resets on success)
|
||||
|
||||
### 11. CPU usage monitoring
|
||||
|
||||
A background OS thread samples system CPU every 1 second via:
|
||||
- **macOS:** `host_statistics(HOST_CPU_LOAD_INFO)` — returns user/system/idle/nice ticks
|
||||
- **Linux:** `/proc/stat` — reads aggregate CPU line
|
||||
|
||||
The percentage is stored in a global `AtomicU8` and included in every status message at byte 1 using MikroTik's encoding: `0x80 | percentage`. On receive, the remote CPU is decoded with `byte & 0x7F` and capped at 100%. Both local and remote CPU are displayed per interval and logged to CSV/syslog.
|
||||
|
||||
## File Layout
|
||||
|
||||
```
|
||||
@@ -232,6 +240,7 @@ btest-rs/
|
||||
│ ├── server.rs # Server mode: listener, TCP/UDP handlers
|
||||
│ ├── client.rs # Client mode: connector, TCP/UDP handlers
|
||||
│ ├── bandwidth.rs # Rate limiting, formatting, shared state
|
||||
│ ├── cpu.rs # CPU usage sampler (macOS + Linux)
|
||||
│ ├── csv_output.rs # CSV result logging (append-mode, auto-header)
|
||||
│ └── syslog_logger.rs # Remote syslog sender (RFC 3164 / BSD format)
|
||||
├── tests/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
.\" btest-rs manual page
|
||||
.\" Generated for btest-rs v0.5.0
|
||||
.\" Generated for btest-rs v0.6.0
|
||||
.TH BTEST 1 "2026-03-31" "btest-rs 0.5.0" "User Commands"
|
||||
.SH NAME
|
||||
btest \- MikroTik Bandwidth Test server and client
|
||||
|
||||
@@ -235,10 +235,11 @@ btest -c 192.168.88.1 -r -P 3000
|
||||
## Reading the Output
|
||||
|
||||
```
|
||||
[ 1] TX 264.50 Mbps (33062912 bytes)
|
||||
[ 2] TX 263.98 Mbps (32997376 bytes)
|
||||
[ 2] RX 263.98 Mbps (32997012 bytes)
|
||||
[ 3] RX 430.51 Mbps (53813376 bytes) lost: 5
|
||||
[ 1] TX 264.50 Mbps (33062912 bytes) cpu: 12%/0%
|
||||
[ 2] TX 263.98 Mbps (32997376 bytes) cpu: 15%/33%
|
||||
[ 2] RX 263.98 Mbps (32997012 bytes) cpu: 15%/33%
|
||||
[ 3] RX 430.51 Mbps (53813376 bytes) lost: 5 cpu: 18%/45%
|
||||
[ 4] RX 450.00 Mbps (56250000 bytes) cpu: 72%/85% !
|
||||
```
|
||||
|
||||
| Field | Meaning |
|
||||
@@ -249,6 +250,8 @@ btest -c 192.168.88.1 -r -P 3000
|
||||
| `Mbps` | Megabits per second |
|
||||
| `bytes` | Raw bytes transferred in this interval |
|
||||
| `lost: N` | UDP packets lost in this interval (UDP mode only) |
|
||||
| `cpu: L%/R%` | Local CPU / Remote CPU usage percentage |
|
||||
| `!` | Warning: CPU usage exceeds 70% on either side |
|
||||
|
||||
## Complete CLI Reference
|
||||
|
||||
|
||||
Reference in New Issue
Block a user