Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,9 @@ starry-*.log
loongarch64-axvisor-guest-tests.md

# GitHub page snapshots accidentally saved into the repo
*rcore-os_tgoskits*.html
*rcore-os_tgoskits*.html

# Resource monitor local artifacts
/logs/offline-monitor/
/images/linux-qemu/
offline-monitor-analysis*.html
15 changes: 15 additions & 0 deletions apps/starry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,21 @@ Example:
cargo xtask starry app board -t orangepi-5-plus-uvc
```

## Resource Monitor

The `resource-monitor` case provides an offline user-space collector and a static
viewer for StarryOS application experiments. It samples existing `/proc` files
into CSV/JSONL logs and replays StarryOS/Linux runs locally in the browser; it
does not add kernel counters, drivers, online telemetry, or robot workload
control.

```bash
cd apps/starry/resource-monitor/offline-viewer
python3 -m http.server 8000
```

See `resource-monitor/README.md` for the QEMU smoke test and log format.

## PicoClaw CLI

The `picoclaw-cli` case is an opt-in StarryOS x86_64 QEMU workflow for checking
Expand Down
113 changes: 113 additions & 0 deletions apps/starry/resource-monitor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# StarryOS Resource Monitor Viewer
Comment thread
Je-suis-un-chat marked this conversation as resolved.

This directory contains a small user-space helper for collecting and replaying
resource-monitoring data for StarryOS application experiments. It is intended
for offline board/QEMU debugging and demo evidence, not for cloud monitoring.

The feature has two parts:

- `system-monitor.sh`: a POSIX shell collector that samples existing `/proc`
files and writes local CSV/JSONL logs.
- `offline-viewer/index.html`: a self-contained static HTML page that imports the
logs with the browser File API and renders charts/tables without network
access.

## Scope

This is an application-layer tool for StarryOS user-space experiments. It does
not add kernel counters, drivers, NPU tracing, USB tracing, robot control logic,
or online telemetry services. When a metric is not exposed by the current OS
interface, the collector writes `NA` instead of inventing a value.

The viewer can display optional `robot_trace.csv` files when they are provided,
but this change does not include a robot test script. Precise robot/AI stage
tracing requires the application workload to emit those timing fields; this
helper only defines and visualizes the log format.

## Log Files

The viewer accepts the following files for both StarryOS and Linux baseline
runs:

- `system_metrics.csv`
- `robot_trace.csv` (optional; frame-level robot/AI trace)
- `events.jsonl`

`system_metrics.csv` includes fields such as:

```text
timestamp_ms,uptime_ms,cpu_total_pct,cpu0_pct,...,run_queue_len,ctxt_delta,irq_delta,mem_total_kib,mem_used_kib,mem_free_kib,mem_peak_kib,page_alloc_delta,page_free_delta,fs_read_delta,fs_write_delta
```

`events.jsonl` records one JSON object per line, for example monitor start/stop
or device/runtime events.

## Collect Logs

Run the collector inside the target system. If it runs on host Linux, it collects
host Linux data; if it runs inside StarryOS QEMU or a StarryOS board shell, it
collects StarryOS data.

```sh
cd apps/starry/resource-monitor
sh system-monitor.sh \
--out-dir /root/monitor \
--interval-sec 1 \
--duration-sec 60
```

Expected outputs:

```text
/root/monitor/system_metrics.csv
/root/monitor/events.jsonl
```

Export these files to the host through serial logs, SD card, USB storage, TFTP,
rootfs copy, or a local QEMU shared directory.

## Open The Offline Viewer

On the host:

```sh
cd apps/starry/resource-monitor/offline-viewer
python3 -m http.server 8000
```

Then open:

```text
http://127.0.0.1:8000/
```

The page can also be opened directly from the filesystem in browsers that allow
local file import.

## StarryOS QEMU Smoke Check
Comment thread
ZR233 marked this conversation as resolved.
Outdated

A small QEMU test case is provided under:

```text
test-suit/starryos/qemu-smp1/offline-monitor/
```

It injects the collector into the StarryOS rootfs, runs it for a short
5-second smoke interval, and prints the generated logs between markers so the
host can extract them.

```sh
cargo xtask starry test qemu --arch x86_64 -c qemu-smp1/offline-monitor
```

Use the extracted CSV/JSONL files as input to the offline viewer. On current
StarryOS branches, some `/proc` counters may be absent or partial; the collector
keeps those fields as `NA` and still validates the offline log path.

## Fair Comparisons

For a meaningful Linux vs StarryOS comparison, collect both datasets under the
same conditions: same QEMU memory size/core count or the same RK3588 board,
same sampling interval, same duration, and the same application workload. Host
Linux data should only be used for viewer smoke testing, not as a strict baseline
against StarryOS QEMU.
Loading