Skip to content

scsi, audio: activity counters a front-end can sample for device lights - #797

Open
danifunker wants to merge 2 commits into
mainfrom
core-activity-counters
Open

danifunker wants to merge 2 commits into
mainfrom
core-activity-counters

Conversation

@danifunker

Copy link
Copy Markdown
Collaborator

Adds counters a front-end can poll to draw per-device activity lights. Nothing user-visible changes yet; this is the core half, ahead of GUI work that will read them.

Disks

  • Each ScsiBus keeps per-id counters of completed reads and writes (commands and bytes). A target takes its id's counters when it is attached; ScsiDevice bumps them when a read or write completes.
  • The counters live outside the target table's lock, so ScsiBus::activity() never waits behind a disk command.
  • Workstation::disk_activity() returns them per disk bus, in the order the machine numbers its SCSI controllers (then NVMe and Fibre Channel where it has them). Implemented for the Indy/Indigo2, O2, Octane and the SN machines.

Audio

  • Device::audio_frames() reports the frames a sound card has moved (HAL2, MACE audio, RAD1, ICE1724), from the meters the cards already keep.
  • Monitor::audio_frames() sums the cards; Workstation::audio_frames() returns the total, None on a machine with no sound card.

Both counts only go up, so a front-end compares two samples.

Not included

  • No serial activity counter: the serial lines have no single place a machine can read back.
  • No monitor command and no changelog entry, since nothing is visible to a user yet. HACKING.md mentions the new hooks.

Testing

  • New tests: scsi::bus::tests::activity_counts_completed_reads_and_writes_per_id and an audio_frames check in the monitor's sound-card test.
  • Locally on macOS: the scsi:: and monitor:: unit tests pass and iris-gui type-checks. No guest was booted.

🤖 Generated with Claude Code

Each SCSI bus keeps per-id counters of completed reads and writes (commands
and bytes), outside the target table's lock, so a status poll never waits for
a disk command. A target takes its id's counters when it is attached.
Workstation::disk_activity returns them per disk bus on every machine.

Device::audio_frames reports the frames a sound card has moved; the monitor
sums the cards and Workstation::audio_frames returns the total.

Both only go up; a front-end compares two samples.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@danifunker

Copy link
Copy Markdown
Collaborator Author

This will be a prerequisite for the new GUI re-vamp

A tile's hand-over between its owner and the producer can strand a job, so
the producer waits for ever. The findings and a candidate fix are in
clanker/plans/kona-tile-handoff-race.md; the test comes back with the fix.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant