Metrics Server
Broadcast live device metrics to nearby devices over Bluetooth LE.
Overview
Metrics Server turns your device into a Bluetooth Low Energy (BLE) peripheral that broadcasts live device metrics to nearby devices running Metrics Client. Connected clients receive a continuous stream of data including CPU usage, per-core CPU activity, device identity information, and timestamps — all transmitted once per second over BLE notify characteristics.
This is useful for monitoring one device's performance from another in real time, without requiring a Wi-Fi network or any infrastructure.
Table Of Contents
- Main Sections
- Metrics Server Status Card
- Server Name And Presets
- Server Controls
- Connected Clients
- Current Metrics
- Transmitted Data
- How To Use With Metrics Client
- Technical Details
- Notes And Limitations
Main Sections
Metrics Server is a single scrolling screen with four cards:
- Metrics Server — status and server name configuration
- Server Controls — start/stop the BLE broadcast
- Connected Clients — count of subscribed devices
- Current Metrics — live preview of the data being broadcast
Metrics Server Status Card
The top card displays:
- A running indicator — a colored dot with a label:
- Running (green) — the server is actively advertising and transmitting.
- Stopped (red) — the server is not advertising.
- Server Name field — an editable text field that determines the name other devices will see during BLE discovery. See Server Name And Presets for details.
- Status — Active or Inactive.
- Bluetooth Status — the current Bluetooth radio state (Powered On, Powered Off, Unauthorized, Unsupported, Resetting, Unknown).
- Connected — the number of client devices currently subscribed to the metrics stream.
- Error — any error message from the BLE stack (only shown when an error occurs).
Server Name And Presets
The server name determines how this device appears to Metrics Client users during discovery. You can type any custom name, or use the Presets dropdown to quickly apply one of the built-in options:
| Preset | Example |
|---|---|
| Marketing name + model identifier | iPhone 16 Pro Max (iPhone17,2) |
| Marketing name only | iPhone 16 Pro Max |
| Model identifier only | iPhone17,2 |
| Device name | Rogerio's iPhone 16ProMax |
The default is Marketing name (Model identifier) when available.
Changing the name while the server is running automatically restarts BLE advertising so the new name takes effect immediately.
Server Controls
The Server Controls card contains a single Start Server / Stop Server button:
- Start Server (green) — begins BLE advertising and starts collecting CPU metrics. The server will begin transmitting data as soon as a client subscribes.
- Stop Server (red) — stops BLE advertising and halts metric collection.
A description below the button explains that the server broadcasts metrics to connected clients over Bluetooth LE.
Connected Clients
The Connected Clients card shows:
- The number of currently subscribed client devices (displayed prominently as a large number).
- When no clients are connected: a placeholder with an icon and a message to start the server and use Metrics Client on another device.
- When clients are connected: a confirmation message showing the count (e.g. "1 client is receiving metrics").
The server only transmits data when at least one client is subscribed. When no clients are connected, the internal timer is paused to conserve resources.
Current Metrics
The Current Metrics card shows a live preview of the data being broadcast:
| Field | Description |
|---|---|
| CPU Usage | The current overall CPU usage percentage of this device (e.g. 30.0%). |
| Core Count | The number of CPU cores on this device (e.g. 6). |
| Device | The user-assigned device name (e.g. "Rogerio's iPhone 16ProMax"). |
Below these fields, a Usage History line graph shows the CPU usage over time, giving a visual sense of how the workload fluctuates.
Transmitted Data
The server broadcasts two BLE notify characteristics once per second to all subscribed clients:
Summary Characteristic
Contains the following fields in a compact binary payload:
| Field | Type | Description |
|---|---|---|
| Server Name | String (up to 32 chars) | The configurable name shown in the status card. |
| Device Model | String (up to 32 chars) | The device's marketing name (e.g. "iPhone 16 Pro Max"). |
| Device Name | String (up to 32 chars) | The user-assigned device name from iOS Settings. |
| CPU Usage | Float (32-bit) | Overall CPU usage as a percentage (0–100). |
| Core Count | UInt16 | Number of CPU cores. |
| Timestamp | UInt64 | Milliseconds since Unix epoch. |
Per-Core Characteristic
Contains per-core CPU usage data:
| Field | Type | Description |
|---|---|---|
| Core Count | UInt8 | Number of cores (up to 32). |
| Core Usages | Float[] | One 32-bit float per core, representing that core's usage percentage. |
| Timestamp | UInt64 | Milliseconds since Unix epoch. |
How To Use With Metrics Client
- On the device you want to observe, open Tools > Metrics Server and tap Start Server.
- On another device, open Tools > Metrics Client.
- In the Discovery tab, find the server in the list and tap Connect.
- The client automatically switches to the Metrics tab to display live data.
Technical Details
- The server acts as a BLE Peripheral using
CBPeripheralManager. It advertises a custom GATT service with two notify-only characteristics (summary and per-core). - Data is transmitted once per second when at least one client is subscribed. The timer is paused when no clients are connected.
- All multi-byte numeric values in the payload are little-endian, as produced natively by Swift on Apple platforms.
- The server uses CoreBluetooth state restoration, allowing it to recover advertising state if the app is relaunched by the system.
- BLE backpressure is handled gracefully — if the transmit queue is full, updates are queued and drained when the system signals readiness via
peripheralManagerIsReady(toUpdateSubscribers:). - CPU metrics are sampled from the same
ToolCPUViewModelused by the CPU Monitor tool, ensuring consistent readings.
Notes And Limitations
- This tool uses Bluetooth LE, not Wi-Fi networking. Devices must be within BLE range (typically 10–30 meters indoors).
- BLE availability, background behavior, and connection stability vary by device and OS version.
- On visionOS, Metrics Server is unavailable because the BLE peripheral role is not supported.
- The server name is limited to 32 characters due to BLE payload size constraints.
- Only CPU-related metrics are currently transmitted. Other device metrics (memory, thermals, etc.) are not included in the BLE stream.