feat(activity-monitor): ディスク I/O とネットワーク I/O を追加する (ADR-0048)#59
Open
yahir0 wants to merge 2 commits into
Open
feat(activity-monitor): ディスク I/O とネットワーク I/O を追加する (ADR-0048)#59yahir0 wants to merge 2 commits into
yahir0 wants to merge 2 commits into
Conversation
`fvm dart format` を走らせたところ、近隣ファイルに format 差分があったため 合わせて適用する。`EdgeInsets.fromLTRB(...)` などの短い式が 1 行にまとめ られるのが主。アクティビティモニタへのディスク/ネットワーク I/O 追加 PR の 副作用として発生した。
ADR-0039 で CPU/メモリの 2 指標だったアクティビティモニタを 4 連ゲージに
拡張し、ディスク I/O とネットワーク I/O のシステム全体レート + 上位プロセス
一覧を表示する。
- ネイティブ (Swift)
- IOKit `IOBlockStorageDriver` 統計でディスク累積バイト (read/write) を
合計する `diskIOCounters()` を追加。
- `getifaddrs` の `if_data` でネットワーク累積バイト (in/out) を loopback
除外で合計する `networkIOCounters()` を追加。
- `getSystemMetrics` の戻り値を累積カウンタ込みに拡張。
- per-process ディスクは `proc_pid_rusage(RUSAGE_INFO_V2)` を 1 秒 2 サン
プリングして差分から rate を算出 (`diskTopProcesses`)。
- per-process ネットワークは `nettop -P -L 2 -s 1 -x -J bytes_in,bytes_out`
をサブプロセス実行して 2 サンプル差分から rate を算出
(`networkTopProcesses`)。
- `getTopProcesses` を `sortKey: cpu/memory/disk/network` で経路分岐。
- Dart 側
- `SystemMetrics` に累積カウンタを 4 つ追加。
- 新規 `SystemMetricsSnapshot` で「累積カウンタ + 計算済みレート」を保持。
- `ActivityMonitorViewModel` が前回 snapshot との差分 ÷ 経過秒で
`diskBytesPerSec` / `networkBytesPerSec` を計算 (ADR-0048 D4)。累積が
減ったケースは 0 として扱う。
- `ProcessMetrics` に `ioBytesPerSec` を追加、`ProcessSortKey` に `disk` /
`network` を追加。
- Repository の `fetchProcesses` を `ProcessSortKey` 引数付きに変更し、
ネイティブに `sortKey` を渡す。
- UI
- `ActivityMonitorBar` を 4 連ゲージ化、`_ActivityGauge` の readout 幅を
`999 MB/s` に合わせて 60px に拡張。
- 新規 `IoRateFormat` で人間可読単位 (`B/s` / `KB/s` / `MB/s` / `GB/s`)
と対数スケール (`1 KB/s → 1 GB/s` を 0–100%) を提供。
- ポップオーバーは disk/network のとき I/O 列 1 つにレイアウト切替。
- l10n
- `activityMonitorDiskTooltip` / `activityMonitorNetworkTooltip` /
`activityMonitorDiskPopoverTitle` / `activityMonitorNetworkPopoverTitle`
/ `activityMonitorColumnIo` を JA/EN に追加。
- テスト / ドキュメント
- リポジトリ・ViewModel・バー・フォーマッタにテストを追加。
- ADR-0048 と OpenSpec change (extend-activity-monitor-io) を追加。
- CLAUDE.md / docs/adr/README.md に ADR-0048 を 1 行追記。
Owner
Author
|
触ったらクラッシュするのと、デザインがそもそも微妙なので採用するかは保留する。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
トップバーのアクティビティモニタを CPU / メモリ / ディスク I/O / ネットワーク I/O の 4 連ゲージに拡張します。クリックで各指標の上位プロセス一覧をポップオーバー表示します。
設計の詳細は ADR-0048 と `openspec/changes/extend-activity-monitor-io/` を参照。
構成変更
コミット構成
Test plan
🤖 Generated with Claude Code