feat(menubar): 拆分紧凑双页面板并按页采样

This commit is contained in:
2026-11-08 10:42:55 +08:00
parent ac8b4a7e6a
commit 41dcc497b5
36 changed files with 465 additions and 288 deletions
+7
View File
@@ -4,6 +4,13 @@
## [Unreleased] ## [Unreleased]
### 界面与性能
- 1.1(7)面板拆为概览 / 进程两页,每次打开回到概览;两列六卡片、设备与运行时间底栏,小屏独立滚动。
- 移除 GPU 细项统计和电池耗电前三,逐核圆环改为紧凑短条,存储改为必要文本信息。
- 概览停用进程 / footprint / CPU 能量读取,进程页卸载资源图表并停用概览慢读取与公网任务;基础趋势跨页连续。
- 进程表新增 CPU 功率列(W/mW)、双向排序及测量覆盖状态,按完整身份合并,缺失值置后。
### 文档 ### 文档
- 依据当前源码重写功能说明、架构、指标口径与开发指南,集中维护测试命令和验收边界。 - 依据当前源码重写功能说明、架构、指标口径与开发指南,集中维护测试命令和验收边界。
+6 -6
View File
@@ -1,18 +1,18 @@
# Kymo # Kymo
Kymo 是 macOS 菜单栏资源监控工具。菜单栏常驻品牌图标,点击打开统一监控面板,查看资源趋势、硬件状态和进程列表。 Kymo 是 macOS 菜单栏资源监控工具。菜单栏常驻品牌图标,点击打开概览 / 进程双页面板,每次打开默认进入概览。
## 当前功能 ## 当前功能
- CPU:总占用、用户态与系统态趋势、每核占用、负载、开机时间和温度。 - CPU:总占用、用户态与系统态趋势、逐核数值与短条、温度;设备信息与开机时间位于公共底栏。
- GPU:总占用、Renderer / Tiler 活动、核心数、驱动内存统计、近期平均与峰值、温度和风扇转速。 - GPU:总占用与 Renderer / Tiler 趋势、核心数、温度和风扇转速。
- 内存:已用与总量、应用 / 联动 / 压缩分类、缓存、可用量、压力与 Swap。 - 内存:已用与总量、应用 / 联动 / 压缩分类、缓存、可用量、压力与 Swap。
- 存储:主目录所在卷容量、块设备读写速率、各本地卷容量、可读取的 SMART 寿命与通电时间。 - 存储:主目录所在卷容量、块设备读写速率、各本地卷容量、可读取的 SMART 寿命与通电时间。
- 电池:电量、功率、电源状态、健康度、循环次数、放电时间估计,以及按系统 CPU 能量差分排序的前三个进程。 - 电池:电量、功率、电源状态、健康度、循环次数、放电时间估计。
- 网络:接口切换、收发速率与累计字节、路径状态、本地和公网 IP 及复制。 - 网络:接口切换、收发速率与累计字节、路径状态、本地和公网 IP 及复制。
- 进程:PID、名称、路径、CPU、内存 footprint 和线程数;支持搜索、列排序及复制。 - 进程:PID、名称、路径、CPU、内存 footprint、CPU 平均功率和线程数;支持搜索、列排序及复制,功率缺失始终排末。
面板支持固定显示、保持唤醒、暂停 / 恢复采样。保留彩色卡片,数字、曲线、圆环和进度条随采样直接更新,不播放应用自定义动画或背景模糊特效;后台记录独立控制。面板刷新默认 2 秒;默认隐藏停止采样,可显式开启后台趋势并配置间隔(新配置 30 秒)。设置窗口提供系统 / 浅色 / 深色外观、简体中文 / 繁體中文 / English 和关于信息。 面板支持固定显示、保持唤醒、暂停 / 恢复采样。概览采用紧凑两列,小屏可滚动,极窄屏退为单列;进程页独占内容区。概览停止进程 / footprint / 功率读取,进程页卸载资源图表并停用概览慢读取与公网任务,基础趋势跨页连续。保留彩色卡片,数字、曲线和进度条随采样直接更新,不播放应用自定义动画或背景模糊特效;后台记录独立控制。面板刷新默认 2 秒;默认隐藏停止采样,可显式开启后台趋势并配置间隔(新配置 30 秒)。设置窗口提供系统 / 浅色 / 深色外观、简体中文 / 繁體中文 / English 和关于信息。
部分硬件指标依赖机型、驱动与权限,缺失值显示为 `--` 或对应状态。GPU 不提供逐核占用;耗电进程显示系统归属的 CPU 能量区间平均功率,注明可读覆盖范围,不代表完整应用总耗电。指标口径和限制见[监控指标](docs/monitoring.md)。 部分硬件指标依赖机型、驱动与权限,缺失值显示为 `--` 或对应状态。GPU 不提供逐核占用;耗电进程显示系统归属的 CPU 能量区间平均功率,注明可读覆盖范围,不代表完整应用总耗电。指标口径和限制见[监控指标](docs/monitoring.md)。
+9 -5
View File
@@ -23,7 +23,7 @@
入口为 `kymoApp.main()`,由 `NSApplication` 与 `ApplicationLifecycle` 驱动,当前不使用 `MenuBarExtra`。应用以 accessory 模式启动,通过 `NSHostingSceneRepresentation` 注册 Settings 场景。 入口为 `kymoApp.main()`,由 `NSApplication` 与 `ApplicationLifecycle` 驱动,当前不使用 `MenuBarExtra`。应用以 accessory 模式启动,通过 `NSHostingSceneRepresentation` 注册 Settings 场景。
`MenuPanelController` 拥有模板品牌状态项和无边框、可成为 key 的非激活 `MonitoringPanel`。左键切换面板;右键菜单提供打开 / 隐藏、设置和退出。面板不播放开关窗动画、不添加装饰阴影。窗口按状态项所在屏幕可见区域定位,水平居中、顶部预留 16pt;最大内容尺寸 1240 × 820pt,并按屏幕缩小。卡片随宽度采用 1 / 2 / 3 列,资源区空间不足时滚动,进程区保留最小高度。 `MenuPanelController` 拥有模板品牌状态项和无边框、可成为 key 的非激活 `MonitoringPanel`。左键切换面板;右键菜单提供打开 / 隐藏、设置和退出。面板不播放开关窗动画、不添加装饰阴影。窗口按状态项所在屏幕可见区域定位,水平居中、顶部预留 16pt;最大内容尺寸 960 × 800pt,并按屏幕缩小。面板顶部为概览 / 进程页签,每次显式打开重置概览。常规概览两列,CPU / 电池、GPU / 存储、内存 / 网络逐行配对;宽度小于 680pt 时退为单列,高度不足时滚动。进程页独占中间内容区。底栏显示设备及运行时间。
固定按钮切换普通 / floating 层级。未固定时外部交互或应用失活可收起,固定时仍可通过状态项或显式关闭收起。进程表的 Esc 依次处理搜索、选中和搜索焦点,随后关闭窗口。隐藏面板时先卸载内容视图、关闭底层窗口资源(保留控制器拥有的窗口对象供重开),并停止监听外部鼠标事件;仅显式启用后台趋势时保留常规采样。 固定按钮切换普通 / floating 层级。未固定时外部交互或应用失活可收起,固定时仍可通过状态项或显式关闭收起。进程表的 Esc 依次处理搜索、选中和搜索焦点,随后关闭窗口。隐藏面板时先卸载内容视图、关闭底层窗口资源(保留控制器拥有的窗口对象供重开),并停止监听外部鼠标事件;仅显式启用后台趋势时保留常规采样。
@@ -38,7 +38,7 @@
└─ 可见时进程任务 MetricsStore(MainActor) └─ 可见时进程任务 MetricsStore(MainActor)
├─ snapshot → 资源卡片 ├─ snapshot → 资源卡片
├─ processSnapshot → 进程表 ├─ processSnapshot → 进程表
├─ energy → 耗电进程区 ├─ energy → 进程表 CPU 功率列
└─ MetricHistory → 趋势图 └─ MetricHistory → 趋势图
面板实际可见性 / 系统和显示器睡眠 / SamplingPreferences ──────────→ 调度切换 面板实际可见性 / 系统和显示器睡眠 / SamplingPreferences ──────────→ 调度切换
SMARTService(XPC)──→ 温度 / 风扇 / SMART 客户端 ──→ 慢任务缓存 SMARTService(XPC)──→ 温度 / 风扇 / SMART 客户端 ──→ 慢任务缓存
@@ -48,7 +48,7 @@ SMARTService(XPC)──→ 温度 / 风扇 / SMART 客户端 ──→ 慢
`SystemSampler` actor 持有 CPU、网络、磁盘 IO 差分基线。CPU / 内存每次 Mach 查询取得的 host 发送权在调用结束(含失败路径)释放。卷列表与进程读取放入 utility detached Task;温度、磁盘健康、电池健康独立更新缓存,各类慢任务最多一个在途;隐藏后台趋势不新发起传感器、卷或慢报告读取。慢指标可晚于快照更新,周期详见[监控指标](monitoring.md)。 `SystemSampler` actor 持有 CPU、网络、磁盘 IO 差分基线。CPU / 内存每次 Mach 查询取得的 host 发送权在调用结束(含失败路径)释放。卷列表与进程读取放入 utility detached Task;温度、磁盘健康、电池健康独立更新缓存,各类慢任务最多一个在途;隐藏后台趋势不新发起传感器、卷或慢报告读取。慢指标可晚于快照更新,周期详见[监控指标](monitoring.md)。
进程只在面板可见且未暂停时读取。进程结果可异步单独发布到 processSnapshot,资源 snapshot 的 processes 保持 nil;能耗独立发布到 energy。进程与能耗区以独立 View 订阅,避免异步进程发布再次使整个资源区失效。可见性代次和调度代次阻止过期结果回写;隐藏时清除已发布进程,重新打开重建基线。同步系统调用即使不能及时取消,也会占用原在途槽,避免重叠读取。路径按完整身份与命令名缓存 30 秒(包含失败结果),每轮复用一个路径缓冲;枚举失败清空缓存,末次身份复核保留。进程退出提示以原始成功快照中的完整身份为准,搜索过滤和枚举失败不作为退出证据。 进程只在请求进程详情、面板可见且未暂停时读取。App 将 Features 的 PanelPage 转为 Core 的 setDetailDemand(processes:slowMetrics:) 开关;Core 不引用页面类型。概览不枚举进程、不读取 footprint 或 CPU 能量;进程页不发起温度 / 风扇、卷和慢报告读取。已开始的慢报告可能自行结束并更新缓存。两页维持基础系统采样与有界历史,切页不重置 CPU / 网络 / IO 基线、不制造历史断点。进程结果可异步单独发布到 processSnapshot,资源 snapshot 的 processes 保持 nil;能耗独立发布到 energy。进程及能量由独立进程页订阅。只装配当前页;轻量搜索 / 排序 / 选择状态由父层持有,切页卸载原生表格或卡片宿主,显式关闭则释放这些交互状态。可见性代次和调度代次阻止过期结果回写;隐藏时清除已发布进程,重新打开重建基线。同步系统调用即使不能及时取消,也会占用原在途槽,避免重叠读取。路径按完整身份与命令名缓存 30 秒(包含失败结果),每轮复用一个路径缓冲;枚举失败清空缓存,末次身份复核保留。进程退出提示以原始成功快照中的完整身份为准,搜索过滤和枚举失败不作为退出证据。
暂停取消采样发布、停用进程更新,保留当前快照和历史;已启动慢读取可能自行结束。恢复时重置 CPU / 网络 / IO 基线,历史标记断点。全局及每接口历史各最多 60 点,接口移除时清理其历史;实际覆盖时长由采样间隔决定。每点的 expectedInterval 表示其后等待下一点的计划周期;需求连续的重新调度将最长周期记入最近点,即使短暂隐藏未到后台采样截止也不丢失慢周期。下一点重新使用当前配置。图表和 GPU 平均统计只用左端点周期判断当前段,避免反向放宽旧空档,详见[后台趋势修复](background-trend-continuity-fix.md)。绘图按序列跳过无值节点并连接有效点,保留原时间轴和有效 0;显式停采断点、过长采样空档与倒序仍断线,空值点携带的断点也必须检查。原历史保留 nil,悬浮缺失值仍显示 --、无测量点标记;GPU 平均统计继续排除缺失区间。详见[无值点绘图规则](chart-missing-value-policy.md)。 暂停取消采样发布、停用进程更新,保留当前快照和历史;已启动慢读取可能自行结束。恢复时重置 CPU / 网络 / IO 基线,历史标记断点。全局及每接口历史各最多 60 点,接口移除时清理其历史;实际覆盖时长由采样间隔决定。每点的 expectedInterval 表示其后等待下一点的计划周期;需求连续的重新调度将最长周期记入最近点,即使短暂隐藏未到后台采样截止也不丢失慢周期。下一点重新使用当前配置。图表和 GPU 平均统计只用左端点周期判断当前段,避免反向放宽旧空档,详见[后台趋势修复](background-trend-continuity-fix.md)。绘图按序列跳过无值节点并连接有效点,保留原时间轴和有效 0;显式停采断点、过长采样空档与倒序仍断线,空值点携带的断点也必须检查。原历史保留 nil,悬浮缺失值仍显示 --、无测量点标记;GPU 平均统计继续排除缺失区间。详见[无值点绘图规则](chart-missing-value-policy.md)。
@@ -60,7 +60,7 @@ SMARTService(XPC)──→ 温度 / 风扇 / SMART 客户端 ──→ 慢
CPU / GPU / 风扇合并为一次只读 XPC 请求,按到期类别选择读取;服务进程共享 actor 隔离的传感器发现缓存。各类别成功后至少 10 秒再读,失败独立按 60 / 120 / 240 / 480 / 600 秒退避,其他类别成功不重置失败退避。服务重启后重新发现;不声称缓存跨服务进程退出保留。 CPU / GPU / 风扇合并为一次只读 XPC 请求,按到期类别选择读取;服务进程共享 actor 隔离的传感器发现缓存。各类别成功后至少 10 秒再读,失败独立按 60 / 120 / 240 / 480 / 600 秒退避,其他类别成功不重置失败退避。服务重启后重新发现;不声称缓存跨服务进程退出保留。
公网 IP 由 `PublicIPAddressService` 在面板网络任务中访问外部 HTTPS 服务,和本地接口采样分开。任务可见时持续刷新:成功缓存 600 秒,失败 30 秒后重试,超时 5 秒;有效期使用单调时间。路由键变化、暂停或面板隐藏取消旧任务的请求及等待,取消结果不缓存、不发布。保持唤醒通过两个进程级 IOPM 断言阻止用户空闲息屏与系统空闲睡眠,开关不持久化,失败时释放已取得断言,关闭或退出时释放。 公网 IP 由 `PublicIPAddressService` 在面板网络任务中访问外部 HTTPS 服务,和本地接口采样分开。任务仅概览挂载且实际可见时持续刷新:成功缓存 600 秒,失败 30 秒后重试,超时 5 秒;有效期使用单调时间。路由键变化、暂停或面板隐藏取消旧任务的请求及等待,取消结果不缓存、不发布。保持唤醒通过两个进程级 IOPM 断言阻止用户空闲息屏与系统空闲睡眠,开关不持久化,失败时释放已取得断言,关闭或退出时释放。
## 状态与资源 ## 状态与资源
@@ -86,7 +86,7 @@ Store 将递增需求代次交给 SystemSampler;actor 在开始系统调用前
一次成功进程枚举的全部已识别行进入 ProcessEnergyServiceClient,不按 CPU 预筛选。签名认证 XPC 每批最多 256 项 / 请求 64 KiB,总客户端截止 3 秒、每请求最多 1.5 秒;服务串行读取(忙时拒绝),每批截止 1 秒。服务限制同 UID,读取前后复核 PID + 启动时间,返回原请求 UUID、Mach 启动标记、单调时间及 UInt64 能量。客户端复核 UUID、身份集合与响应大小。受限或超时部分明确反映为覆盖不全。 一次成功进程枚举的全部已识别行进入 ProcessEnergyServiceClient,不按 CPU 预筛选。签名认证 XPC 每批最多 256 项 / 请求 64 KiB,总客户端截止 3 秒、每请求最多 1.5 秒;服务串行读取(忙时拒绝),每批截止 1 秒。服务限制同 UID,读取前后复核 PID + 启动时间,返回原请求 UUID、Mach 启动标记、单调时间及 UInt64 能量。客户端复核 UUID、身份集合与响应大小。受限或超时部分明确反映为覆盖不全。
ProcessEnergyMonitor 在相同身份、Mach 启动标记和连续有效计数间,以整数先相减再转浮点,得到 nJ / 秒 / 1e9 的 W;保留最大三项,不添加 CPU 代理。失败、缺失、计数回退、重建需求均使旧基线失效。普通间隔最长允许 30 秒差分;用户设置长采样间隔时放宽至两倍前台间隔、上限 3600 秒,并显示实际窗口。详情见监控口径。 ProcessEnergyMonitor 在相同身份、Mach 启动标记和连续有效计数间,以整数先相减再转浮点,得到 nJ / 秒 / 1e9 的 W;保留全部有效测量,不添加 CPU 代理。进程页将其按完整 ProcessIdentity 合并到当前列表,显示 CPU 功率 W/mW 与实际统计窗口,支持双向排序;缺失值显示 -- 且两方向均排末。覆盖数、等待、不支持及不可用状态在表头下方展示。失败、缺失、计数回退、重建需求均使旧基线失效。普通间隔最长允许 30 秒差分;用户设置长采样间隔时放宽至两倍前台间隔、上限 3600 秒,并显示实际窗口。详情见监控口径。
网络展示和诊断文字窗口共用 PanelPublicIPRefresh,遵循同一可见 / 暂停 / 睡眠与缓存策略。出口键仍包含全部活动地址,L07 尚待修正。外观观察器在挂载后延迟初始化,避免每次 View 值构造就创建 KVO / 通知订阅者。 网络展示和诊断文字窗口共用 PanelPublicIPRefresh,遵循同一可见 / 暂停 / 睡眠与缓存策略。出口键仍包含全部活动地址,L07 尚待修正。外观观察器在挂载后延迟初始化,避免每次 View 值构造就创建 KVO / 通知订阅者。
@@ -103,3 +103,7 @@ PublicIPAddressService 默认持有专用 ephemeral URLSession,URLCache / HTTP
## Release 包安全约束 ## Release 包安全约束
主应用的 Release 与 SMARTService 均启用 Hardened Runtime;主应用既有沙盒 / 出站网络 / 用户选中文件只读权限未扩大。免费测试打包使用本地 ad-hoc 签名,无 Developer ID 身份 / 公证;认证仍由实际嵌入的双方 designated requirement 派生,必须保持 app 与 XPC 配对。打包工具仅在 tools/,不参与产品运行、不新增启动任务或数据写入路径。验收和分发边界见[Release 记录](release-readiness.md)。 主应用的 Release 与 SMARTService 均启用 Hardened Runtime;主应用既有沙盒 / 出站网络 / 用户选中文件只读权限未扩大。免费测试打包使用本地 ad-hoc 签名,无 Developer ID 身份 / 公证;认证仍由实际嵌入的双方 designated requirement 派生,必须保持 app 与 XPC 配对。打包工具仅在 tools/,不参与产品运行、不新增启动任务或数据写入路径。验收和分发边界见[Release 记录](release-readiness.md)。
## 紧凑双页展示
CPU 逐核显示使用数值与静态短条,内存保留分布条;GPU 渲染器 / 分块器独立进度条和统计区、电池内的耗电前三列表已移除,存储重复容量条改为可用容量 / 健康 / 通电时长 / 卷入口文本。六张趋势保留既有真实时间及断点规则。页面布局和数据需求详见[实施记录](compact-tab-panel-plan.md)。
+6 -4
View File
@@ -25,9 +25,9 @@
## 分阶段实施 ## 分阶段实施
- [x] 检查工作区、文档与调用链,建立方案;起始工作区和暂存区干净。 - [x] 检查工作区、文档与调用链,建立方案;起始工作区和暂存区干净。
- [ ] 第一阶段:按页采样需求、全部功率结果及身份合并 / 排序,补充边界检查。 - [x] 第一阶段:按页采样需求、全部功率结果及身份合并 / 排序,补充边界检查。
- [ ] 第二阶段:紧凑页签界面、逐核条格、独立进程页及三语资源,同步架构与口径。 - [x] 第二阶段:紧凑页签界面、逐核条格、独立进程页及三语资源,同步架构与口径。
- [ ] 第三阶段:构建、独立检查、原生实际面板交互与局部截图;修复发现的问题。 - [x] 第三阶段:构建、独立检查、原生实际面板交互与局部截图;修复发现的问题。
- [ ] 第四阶段:同机对照原面板 / 新概览 / 新进程页 CPU、CPU 归属功率、footprint 和唤醒,主程序与 XPC 分列,记录方法和限制;清理临时产物、分批提交,不推送。 - [ ] 第四阶段:同机对照原面板 / 新概览 / 新进程页 CPU、CPU 归属功率、footprint 和唤醒,主程序与 XPC 分列,记录方法和限制;清理临时产物、分批提交,不推送。
## 验证与风险 ## 验证与风险
@@ -40,4 +40,6 @@
## 实施记录 ## 实施记录
待补充实际变更与验证结果。 已完成双页、按页需求、完整功率列及相关回归。首次实际截图发现 CPU 核心区越界和存储详情裁切,已增加 CPU 基础行高至 220pt,并去除存储重复容量条,改成必要文本信息。完整构建、交互和测量结果待补。
阶段验收:Debug 构建通过;38 项独立 Swift 检查均已通过(完整批次前 36 项与窗口 / 网络的单独重跑合计),三语目录 212 项通过;窗口测试补上实际 viewport 检查,并在 accessory 测试宿主显式 orderFrontRegardless 后核对可见性。CUA 实际验证了页签、功率双向排序、搜索 / 切页保留搜索、Esc 清除搜索、暂停恢复,检查了浅色中文 960×800、深色英文 760×600 与 640×600 布局及拖动滚动条到底部。滚轮路径未确认,真实菜单栏点击 / 多显示器与主观体验仍待用户验收。既有本地 build 6 ZIP 保留,新测试包使用 1.1(7);签名 / 权限 / ZIP 解压复核通过。
+3 -3
View File
@@ -2,7 +2,7 @@
## 适用范围 ## 适用范围
当前产物:Kymo 1.1(build 5),macOS 27.0 及以上、Apple silicon arm64。Intel 或较低系统不在该产物支持范围。软件使用 ad-hoc 本地签名,未经过 Apple 公证,不是 Developer ID 官方分发包;下载后的系统提示取决于接收方安全策略。 当前产物:Kymo 1.1(build 7),macOS 27.0 及以上、Apple silicon arm64。Intel 或较低系统不在该产物支持范围。软件使用 ad-hoc 本地签名,未经过 Apple 公证,不是 Developer ID 官方分发包;下载后的系统提示取决于接收方安全策略。
## 构建与校验 ## 构建与校验
@@ -10,10 +10,10 @@
python3 tools/package_release.py python3 tools/package_release.py
``` ```
默认输出:`dist/kymo-1.1-5-arm64-adhoc.zip` 和同名 `.sha256`。首次打包前会通过签名、Hardened Runtime、权限和包内容检查,ZIP 解压后再次检查。再次构建不覆盖已存在同名产物,可用 `--output` 另选目录。校验下载文件: 默认输出:`dist/kymo-1.1-7-arm64-adhoc.zip` 和同名 `.sha256`。首次打包前会通过签名、Hardened Runtime、权限和包内容检查,ZIP 解压后再次检查。再次构建不覆盖已存在同名产物,可用 `--output` 另选目录。校验下载文件:
```bash ```bash
shasum -a 256 -c kymo-1.1-5-arm64-adhoc.zip.sha256 shasum -a 256 -c kymo-1.1-7-arm64-adhoc.zip.sha256
``` ```
SHA-256 用于核对文件是否与发布者给出的文件一致,不等同于 Apple 身份认证;校验值应从可信渠道获取。 SHA-256 用于核对文件是否与发布者给出的文件一致,不等同于 Apple 身份认证;校验值应从可信渠道获取。
+12 -8
View File
@@ -10,7 +10,7 @@
| --- | --- | --- | | --- | --- | --- |
| CPU | `CPUMonitor`,Mach `host_processor_info` | 总量、用户态、系统态及逻辑核占用由 tick 差分计算;首帧建立基线 | | CPU | `CPUMonitor`,Mach `host_processor_info` | 总量、用户态、系统态及逻辑核占用由 tick 差分计算;首帧建立基线 |
| CPU 核型 | `CPUCoreTopology`,IORegistry `IODeviceTree:/cpus` | 核心分组取决于系统拓扑信息,不将不可识别核型强行归类 | | CPU 核型 | `CPUCoreTopology`,IORegistry `IODeviceTree:/cpus` | 核心分组取决于系统拓扑信息,不将不可识别核型强行归类 |
| 负载 / 开机时间 | `getloadavg` / `systemUptime` | 快照保留 1 / 5 / 15 分钟负载,CPU 卡片展示 1 分钟值与逻辑核数;负载不是 CPU 百分比 | | 负载 / 开机时间 | `getloadavg` / `systemUptime` | 快照保留 1 / 5 / 15 分钟负载,底栏展示开机时间,CPU 卡片不再重复展示负载;负载不是 CPU 百分比 |
| GPU | `GPUMonitor`,IOAccelerator `PerformanceStatistics` | 读取 Device / Renderer / Tiler Utilization、核心数、In use / Alloc system memory;只接受单设备结果,多 GPU 不合并 | | GPU | `GPUMonitor`,IOAccelerator `PerformanceStatistics` | 读取 Device / Renderer / Tiler Utilization、核心数、In use / Alloc system memory;只接受单设备结果,多 GPU 不合并 |
| 温度 | `CPUTemperatureMonitor`,XPC 中只读 AppleSMC | CPU 选 Tp / Te 区、GPU 选 Tg 区的有效浮点温度最高值;不是官方封装温度,接受 0–150°C 开区间,CPU ≥90°C 提示高温 | | 温度 | `CPUTemperatureMonitor`,XPC 中只读 AppleSMC | CPU 选 Tp / Te 区、GPU 选 Tg 区的有效浮点温度最高值;不是官方封装温度,接受 0–150°C 开区间,CPU ≥90°C 提示高温 |
| 风扇 | 同上,FNum、F0Ac…F9Ac | 最多 10 个,支持 flt / fpe2 / ui8 解码;零转速有效,单风扇不可读保持缺失,无风扇返回空数组 | | 风扇 | 同上,FNum、F0Ac…F9Ac | 最多 10 个,支持 flt / fpe2 / ui8 解码;零转速有效,单风扇不可读保持缺失,无风扇返回空数组 |
@@ -30,9 +30,9 @@
## 需要明确区分的指标 ## 需要明确区分的指标
- GPU Renderer / Tiler 是活动阶段指标,可能重叠,不能相加成为总占用。GPU 核心数不代表逐核计数;目前没有独立逐核 GPU 占用。 - GPU Renderer / Tiler 是活动阶段指标,可能重叠,不能相加成为总占用。GPU 核心数不代表逐核计数;目前没有独立逐核 GPU 占用。
- GPU 驱动内存不是独立显存容量,也不是可计算占比的统一内存上限。平均值为最近 60 秒窗口内有效连续区间的时间加权平均,峰值取窗口内可用样本;历史不足时统计覆盖时间更短,不能视为完整一分钟。 - GPU 驱动内存不是独立显存容量,也不是可计算占比的统一内存上限。近期统计模型仍保留最近 60 秒有效区间的加权平均与峰值算法,当前概览不再展示这些统计或驱动内存。
- 网络“全部”仅汇总 active 且名称以 `en` 开头的接口,避免物理链路与 `utun` 双计。接口选择仍可查看其他活动接口;这个规则不等于所有设备和隧道的通用流量归因。 - 网络“全部”仅汇总 active 且名称以 `en` 开头的接口,避免物理链路与 `utun` 双计。接口选择仍可查看其他活动接口;这个规则不等于所有设备和隧道的通用流量归因。
- 进程 CPU 以一个逻辑核满载为 100%,多线程可超过 100%,不能直接与整机 CPU 百分比比较。首次进程采样没有差分值;耗电区已改为独立 CPU 能量计数差分,不能将进程 CPU 百分比当成耗电。 - 进程 CPU 以一个逻辑核满载为 100%,多线程可超过 100%,不能直接与整机 CPU 百分比比较。首次进程采样没有差分值;功率列使用独立 CPU 能量计数差分,不能将进程 CPU 百分比当成耗电。
- 电池模型可计算充电 / 放电时间,但当前卡片仅在非外接电源时显示剩余时间,外接电源显示不适用。系统未给出有效估计时显示未知。 - 电池模型可计算充电 / 放电时间,但当前卡片仅在非外接电源时显示剩余时间,外接电源显示不适用。系统未给出有效估计时显示未知。
## 采样与缓存周期 ## 采样与缓存周期
@@ -40,15 +40,15 @@
| 数据 | 默认 / 周期策略 | | 数据 | 默认 / 周期策略 |
| --- | --- | | --- | --- |
| 常规资源快照 | 面板可见默认 2000ms;新配置隐藏默认停止采样,显式启用后台趋势后默认 30000ms;已有合法后台间隔保留启用和原值,显式开关优先;可设 500–1,800,000ms,步进 100ms | | 常规资源快照 | 面板可见默认 2000ms;新配置隐藏默认停止采样,显式启用后台趋势后默认 30000ms;已有合法后台间隔保留启用和原值,显式开关优先;可设 500–1,800,000ms,步进 100ms |
| 进程 | 面板实际可见且未暂停 / 睡眠时随采样请求更新;异步独立发布,最多一个在途 | | 进程 | 请求进程详情且面板实际可见、未暂停 / 睡眠时随采样请求更新;异步独立发布,最多一个在途 |
| 进程 CPU 能量 | 复用同轮进程候选,成功后至少 5 秒再读(默认 2 秒轮次下通常约 6 秒);失败 30–600 秒退避,明确不支持后 600 秒;最多一批在途 | | 进程 CPU 能量 | 复用同轮进程候选,成功后至少 5 秒再读(默认 2 秒轮次下通常约 6 秒);失败 30–600 秒退避,明确不支持后 600 秒;最多一批在途 |
| CPU / GPU 温度、风扇 | 一次批量请求中只读取到期类别;各类别成功后至少 10 秒再读,失败独立退避 60–600 秒 | | CPU / GPU 温度、风扇 | 一次批量请求中只读取到期类别;各类别成功后至少 10 秒再读,失败独立退避 60–600 秒 |
| 卷列表 | 读取结束后至少 30 秒 | | 卷列表 | 读取结束后至少 30 秒 |
| SMART / 电池健康 | 成功后至少 3600 秒;失败后至少 600 秒 | | SMART / 电池健康 | 成功后至少 3600 秒;失败后至少 600 秒 |
| 公网 IP | 同一路由键成功缓存 600 秒,失败缓存 30 秒,请求超时 5 秒;面板可见时按缓存到期持续刷新,路由键变化、暂停或面板隐藏取消请求及等待,取消不缓存;有效期使用单调时间 | | 公网 IP | 同一路由键成功缓存 600 秒,失败缓存 30 秒,请求超时 5 秒;概览可见时按缓存到期持续刷新,路由键变化、暂停或面板隐藏取消请求及等待,取消不缓存;有效期使用单调时间 |
| 趋势 | 全局与每接口最多各 60 点,仅内存保存 | | 趋势 | 全局与每接口最多各 60 点,仅内存保存 |
传感器、卷与慢报告只在可见采样轮次检查是否到期;后台趋势不启动这些慢读取。快照中的慢指标可能来自之前的缓存;磁盘 / 电池健康快照带读取日期。暂停停止发布,不保证取消已进入系统调用的工作。 传感器、卷与慢报告只在请求概览慢指标的可见采样轮次检查是否到期;后台趋势不启动这些慢读取。快照中的慢指标可能来自之前的缓存;磁盘 / 电池健康快照带读取日期。暂停停止发布,不保证取消已进入系统调用的工作。
常规周期允许系统在配置周期 10% 的容差内合并唤醒,前台最多 200ms、后台最多 1 秒;不是严格实时截止。差分的时间分母始终取实际经过的单调时间,历史保留真实采样日期,配置周期不被改写。 常规周期允许系统在配置周期 10% 的容差内合并唤醒,前台最多 200ms、后台最多 1 秒;不是严格实时截止。差分的时间分母始终取实际经过的单调时间,历史保留真实采样日期,配置周期不被改写。
@@ -62,9 +62,9 @@ AppleSMC 和 GPU 驱动字段不是稳定公开的跨机型指标接口,缺失
读取 `proc_pid_rusage(RUSAGE_INFO_V6).ri_energy_nj`,显示相邻有效计数的平均功率 mW / W 和实际窗口。服务 arm64 自身计数非零时才返回 verifiedCPU;其他架构返回 unsupported,未确认能力时不提供零瓦或 CPU 排名。当前 M4 Pro 实测受控 CPU 工作使计数增长,并通过正式签名沙盒主程序 → XPC 取得同 UID 其他进程的有效差分。 读取 `proc_pid_rusage(RUSAGE_INFO_V6).ri_energy_nj`,显示相邻有效计数的平均功率 mW / W 和实际窗口。服务 arm64 自身计数非零时才返回 verifiedCPU;其他架构返回 unsupported,未确认能力时不提供零瓦或 CPU 排名。当前 M4 Pro 实测受控 CPU 工作使计数增长,并通过正式签名沙盒主程序 → XPC 取得同 UID 其他进程的有效差分。
该口径是系统归属的 CPU 能量,参考 [Apple XNU task.c](https://github.com/apple-oss-distributions/xnu/blob/main/osfmk/kern/task.c) 和 [recount.c](https://github.com/apple-oss-distributions/xnu/blob/main/osfmk/kern/recount.c);开源主线不保证与目标系统二进制完全一致。它不含完整 GPU / 屏幕 / 网络 / 整机功耗,不聚合应用子进程,不等于活动监视器 Energy Impact。条形图相对当前列表最大值,不能理解为整机耗电百分比。 该口径是系统归属的 CPU 能量,参考 [Apple XNU task.c](https://github.com/apple-oss-distributions/xnu/blob/main/osfmk/kern/task.c) 和 [recount.c](https://github.com/apple-oss-distributions/xnu/blob/main/osfmk/kern/recount.c);开源主线不保证与目标系统二进制完全一致。它不含完整 GPU / 屏幕 / 网络 / 整机功耗,不聚合应用子进程,不等于活动监视器 Energy Impact。进程表以 W/mW 显示 CPU 平均功率,列头可切换升降序;缺失值显示 -- 并始终排末。悬浮功率单元格可查看实际统计窗口。
按全部可测候选的有效能量差分排名。权限受限、进程退出和截止会降低覆盖率;UI 显示已形成差分数 / 枚举总数,首帧等待,失败或不支持明确显示状态。零增量只有连续两帧有效时才代表 0 W。身份变化、计数回退、无效时间和超过允许窗口均不形成排名。超大进程集合在总截止下可能只覆盖部分批次,尚未验证极端规模下的公平轮转。 按全部可测候选的有效能量差分排名。权限受限、进程退出和截止会降低覆盖率;进程页显示已形成差分数 / 枚举总数,首帧等待,失败或不支持明确显示状态。零增量只有连续两帧有效时才代表 0 W。身份变化、计数回退、无效时间和超过允许窗口均不形成排名。超大进程集合在总截止下可能只覆盖部分批次,尚未验证极端规模下的公平轮转。
进程 CPU 的 `pti_total_user` / `pti_total_system` 是 task absolute CPU 时间:累计值先做整数差分,经本机 `mach_timebase_info` 转为纳秒,再除以单调时钟间隔;单逻辑核满载为 100%,多线程可超过 100%。不按整机核心数再平均。曾直接按纳秒解释这些计数,在本轮 M4 Pro(125/3 timebase)上少报约 41.67 倍;受控 200 ms CPU 对照已复现,修复另有实际工作量回归。独立资源采集器此前已正确使用 timebase;真实 CPU 能量 nJ 差分不受此问题影响。 进程 CPU 的 `pti_total_user` / `pti_total_system` 是 task absolute CPU 时间:累计值先做整数差分,经本机 `mach_timebase_info` 转为纳秒,再除以单调时钟间隔;单逻辑核满载为 100%,多线程可超过 100%。不按整机核心数再平均。曾直接按纳秒解释这些计数,在本轮 M4 Pro(125/3 timebase)上少报约 41.67 倍;受控 200 ms CPU 对照已复现,修复另有实际工作量回归。独立资源采集器此前已正确使用 timebase;真实 CPU 能量 nJ 差分不受此问题影响。
@@ -75,3 +75,7 @@ AppleSMC 和 GPU 驱动字段不是稳定公开的跨机型指标接口,缺失
沙盒主程序不能直接取得其他进程 rusage,因此通过原有签名认证只读 XPC、按完整 ProcessIdentity 请求同 UID footprint。数据合并在单在途进程任务结束前完成;读取失败显示 --,不回退 RSS 或沿用旧值。保护进程 / 其他 UID 可能不可读,辅助进程独立统计。刷新时刻不同仍允许短时波动。来源核对与边界见[修正记录](process-memory-alignment-plan.md)。系统总内存卡片口径不变。 沙盒主程序不能直接取得其他进程 rusage,因此通过原有签名认证只读 XPC、按完整 ProcessIdentity 请求同 UID footprint。数据合并在单在途进程任务结束前完成;读取失败显示 --,不回退 RSS 或沿用旧值。保护进程 / 其他 UID 可能不可读,辅助进程独立统计。刷新时刻不同仍允许短时波动。来源核对与边界见[修正记录](process-memory-alignment-plan.md)。系统总内存卡片口径不变。
公网 IP 网络会话使用 ephemeral 配置并关闭 URLCache、Cookie 与凭据存储;已有 600 秒 / 30 秒缓存是进程内数据,不写磁盘。签名沙盒网络检查直接调用生产服务,核对重复 / 新路由 HTTPS 查询后持久网络目录未新增或变更文件。 公网 IP 网络会话使用 ephemeral 配置并关闭 URLCache、Cookie 与凭据存储;已有 600 秒 / 30 秒缓存是进程内数据,不写磁盘。签名沙盒网络检查直接调用生产服务,核对重复 / 新路由 HTTPS 查询后持久网络目录未新增或变更文件。
## 页面采样需求
概览只采集系统资源,不进行进程枚举、footprint 或进程 CPU 能量读取。进入进程页才启用这些读取并重新建立进程差分基线;功率至少需要两次有效读取,现有成功间隔下限 5 秒不变。离开即清除已发布进程 / 能量并拒绝旧代次回写。进程页保留基础资源采样以延续趋势,但不发起概览慢传感器 / 报告或公网 IP 请求;已开始的慢读取可自行结束。基础采样间隔、后台趋势开关、暂停与睡眠规则保持独立。
+8 -2
View File
@@ -33,9 +33,9 @@ xcodebuild -project kymo.xcodeproj -scheme kymo -configuration Debug build
按改动选择以下验收项: 按改动选择以下验收项:
- 菜单栏:左键打开 / 收起,右键快捷菜单,打开设置与退出。 - 菜单栏:左键打开 / 收起,右键快捷菜单,打开设置与退出。
- 面板:屏幕区域约束、1 / 2 / 3 列、资源区和进程表滚动、图表悬浮、缺失值展示。 - 面板:屏幕区域约束、紧凑两列 / 窄屏单列、概览和进程页独立滚动、关闭重开默认概览、图表悬浮、缺失值展示。
- 生命周期:外部点击、固定 / 取消固定、Esc 分层处理、设置焦点 / 最小化恢复及 Dock 显隐。 - 生命周期:外部点击、固定 / 取消固定、Esc 分层处理、设置焦点 / 最小化恢复及 Dock 显隐。
- 采样:前后台间隔切换、暂停 / 恢复、隐藏后停止进程采样、重开后重建基线与异步列表发布。 - 采样:前后台间隔切换、暂停 / 恢复、概览 / 隐藏后停止进程采样、进程页重建进程基线与异步列表发布、切页不打断基础趋势。
- 数据:实际签名沙盒应用的 GPU、温度 / 风扇、SMART、电池与网络读数,分别核对来源、单位和不可用状态。 - 数据:实际签名沙盒应用的 GPU、温度 / 风扇、SMART、电池与网络读数,分别核对来源、单位和不可用状态。
- 语言 / 外观:三语即时切换、重启持久化、浅深色和系统跟随、文本截断与复制。 - 语言 / 外观:三语即时切换、重启持久化、浅深色和系统跟随、文本截断与复制。
- 保持唤醒:断言开关及退出释放;真实空闲息屏行为另验收。 - 保持唤醒:断言开关及退出释放;真实空闲息屏行为另验收。
@@ -338,3 +338,9 @@ PublicIPAddressChecks 使用生产 sessionConfiguration,验证缓存 / Cookie
`tools/check.py --app /path/to/kymo.app --services --only ReleaseServiceChecks` 在临时加固沙盒宿主中嵌入所给产物的实际 SMARTService.xpc,使用正式 Core 客户端经双向签名认证验证同 UID footprint、CPU 能量能力与 SMC 传感器 RPC;Intel 的能量能力应为 unsupported。临时宿主没有放宽额外权限,结束后按本轮随机 bundle ID 清理容器。该检查验证打包服务和客户端协议兼容性,不冒充完整产品主程序的菜单栏交互验收。 `tools/check.py --app /path/to/kymo.app --services --only ReleaseServiceChecks` 在临时加固沙盒宿主中嵌入所给产物的实际 SMARTService.xpc,使用正式 Core 客户端经双向签名认证验证同 UID footprint、CPU 能量能力与 SMC 传感器 RPC;Intel 的能量能力应为 unsupported。临时宿主没有放宽额外权限,结束后按本轮随机 bundle ID 清理容器。该检查验证打包服务和客户端协议兼容性,不冒充完整产品主程序的菜单栏交互验收。
`python3 tools/package_release.py` 构建普通 Release,清空额外诊断编译标记,以 ad-hoc 签名输出 arm64 ZIP(实际架构以构建结果为准)及 SHA-256。校验主应用和 XPC 均启用 Hardened Runtime、entitlement 集合符合预期,排除开发文件,再解包重新校验;不调用公证或 Gatekeeper 绕过操作。已存在同名文件时拒绝覆盖,DerivedData 位于临时目录并自动清理。产物不入 Git。 `python3 tools/package_release.py` 构建普通 Release,清空额外诊断编译标记,以 ad-hoc 签名输出 arm64 ZIP(实际架构以构建结果为准)及 SHA-256。校验主应用和 XPC 均启用 Hardened Runtime、entitlement 集合符合预期,排除开发文件,再解包重新校验;不调用公证或 Gatekeeper 绕过操作。已存在同名文件时拒绝覆盖,DerivedData 位于临时目录并自动清理。产物不入 Git。
## 双页与 CPU 功率
DetailDemandChecks 验证概览零进程枚举、切页时旧同步任务不回写、单在途、基础 CPU 差分和历史连续、暂停 / 隐藏优先。ProcessEnergyChecks 增加多于三项功率、完整身份合并和 PID 复用;ProcessSelectionChecks 增加功率双向排序、零值与缺失置后;NativeProcessTableChecks 验证真实原生功率列文本、统计窗口和排序回调;PanelWindowChecks 验证关闭重开默认概览。PanelLayoutChecks 覆盖两列配对行高和小屏滚动。
显式诊断构建(DEBUG 或 KYMO_AUDIT)可设置 KYMO_RESOURCE_AUDIT=1、KYMO_AUDIT_INTERACTIVE=1 打开固定面板供实际交互;KYMO_AUDIT_PAGE=processes 选择资源循环中的进程页;KYMO_AUDIT_QUICK=1 使用 3 秒初始隐藏、每轮 30 秒展开 / 5 秒关闭,不执行暂停段。普通 Release 不包含驱动实现。此类诊断驱动不能替代实际输入事件,也不能证明长期性能预算。
+2 -2
View File
@@ -425,7 +425,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5; CURRENT_PROJECT_VERSION = 7;
DEAD_CODE_STRIPPING = YES; DEAD_CODE_STRIPPING = YES;
ENABLE_APP_SANDBOX = YES; ENABLE_APP_SANDBOX = YES;
ENABLE_OUTGOING_NETWORK_CONNECTIONS = YES; ENABLE_OUTGOING_NETWORK_CONNECTIONS = YES;
@@ -458,7 +458,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5; CURRENT_PROJECT_VERSION = 7;
DEAD_CODE_STRIPPING = YES; DEAD_CODE_STRIPPING = YES;
ENABLE_APP_SANDBOX = YES; ENABLE_APP_SANDBOX = YES;
ENABLE_HARDENED_RUNTIME = YES; ENABLE_HARDENED_RUNTIME = YES;
+3
View File
@@ -47,6 +47,9 @@ import AppKit
openSettingsAction = { settings.environment.openSettings() } openSettingsAction = { settings.environment.openSettings() }
configureMainMenu() configureMainMenu()
menuBar = MenuPanelController(visibility: { [metrics] in metrics.setPanelVisible($0) }, menuBar = MenuPanelController(visibility: { [metrics] in metrics.setPanelVisible($0) },
pageChanged: { [metrics] page in
metrics.setDetailDemand(processes: page == .processes, slowMetrics: page == .overview)
},
menuTitle: { [language] key in menuTitle: { [language] key in
AppLocalization.string("status." + key, locale: language.locale, table: "StatusItem") AppLocalization.string("status." + key, locale: language.locale, table: "StatusItem")
}, openSettings: { [weak self] in self?.settingsCommand() }) { [self] panel in }, openSettings: { [weak self] in self?.settingsCommand() }) { [self] panel in
+13 -1
View File
@@ -35,6 +35,18 @@ nonisolated struct ProcessEnergySnapshot: Sendable {
let candidates: Int let candidates: Int
let readable: Int let readable: Int
let measured: Int let measured: Int
let rows: [ProcessEnergyUsage] // Only the top three; no CPU prefilter. let rows: [ProcessEnergyUsage] // All valid measurements; no CPU prefilter.
let state: State let state: State
} }
nonisolated extension ProcessSnapshot {
func withEnergy(_ energy: ProcessEnergySnapshot?) -> ProcessSnapshot {
let values = Dictionary((energy?.rows ?? []).map { ($0.id, $0) }, uniquingKeysWith: { first, _ in first })
return ProcessSnapshot(date: date, enumerated: enumerated, readable: readable, rows: rows.map { process in
var row = process
row.cpuPower = values[process.id]?.watts
row.powerWindow = values[process.id]?.seconds
return row
}, failed: failed)
}
}
+6
View File
@@ -14,6 +14,12 @@ nonisolated struct ProcessMetrics: Identifiable, Sendable {
let footprintBytes: UInt64? // Physical footprint; never RSS. let footprintBytes: UInt64? // Physical footprint; never RSS.
let threads: Int? let threads: Int?
let restricted: Bool let restricted: Bool
var cpuPower: Double? = nil // Average attributed CPU power, watts; not Energy Impact.
var powerWindow: TimeInterval? = nil
var formattedPower: String {
guard let cpuPower, cpuPower.isFinite, cpuPower >= 0 else { return "--" }
return cpuPower >= 1 ? String(format: "%.2f W", cpuPower) : String(format: "%.1f mW", cpuPower * 1000)
}
} }
nonisolated struct ProcessSnapshot: Sendable { nonisolated struct ProcessSnapshot: Sendable {
@@ -29,15 +29,12 @@ nonisolated struct ProcessEnergyMonitor: Sendable {
if let (power, seconds) = Self.watts(current: reading, previous: previous[reading.id], maximumInterval: maximumInterval) { if let (power, seconds) = Self.watts(current: reading, previous: previous[reading.id], maximumInterval: maximumInterval) {
measured += 1 measured += 1
let usage = ProcessEnergyUsage(process: process, watts: power, seconds: seconds) let usage = ProcessEnergyUsage(process: process, watts: power, seconds: seconds)
let index = usages.firstIndex { usages.append(usage)
$0.watts < power || ($0.watts == power && $0.id.pid > process.id.pid)
} ?? usages.endIndex
usages.insert(usage, at: index)
if usages.count > 3 { usages.removeLast() }
} }
} }
} }
previous = next // Failed / missing readings invalidate the old baseline. previous = next // Failed / missing readings invalidate the old baseline.
usages.sort { $0.watts == $1.watts ? $0.id.pid < $1.id.pid : $0.watts > $1.watts }
let state: ProcessEnergySnapshot.State let state: ProcessEnergySnapshot.State
if capability == .unsupported { state = .unsupported } if capability == .unsupported { state = .unsupported }
else if capability == .unavailable || processes.failed || (capability == .verifiedCPU && next.isEmpty) { state = .unavailable } else if capability == .unavailable || processes.failed || (capability == .verifiedCPU && next.isEmpty) { state = .unavailable }
+17 -6
View File
@@ -11,9 +11,12 @@ final class MetricsStore {
private(set) var isSystemSleeping = false private(set) var isSystemSleeping = false
private(set) var isDisplaySleeping = false private(set) var isDisplaySleeping = false
private(set) var isPanelVisible = false private(set) var isPanelVisible = false
private(set) var processUpdatesRequested = false
private(set) var slowMetricsRequested = true
let sampling: SamplingPreferences let sampling: SamplingPreferences
private let energyEnabled: Bool private let energyEnabled: Bool
private var panelDemand: Bool { isPanelVisible && !isDisplaySleeping } private var panelDemand: Bool { isPanelVisible && !isDisplaySleeping }
private var processDemand: Bool { panelDemand && processUpdatesRequested }
var effectiveMilliseconds: Int { panelDemand ? sampling.panelMilliseconds : sampling.backgroundMilliseconds } var effectiveMilliseconds: Int { panelDemand ? sampling.panelMilliseconds : sampling.backgroundMilliseconds }
private var hasSamplingDemand: Bool { !isSystemSleeping && (panelDemand || sampling.backgroundEnabled) } private var hasSamplingDemand: Bool { !isSystemSleeping && (panelDemand || sampling.backgroundEnabled) }
// Permit timer coalescing without changing the requested cadence or delta timestamps. // Permit timer coalescing without changing the requested cadence or delta timestamps.
@@ -72,25 +75,25 @@ final class MetricsStore {
while !Task.isCancelled { while !Task.isCancelled {
let sampledAt = ContinuousClock.now let sampledAt = ContinuousClock.now
let visibleGeneration = self?.visibilityGeneration let visibleGeneration = self?.visibilityGeneration
var next = await sampler.sample(includeProcesses: self?.panelDemand == true, var next = await sampler.sample(includeProcesses: self?.processDemand == true,
includeSlowMetrics: self?.panelDemand == true, includeSlowMetrics: self?.panelDemand == true && self?.slowMetricsRequested == true,
maximumEnergyInterval: max(30, Double(self?.effectiveMilliseconds ?? 2000) / 500), maximumEnergyInterval: max(30, Double(self?.effectiveMilliseconds ?? 2000) / 500),
includeEnergy: self?.energyEnabled == true, demandRevision: visibleGeneration, processUpdate: { [weak self] processes in includeEnergy: self?.energyEnabled == true, demandRevision: visibleGeneration, processUpdate: { [weak self] processes in
Task { @MainActor [weak self] in Task { @MainActor [weak self] in
guard let self, self.visibilityGeneration == visibleGeneration, guard let self, self.visibilityGeneration == visibleGeneration,
self.panelDemand, !self.isPaused, !self.isSystemSleeping else { return } self.processDemand, !self.isPaused, !self.isSystemSleeping else { return }
if self.processSnapshot.map({ $0.date > processes.date }) != true { self.processSnapshot = processes } if self.processSnapshot.map({ $0.date > processes.date }) != true { self.processSnapshot = processes }
} }
}, energyUpdate: { [weak self] energy in }, energyUpdate: { [weak self] energy in
Task { @MainActor [weak self] in Task { @MainActor [weak self] in
guard let self, self.visibilityGeneration == visibleGeneration, guard let self, self.visibilityGeneration == visibleGeneration,
self.panelDemand, !self.isPaused, !self.isSystemSleeping else { return } self.processDemand, !self.isPaused, !self.isSystemSleeping else { return }
self.energy = energy self.energy = energy
SamplingDiagnostics.recordEnergy(energy) SamplingDiagnostics.recordEnergy(energy)
} }
}) })
guard !Task.isCancelled, self?.generation == currentGeneration else { return } guard !Task.isCancelled, self?.generation == currentGeneration else { return }
if self?.panelDemand != true || self?.visibilityGeneration != visibleGeneration { next.processes = nil } if self?.processDemand != true || self?.visibilityGeneration != visibleGeneration { next.processes = nil }
else if let completed = self?.processSnapshot, completed.date >= next.date { else if let completed = self?.processSnapshot, completed.date >= next.date {
// A fast detached process result may reach MainActor before this quick snapshot. // A fast detached process result may reach MainActor before this quick snapshot.
next.processes = completed next.processes = completed
@@ -143,10 +146,18 @@ final class MetricsStore {
updateDemand(reset: !sampling.backgroundEnabled, sampleImmediately: panelDemand) updateDemand(reset: !sampling.backgroundEnabled, sampleImmediately: panelDemand)
} }
/// The caller supplies data needs, without introducing UI types into Core.
func setDetailDemand(processes: Bool, slowMetrics: Bool) {
guard processUpdatesRequested != processes || slowMetricsRequested != slowMetrics else { return }
processUpdatesRequested = processes
slowMetricsRequested = slowMetrics
updateDemand(reset: false, sampleImmediately: panelDemand)
}
private func updateDemand(reset: Bool, sampleImmediately: Bool = true) { private func updateDemand(reset: Bool, sampleImmediately: Bool = true) {
visibilityGeneration += 1 visibilityGeneration += 1
let revision = visibilityGeneration let revision = visibilityGeneration
let active = panelDemand && !isPaused && !isSystemSleeping let active = processDemand && !isPaused && !isSystemSleeping
if !active { processSnapshot = nil } if !active { processSnapshot = nil }
energy = nil energy = nil
Task { await sampler.setProcessVisible(active, revision: revision) } Task { await sampler.setProcessVisible(active, revision: revision) }
+7 -15
View File
@@ -42,11 +42,6 @@ struct CPUCoreGrid: View {
let groups = Self.groups(count: values.count, kinds: kinds) let groups = Self.groups(count: values.count, kinds: kinds)
GeometryReader { geometry in GeometryReader { geometry in
let widths = Self.groupWidths(groups: groups, width: geometry.size.width) let widths = Self.groupWidths(groups: groups, width: geometry.size.width)
let diameter = zip(groups, widths).map { indices, width in
let columns = CPUCoreGridLayout.rowCounts(count: indices.count, width: width).max() ?? 1
let spacing = min(CPUCoreGridLayout.columnSpacing, max(0, (width / CGFloat(columns) - 18) / 2))
return max(0, (width - CGFloat(columns - 1) * spacing) / CGFloat(columns) - 4)
}.min() ?? 20
HStack(alignment: .top, spacing: 6) { HStack(alignment: .top, spacing: 6) {
ForEach(groups.indices, id: \.self) { group in ForEach(groups.indices, id: \.self) { group in
if group > 0 { if group > 0 {
@@ -63,7 +58,7 @@ struct CPUCoreGrid: View {
.lineLimit(1).minimumScaleFactor(0.6) .lineLimit(1).minimumScaleFactor(0.6)
CPUCoreGridLayout { CPUCoreGridLayout {
ForEach(groups[group], id: \.self) { index in ForEach(groups[group], id: \.self) { index in
ring(index: index, maximumDiameter: min(20, diameter)) core(index: index)
} }
} }
}.frame(width: widths[group], alignment: .topLeading) }.frame(width: widths[group], alignment: .topLeading)
@@ -82,20 +77,17 @@ struct CPUCoreGrid: View {
return zip(groups, widths).map { CPUCoreGridLayout.rowCounts(count: $0.0.count, width: $0.1).count }.max() ?? 0 return zip(groups, widths).map { CPUCoreGridLayout.rowCounts(count: $0.0.count, width: $0.1).count }.max() ?? 0
} }
private func ring(index: Int, maximumDiameter: CGFloat) -> some View { private func core(index: Int) -> some View {
let kind = kinds[index] let kind = kinds[index]
let value = values[index].isFinite ? min(1, max(0, values[index])) : 0 let value = values[index].isFinite ? min(1, max(0, values[index])) : 0
return GeometryReader { proxy in return VStack(spacing: 3) {
let diameter = min(maximumDiameter, max(0, proxy.size.width - 4))
ZStack {
NativeMetricRing(value: value, color: color(kind), lineWidth: 2, trackOpacity: 0.16, inset: 1)
Text(verbatim: "\(Int((value * 100).rounded()))") Text(verbatim: "\(Int((value * 100).rounded()))")
.font(.system(size: 8, weight: .medium)).lineLimit(1).minimumScaleFactor(0.4) .font(.system(size: 8, weight: .medium)).monospacedDigit().lineLimit(1)
} MetricProgressBar(value: value, color: color(kind)).frame(height: 3)
.frame(width: diameter, height: diameter)
.frame(width: proxy.size.width, height: proxy.size.height)
} }
.frame(maxWidth: .infinity, maxHeight: .infinity)
.help(Text("\(kind.map { label($0) } ?? Text("cpu.core")) · \(index + 1): \(MetricFormat.percent(value))")) .help(Text("\(kind.map { label($0) } ?? Text("cpu.core")) · \(index + 1): \(MetricFormat.percent(value))"))
.accessibilityElement(children: .ignore)
.accessibilityLabel(kind.map { label($0) } ?? Text("cpu.core")) .accessibilityLabel(kind.map { label($0) } ?? Text("cpu.core"))
.accessibilityValue("\(index + 1): \(MetricFormat.percent(value))") .accessibilityValue("\(index + 1): \(MetricFormat.percent(value))")
} }
@@ -1,64 +0,0 @@
import SwiftUI
/// A separate observation scope: energy completion does not replace the resource snapshot.
struct EnergyProcessSection: View {
let metrics: MetricsStore
private var snapshot: ProcessEnergySnapshot? { metrics.energy }
private var rows: [ProcessEnergyUsage] { snapshot?.rows ?? [] }
var body: some View {
VStack(alignment: .leading, spacing: 4) {
HStack {
Text("energy.cpuProcesses").font(PanelStyle.section)
if snapshot?.state == .partial {
Text("energy.partial").font(.system(size: 8)).foregroundStyle(.secondary)
.help(Text("energy.coverage \(snapshot?.measured ?? 0) \(snapshot?.candidates ?? 0)"))
}
Spacer()
Text("energy.averagePower").foregroundStyle(.secondary)
}.font(PanelStyle.label)
if rows.isEmpty {
Text(statusKey).foregroundStyle(.secondary).font(PanelStyle.label)
} else {
ForEach(rows) { usage in
EnergyProcessListRow(usage: usage, maximum: rows.first?.watts ?? 0)
}
}
}
.help(Text("energy.scopeHelp"))
}
private var statusKey: LocalizedStringKey {
switch snapshot?.state {
case .unsupported: "energy.unsupported"
case .unavailable: "energy.unavailable"
default: "energy.waiting"
}
}
}
private struct EnergyProcessListRow: View {
let usage: ProcessEnergyUsage
let maximum: Double
private var progress: Double { maximum > 0 ? min(1, max(0, usage.watts / maximum)) : 0 }
var body: some View {
HStack(spacing: 5) {
ProcessIcon(process: usage.process)
Text(verbatim: usage.process.name).lineLimit(1).truncationMode(.middle)
.frame(width: 66, alignment: .leading)
GeometryReader { proxy in
Capsule().fill(.primary.opacity(0.07))
.overlay(alignment: .leading) {
Capsule().fill(Color("MetricCPU"))
.frame(width: proxy.size.width * progress, height: 4).clipped()
}.clipShape(Capsule())
}.frame(height: 4)
Text(verbatim: usage.formattedPower)
.foregroundStyle(Color("MetricCPU")).font(PanelStyle.value)
.monospacedDigit().frame(width: 57, alignment: .trailing)
}
.font(PanelStyle.label).frame(height: 16)
.help(Text("energy.window \(usage.seconds.formatted(.number.precision(.fractionLength(1))))"))
.accessibilityElement(children: .combine)
}
}
@@ -2,10 +2,14 @@ import AppKit
import SwiftUI import SwiftUI
import Observation import Observation
enum PanelPage: Hashable { case overview, processes }
@MainActor @Observable final class PanelPresentation { @MainActor @Observable final class PanelPresentation {
fileprivate(set) var isOpen = false fileprivate(set) var isOpen = false
var isPinned = false { didSet { onPinChange?(isPinned) } } var isPinned = false { didSet { onPinChange?(isPinned) } }
var page: PanelPage = .overview { didSet { if oldValue != page { onPageChange?(page) } } }
@ObservationIgnored var onPinChange: ((Bool) -> Void)? @ObservationIgnored var onPinChange: ((Bool) -> Void)?
@ObservationIgnored var onPageChange: ((PanelPage) -> Void)?
} }
/// Owns only status-item/window behavior. Sampling and settings are injected by App. /// Owns only status-item/window behavior. Sampling and settings are injected by App.
@@ -28,6 +32,7 @@ import Observation
private var isHiding = false private var isHiding = false
init<Content: View>(installStatusItem: Bool = true, visibility: @escaping (Bool) -> Void, init<Content: View>(installStatusItem: Bool = true, visibility: @escaping (Bool) -> Void,
pageChanged: @escaping (PanelPage) -> Void = { _ in },
menuTitle: @escaping (String) -> String = { $0 }, menuTitle: @escaping (String) -> String = { $0 },
openSettings: @escaping () -> Void = {}, openSettings: @escaping () -> Void = {},
@ViewBuilder content: @escaping (PanelPresentation) -> Content) { @ViewBuilder content: @escaping (PanelPresentation) -> Content) {
@@ -51,6 +56,7 @@ import Observation
panel.collectionBehavior = [.canJoinAllSpaces, .fullScreenAuxiliary] panel.collectionBehavior = [.canJoinAllSpaces, .fullScreenAuxiliary]
panel.dismiss = { [weak self] in self?.hide() } panel.dismiss = { [weak self] in self?.hide() }
presentation.onPinChange = { [weak self] pinned in self?.panel.level = pinned ? .floating : .normal } presentation.onPinChange = { [weak self] pinned in self?.panel.level = pinned ? .floating : .normal }
presentation.onPageChange = pageChanged
if installStatusItem { if installStatusItem {
let item = NSStatusBar.system.statusItem(withLength: NSStatusItem.squareLength) let item = NSStatusBar.system.statusItem(withLength: NSStatusItem.squareLength)
item.button?.image = NSImage(named: "BrandMark") item.button?.image = NSImage(named: "BrandMark")
@@ -116,6 +122,7 @@ import Observation
func show() { func show() {
guard !panel.isVisible else { panel.makeKeyAndOrderFront(nil); return } guard !panel.isVisible else { panel.makeKeyAndOrderFront(nil); return }
place() place()
presentation.page = .overview
presentation.isOpen = true presentation.isOpen = true
panel.contentView = content(presentation) panel.contentView = content(presentation)
panel.level = presentation.isPinned ? .floating : .normal panel.level = presentation.isPinned ? .floating : .normal
@@ -42,33 +42,10 @@ extension MenuPanelView {
} else { } else {
Text("metric.waiting").foregroundStyle(.secondary) Text("metric.waiting").foregroundStyle(.secondary)
} }
Spacer(minLength: 0)
CardSeparator()
HStack(spacing: 10) {
VStack(alignment: .leading, spacing: 4) {
HStack {
Text("cpu.load.oneMinute", tableName: "CPUDetails").foregroundStyle(.secondary)
Spacer(minLength: 3)
MetricText(
value: snapshot.load.first.map { "\(MetricFormat.decimal($0)) / \(snapshot.cpu?.cores.count ?? 0)" } ?? "--")
}
MetricProgressBar(
value: (snapshot.load.first ?? 0) / Double(max(1, snapshot.cpu?.cores.count ?? 0)), color: Color("MetricCPU")
)
.frame(height: 5).accessibilityHidden(true)
}.frame(maxWidth: .infinity)
Rectangle().fill(.primary.opacity(0.08)).frame(width: 1, height: 25)
VStack(alignment: .leading, spacing: 3) {
Text("panel.uptime").foregroundStyle(.secondary)
MetricText(value: String(format: "%.1f h", snapshot.uptime / 3600))
.fontWeight(.medium)
}
}.font(PanelStyle.label).lineLimit(1)
} }
} }
var gpuCard: some View { var gpuCard: some View {
let summary = GPUUtilizationSummary(samples: samples)
return ResourceCard( return ResourceCard(
title: "metric.gpu", symbol: "square.grid.2x2", color: Color("MetricGPU"), value: MetricFormat.percent(snapshot.gpuUsage), title: "metric.gpu", symbol: "square.grid.2x2", color: Color("MetricGPU"), value: MetricFormat.percent(snapshot.gpuUsage),
status: snapshot.gpuTemperature.map { "\(Int($0.rounded()))°C" }, status: snapshot.gpuTemperature.map { "\(Int($0.rounded()))°C" },
@@ -81,15 +58,6 @@ extension MenuPanelView {
firstLabel: "gpu.totalUtilization", secondLabel: "gpu.renderer", thirdLabel: "gpu.tiler", firstLabel: "gpu.totalUtilization", secondLabel: "gpu.renderer", thirdLabel: "gpu.tiler",
expectedInterval: chartInterval, boundaryDates: chartBoundaries, intervals: chartIntervals) expectedInterval: chartInterval, boundaryDates: chartBoundaries, intervals: chartIntervals)
CardSeparator() CardSeparator()
gpuActivity("gpu.rendererActivity", value: snapshot.gpu?.renderer, color: Color("MetricCPU"))
gpuActivity("gpu.tilerActivity", value: snapshot.gpu?.tiler, color: Color("SeriesSystem"))
CardSeparator()
Spacer(minLength: 0)
GPUStatisticsView(
inUse: snapshot.gpu?.inUseMemory, allocated: snapshot.gpu?.allocatedMemory,
average: summary.average, peak: summary.peak
)
Spacer(minLength: 0)
let fans = displayedFans let fans = displayedFans
if !fans.isEmpty { if !fans.isEmpty {
LazyVGrid(columns: Array(repeating: GridItem(.flexible(), spacing: 10), count: min(2, fans.count)), spacing: 5) { LazyVGrid(columns: Array(repeating: GridItem(.flexible(), spacing: 10), count: min(2, fans.count)), spacing: 5) {
@@ -105,13 +73,6 @@ extension MenuPanelView {
} }
} }
func gpuActivity(_ title: LocalizedStringKey, value: Double?, color: Color) -> some View {
HStack(spacing: 8) {
Text(title).font(PanelStyle.label).frame(width: 100, alignment: .leading)
MetricProgressBar(value: value ?? 0, color: color).frame(height: 5)
MetricText(value: MetricFormat.percent(value)).font(PanelStyle.value).frame(width: 30, alignment: .trailing)
}.font(PanelStyle.label)
}
var memoryCard: some View { var memoryCard: some View {
ResourceCard( ResourceCard(
title: "metric.memory", symbol: "memorychip", color: Color("MemoryApplication"), title: "metric.memory", symbol: "memorychip", color: Color("MemoryApplication"),
@@ -235,12 +196,6 @@ extension MenuPanelView {
.font(PanelStyle.label) .font(PanelStyle.label)
.lineLimit(1) .lineLimit(1)
.frame(height: 32) .frame(height: 32)
Spacer(minLength: 0)
CardSeparator()
EnergyProcessSection(metrics: metrics)
// Reserve the header and all three rows before process sampling completes.
.frame(height: 74, alignment: .top)
.lineLimit(1)
}.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading) }.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
} }
+57 -31
View File
@@ -13,6 +13,7 @@ struct MenuPanelView: View {
@State var selectedInterface = "" @State var selectedInterface = ""
@State var publicIPAddress: String? @State var publicIPAddress: String?
@State var showVolumes = false @State var showVolumes = false
@State private var processState = ProcessTableState()
var snapshot: MetricsSnapshot { metrics.snapshot } var snapshot: MetricsSnapshot { metrics.snapshot }
var samples: [TrendSample] { metrics.history.samples } var samples: [TrendSample] { metrics.history.samples }
@@ -47,16 +48,19 @@ struct MenuPanelView: View {
var body: some View { var body: some View {
VStack(spacing: PanelStyle.gap) { VStack(spacing: PanelStyle.gap) {
if PanelResourceAudit.omitted != "header" { header } if PanelResourceAudit.omitted != "header" { header }
if presentation.page == .overview {
if PanelLayout.needsResourceScroll(size: panelSize, rows: rowHeights) { if PanelLayout.needsResourceScroll(size: panelSize, rows: rowHeights) {
ScrollView { resourceRows } ScrollView { resourceRows }
.frame(maxHeight: PanelLayout.resourceHeight(rows: rowHeights)) .frame(maxWidth: .infinity, maxHeight: .infinity)
} else { } else {
resourceRows resourceRows
.frame(maxHeight: .infinity, alignment: .top)
} }
if presentation.isOpen && PanelResourceAudit.omitted != "processes" { } else if presentation.isOpen && PanelResourceAudit.omitted != "processes" {
PanelProcessSection(metrics: metrics, wide: panelSize.width >= 900).frame(maxWidth: .infinity, maxHeight: .infinity) PanelProcessSection(metrics: metrics, state: processState, wide: panelSize.width >= 800)
.frame(minHeight: 170) .frame(maxWidth: .infinity, maxHeight: .infinity)
} }
footer
} }
.padding(PanelStyle.padding) .padding(PanelStyle.padding)
.frame(width: panelSize.width, height: panelSize.height) .frame(width: panelSize.width, height: panelSize.height)
@@ -101,41 +105,62 @@ struct MenuPanelView: View {
} else { } else {
switch index { switch index {
case 0: cpuCard case 0: cpuCard
case 1: gpuCard case 1: batteryCard
case 2: batteryCard case 2: gpuCard
case 3: memoryCard case 3: diskCard
case 4: diskCard case 4: memoryCard
case 5: networkCard case 5: networkCard
default: EmptyView() default: EmptyView()
} }
} }
} }
private var brand: some View {
HStack(spacing: 6) {
Image("BrandMark").renderingMode(.template).resizable().scaledToFit()
.frame(width: 22, height: 22)
Text("Kymo").font(.system(size: 17, weight: .semibold))
}
}
private var pagePicker: some View {
Picker("panel.page", selection: Binding(get: { presentation.page }, set: { presentation.page = $0 })) {
Text("panel.overview").tag(PanelPage.overview)
Text("panel.processes").tag(PanelPage.processes)
}
.pickerStyle(.segmented).labelsHidden().frame(width: 164)
.accessibilityIdentifier("panel.tabs")
}
private var header: some View { private var header: some View {
HStack(spacing: 10) { VStack(spacing: 4) {
Image("BrandMark") HStack(spacing: 8) {
.renderingMode(.template) brand
.resizable()
.scaledToFit()
.frame(width: 24, height: 24)
HStack(alignment: .firstTextBaseline, spacing: 2) {
Text("Kymo").font(.system(size: 18, weight: .semibold))
Text(verbatim: "v\(Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "--")")
.font(.system(size: 8, weight: .medium))
.foregroundStyle(.secondary)
.baselineOffset(7)
}
if panelSize.width >= 900 {
Rectangle()
.fill(.secondary.opacity(0.32))
.frame(width: 1, height: 16)
.accessibilityHidden(true)
Text(verbatim: HardwareIdentity.displayName)
.font(.system(size: 11)).foregroundStyle(.secondary).lineLimit(1).truncationMode(.middle)
}
Spacer(minLength: 8) Spacer(minLength: 8)
controls controls
}.padding(.horizontal, 4) }
.frame(height: 32)
.overlay {
if panelSize.width >= 840 { pagePicker }
}
if panelSize.width < 840 { pagePicker.frame(maxWidth: .infinity).frame(height: 28) }
}
.frame(height: PanelLayout.headerHeight(width: panelSize.width))
.padding(.horizontal, 4)
}
private var footer: some View {
HStack {
Text(verbatim: HardwareIdentity.displayName)
.lineLimit(1).truncationMode(.middle)
Spacer(minLength: 8)
HStack(spacing: 4) {
Text("panel.uptime")
MetricText(value: String(format: "%.1f h", snapshot.uptime / 3600))
}
}
.font(PanelStyle.label).foregroundStyle(.secondary)
.frame(height: 18).padding(.horizontal, 4)
} }
private var controls: some View { private var controls: some View {
@@ -217,6 +242,7 @@ private struct PanelControlButtonBody<Content: View>: View {
/// Keep process publications out of the resource-card observation scope. /// Keep process publications out of the resource-card observation scope.
private struct PanelProcessSection: View { private struct PanelProcessSection: View {
let metrics: MetricsStore let metrics: MetricsStore
let state: ProcessTableState
let wide: Bool let wide: Bool
var body: some View { ProcessTableView(snapshot: metrics.processSnapshot, wide: wide) } var body: some View { ProcessTableView(snapshot: metrics.processSnapshot, energy: metrics.energy, state: state, wide: wide) }
} }
+14 -5
View File
@@ -25,7 +25,7 @@ import SwiftUI
table.usesAlternatingRowBackgroundColors = true; table.backgroundColor = .clear table.usesAlternatingRowBackgroundColors = true; table.backgroundColor = .clear
table.allowsMultipleSelection = false; table.allowsEmptySelection = true table.allowsMultipleSelection = false; table.allowsEmptySelection = true
table.columnAutoresizingStyle = .sequentialColumnAutoresizingStyle table.columnAutoresizingStyle = .sequentialColumnAutoresizingStyle
for (key, width) in [("pid", 48.0), ("name", 140), ("path", 400), ("cpu", 65), ("memory", 85), ("threads", 65)] { for (key, width) in [("pid", 48.0), ("name", 140), ("path", 250), ("cpu", 65), ("memory", 85), ("power", 90), ("threads", 65)] {
let column = NSTableColumn(identifier: NSUserInterfaceItemIdentifier(key)) let column = NSTableColumn(identifier: NSUserInterfaceItemIdentifier(key))
column.width = width column.width = width
column.minWidth = key == "path" ? 150 : key == "name" ? 90 : width column.minWidth = key == "path" ? 150 : key == "name" ? 90 : width
@@ -148,9 +148,18 @@ import SwiftUI
case "path": text = process.path ?? "--" case "path": text = process.path ?? "--"
case "cpu": text = process.cpu.map { String(format: "%.1f", $0 * 100) } ?? "--" case "cpu": text = process.cpu.map { String(format: "%.1f", $0 * 100) } ?? "--"
case "memory": text = process.footprintBytes.map { String(format: "%.1f MB", Double($0) / 1_048_576) } ?? "--" case "memory": text = process.footprintBytes.map { String(format: "%.1f MB", Double($0) / 1_048_576) } ?? "--"
case "power": text = process.formattedPower
default: text = process.threads.map(String.init) ?? "--" default: text = process.threads.map(String.init) ?? "--"
} }
if cell.textField?.stringValue != text { cell.textField?.stringValue = text } if cell.textField?.stringValue != text { cell.textField?.stringValue = text }
if key == "power" {
let help = AppLocalization.string("energy.scopeHelp", locale: parent.locale)
let window = process.powerWindow.map {
String(format: AppLocalization.string("energy.window %@", locale: parent.locale), String(format: "%.1f", $0))
}
let tooltip = window.map { help + "\n" + $0 } ?? help
if cell.toolTip != tooltip { cell.toolTip = tooltip }
}
if key == "name" { if key == "name" {
let image = PanelResourceAudit.omitted == "icons" ? nil : process.path.flatMap { ProcessIconCache.shared.image(for: $0) } let image = PanelResourceAudit.omitted == "icons" ? nil : process.path.flatMap { ProcessIconCache.shared.image(for: $0) }
let desired = image ?? Self.placeholder let desired = image ?? Self.placeholder
@@ -203,10 +212,10 @@ import SwiftUI
NSPasteboard.general.clearContents(); NSPasteboard.general.setString(value, forType: .string) NSPasteboard.general.clearContents(); NSPasteboard.general.setString(value, forType: .string)
} }
private static func name(_ key: ProcessSort.Key) -> String { private static func name(_ key: ProcessSort.Key) -> String {
switch key { case .pid: "pid"; case .name: "name"; case .path: "path"; case .cpu: "cpu"; case .memory: "memory"; case .threads: "threads" } switch key { case .pid: "pid"; case .name: "name"; case .path: "path"; case .cpu: "cpu"; case .memory: "memory"; case .threads: "threads"; case .power: "power" }
} }
private static func key(_ name: String) -> ProcessSort.Key? { private static func key(_ name: String) -> ProcessSort.Key? {
switch name { case "pid": .pid; case "name": .name; case "path": .path; case "cpu": .cpu; case "memory": .memory; case "threads": .threads; default: nil } switch name { case "pid": .pid; case "name": .name; case "path": .path; case "cpu": .cpu; case "memory": .memory; case "threads": .threads; case "power": .power; default: nil }
} }
} }
@@ -216,8 +225,8 @@ import SwiftUI
self.key = key self.key = key
super.init(frame: .zero) super.init(frame: .zero)
let text = NSTextField(labelWithString: "") let text = NSTextField(labelWithString: "")
text.font = ["pid", "cpu", "memory", "threads"].contains(key) ? .monospacedDigitSystemFont(ofSize: 11, weight: .regular) : .systemFont(ofSize: 11) text.font = ["pid", "cpu", "memory", "threads", "power"].contains(key) ? .monospacedDigitSystemFont(ofSize: 11, weight: .regular) : .systemFont(ofSize: 11)
text.alignment = ["cpu", "memory", "threads"].contains(key) ? .right : .left text.alignment = ["cpu", "memory", "threads", "power"].contains(key) ? .right : .left
text.lineBreakMode = .byTruncatingMiddle text.lineBreakMode = .byTruncatingMiddle
text.textColor = key == "path" ? .secondaryLabelColor : .labelColor text.textColor = key == "path" ? .secondaryLabelColor : .labelColor
addSubview(text); textField = text addSubview(text); textField = text
+11 -10
View File
@@ -2,18 +2,19 @@ import Foundation
import CoreGraphics import CoreGraphics
nonisolated enum PanelLayout { nonisolated enum PanelLayout {
static let baseCardHeight: CGFloat = 280 static let baseCardHeight: CGFloat = 204
static func columns(width: CGFloat) -> Int { width >= 1160 ? 3 : width >= 900 ? 2 : 1 } static func headerHeight(width: CGFloat) -> CGFloat { width >= 840 ? 32 : 64 }
static func columns(width: CGFloat) -> Int { width >= 680 ? 2 : 1 }
static func cardWidth(size: CGSize) -> CGFloat { static func cardWidth(size: CGSize) -> CGFloat {
let count = columns(width: size.width) let count = columns(width: size.width)
return max(0, (size.width - 20 - CGFloat(count - 1) * 8) / CGFloat(count)) return max(0, (size.width - 20 - CGFloat(count - 1) * 8) / CGFloat(count))
} }
/// Heights are assigned by physical row, including the battery/memory pair at two columns. /// Physical order: CPU/battery, GPU/storage, memory/network.
static func rowHeights(columns: Int, coreRows: Int, fanCount: Int) -> [CGFloat] { static func rowHeights(columns: Int, coreRows: Int, fanCount: Int) -> [CGFloat] {
let cpu = baseCardHeight + CGFloat(max(0, coreRows - 2)) * 26 let cpu: CGFloat = 220 + CGFloat(max(0, coreRows - 2)) * 26
let gpu = baseCardHeight + CGFloat(max(0, (fanCount + 1) / 2 - 1)) * 26 let gpu = baseCardHeight + CGFloat(max(0, (fanCount + 1) / 2 - 1)) * 26
let heights = [cpu, gpu, baseCardHeight, baseCardHeight, baseCardHeight, baseCardHeight] let heights = [cpu, baseCardHeight, gpu, baseCardHeight, 260, 260]
let count = max(1, min(3, columns)) let count = max(1, min(2, columns))
return stride(from: 0, to: heights.count, by: count).map { return stride(from: 0, to: heights.count, by: count).map {
heights[$0..<min($0 + count, heights.count)].max() ?? baseCardHeight heights[$0..<min($0 + count, heights.count)].max() ?? baseCardHeight
} }
@@ -22,13 +23,13 @@ nonisolated enum PanelLayout {
rows.reduce(0, +) + CGFloat(max(0, rows.count - 1)) * 8 rows.reduce(0, +) + CGFloat(max(0, rows.count - 1)) * 8
} }
static func needsResourceScroll(size: CGSize, rows: [CGFloat]) -> Bool { static func needsResourceScroll(size: CGSize, rows: [CGFloat]) -> Bool {
// Outer padding, toolbar budget, two gaps, and the minimum process area. // Outer padding, common toolbar/footer, and two gaps. Process page is separate.
resourceHeight(rows: rows) > size.height - 20 - 40 - 16 - 170 resourceHeight(rows: rows) > size.height - 20 - headerHeight(width: size.width) - 18 - 16
} }
static func contentSize(visible: CGRect, chrome: CGSize = .zero) -> CGSize { static func contentSize(visible: CGRect, chrome: CGSize = .zero) -> CGSize {
CGSize(width: max(1, min(1240, visible.width - 32 - max(0, chrome.width))), CGSize(width: max(1, min(960, visible.width - 32 - max(0, chrome.width))),
height: max(1, min(820, visible.height - 32 - max(0, chrome.height)))) height: max(1, min(800, visible.height - 32 - max(0, chrome.height))))
} }
static func centeredFrame(_ frame: CGRect, visible: CGRect) -> CGRect { static func centeredFrame(_ frame: CGRect, visible: CGRect) -> CGRect {
var result = constrainedFrame(frame, visible: visible) var result = constrainedFrame(frame, visible: visible)
+20 -2
View File
@@ -38,25 +38,43 @@ import AppKit
func wait(_ seconds: Int) async { try? await Task.sleep(for: .seconds(seconds)) } func wait(_ seconds: Int) async { try? await Task.sleep(for: .seconds(seconds)) }
// Pin the test window so unrelated focus changes cannot invalidate a measurement. // Pin the test window so unrelated focus changes cannot invalidate a measurement.
controller.presentation.isPinned = true controller.presentation.isPinned = true
if ProcessInfo.processInfo.environment["KYMO_AUDIT_INTERACTIVE"] == "1" {
controller.show()
if let value = ProcessInfo.processInfo.environment["KYMO_AUDIT_SIZE"] {
let parts = value.split(separator: "x").compactMap { Double($0) }
if parts.count == 2, parts.allSatisfy({ $0.isFinite }), parts[0] >= 480, parts[1] >= 360 {
controller.panel.setContentSize(CGSize(width: min(parts[0], controller.panel.frame.width),
height: min(parts[1], controller.panel.frame.height)))
}
}
mark("interactive")
return
}
let quick = ProcessInfo.processInfo.environment["KYMO_AUDIT_QUICK"] == "1"
mark("cold") mark("cold")
await wait(10) await wait(quick ? 3 : 10)
mark("hidden10") mark("hidden10")
for cycle in 1...3 { for cycle in 1...3 {
controller.show() controller.show()
if ProcessInfo.processInfo.environment["KYMO_AUDIT_PAGE"] == "processes" { controller.presentation.page = .processes }
mark("open\(cycle).0") mark("open\(cycle).0")
await wait(1); mark("open\(cycle).1") await wait(1); mark("open\(cycle).1")
await wait(9); mark("open\(cycle).10") await wait(9); mark("open\(cycle).10")
await wait(20); mark("open\(cycle).30") await wait(20); mark("open\(cycle).30")
if cycle == 1 { if cycle == 1 && !quick {
metrics.togglePause(); mark("paused.0") metrics.togglePause(); mark("paused.0")
await wait(10); mark("paused.10") await wait(10); mark("paused.10")
metrics.togglePause(); mark("resumed") metrics.togglePause(); mark("resumed")
} }
controller.hide() controller.hide()
await wait(1); mark("closed\(cycle).1") await wait(1); mark("closed\(cycle).1")
if quick {
await wait(4); mark("closed\(cycle).5")
} else {
await wait(9); mark("closed\(cycle).10") await wait(9); mark("closed\(cycle).10")
await wait(20); mark("closed\(cycle).30") await wait(20); mark("closed\(cycle).30")
} }
}
controller.shutdown() controller.shutdown()
mark("complete") mark("complete")
NSApp.terminate(nil) NSApp.terminate(nil)
@@ -32,7 +32,9 @@ struct PanelWindowObserver: NSViewRepresentable {
let frame = (window.screen ?? NSScreen.main)?.visibleFrame ?? NSRect(x: 0, y: 0, width: 1000, height: 760) let frame = (window.screen ?? NSScreen.main)?.visibleFrame ?? NSRect(x: 0, y: 0, width: 1000, height: 760)
let chrome = CGSize(width: max(0, window.frame.width - window.contentLayoutRect.width), let chrome = CGSize(width: max(0, window.frame.width - window.contentLayoutRect.width),
height: max(0, window.frame.height - window.contentLayoutRect.height)) height: max(0, window.frame.height - window.contentLayoutRect.height))
let size = PanelLayout.contentSize(visible: frame, chrome: chrome) let maximum = PanelLayout.contentSize(visible: frame, chrome: chrome)
let size = CGSize(width: min(maximum.width, window.contentLayoutRect.width),
height: min(maximum.height, window.contentLayoutRect.height))
DispatchQueue.main.async { [weak self, weak window] in DispatchQueue.main.async { [weak self, weak window] in
guard let self, let window else { return } guard let self, let window else { return }
self.update(size) self.update(size)
-26
View File
@@ -1,26 +0,0 @@
import AppKit
import SwiftUI
/// Resolves only for visible rows; the task is keyed by process identity and executable path.
struct ProcessIcon: View {
let process: ProcessMetrics
@State private var icon: NSImage?
var body: some View {
Group {
if let icon {
Image(nsImage: icon).resizable().interpolation(.high)
} else {
Image(systemName: "app.dashed").resizable().scaledToFit().padding(2)
}
}
.frame(width: 15, height: 15)
.accessibilityHidden(true)
.task(id: "\(process.id)-\(process.path ?? "")") {
guard PanelResourceAudit.omitted != "icons" else { return }
// Resolve by the sampled executable, avoiding an icon from a reused PID.
guard let path = process.path else { icon = nil; return }
icon = ProcessIconCache.shared.image(for: path)
}
}
}
@@ -27,7 +27,7 @@ nonisolated enum ProcessTableProjection {
/// Missing metrics stay last in either direction. Every newly selected column starts descending. /// Missing metrics stay last in either direction. Every newly selected column starts descending.
nonisolated struct ProcessSort: SortComparator, Equatable { nonisolated struct ProcessSort: SortComparator, Equatable {
enum Key { case pid, name, path, cpu, memory, threads } enum Key { case pid, name, path, cpu, memory, threads, power }
let key: Key let key: Key
var order: SortOrder = .reverse var order: SortOrder = .reverse
@@ -46,6 +46,7 @@ nonisolated struct ProcessSort: SortComparator, Equatable {
case .path: return directed((lhs.path ?? "").localizedStandardCompare(rhs.path ?? "")) case .path: return directed((lhs.path ?? "").localizedStandardCompare(rhs.path ?? ""))
case .cpu: return metric(lhs.cpu, rhs.cpu) case .cpu: return metric(lhs.cpu, rhs.cpu)
case .memory: return metric(lhs.footprintBytes.map { Double($0) }, rhs.footprintBytes.map { Double($0) }) case .memory: return metric(lhs.footprintBytes.map { Double($0) }, rhs.footprintBytes.map { Double($0) })
case .power: return metric(lhs.cpuPower, rhs.cpuPower)
case .threads: return metric(lhs.threads.map { Double($0) }, rhs.threads.map { Double($0) }) case .threads: return metric(lhs.threads.map { Double($0) }, rhs.threads.map { Double($0) })
} }
} }
+42 -18
View File
@@ -1,22 +1,28 @@
import SwiftUI import SwiftUI
import AppKit import AppKit
import Observation
@MainActor @Observable final class ProcessTableState {
var search = ""
var sortOrder = [ProcessSort(key: .cpu)]
var selected: ProcessIdentity?
var departed: ProcessMetrics?
}
struct ProcessTableView: View { struct ProcessTableView: View {
let snapshot: ProcessSnapshot? let snapshot: ProcessSnapshot?
let energy: ProcessEnergySnapshot?
@Bindable var state: ProcessTableState
var wide: Bool = true var wide: Bool = true
@Environment(\.locale) private var locale @Environment(\.locale) private var locale
@State private var search = ""
@State private var sortOrder = [ProcessSort(key: .cpu)]
@State private var hovering = false @State private var hovering = false
@State private var selected: ProcessIdentity?
@State private var rows: [ProcessMetrics] = [] @State private var rows: [ProcessMetrics] = []
@State private var departed: ProcessMetrics?
@State private var searchFocused = false @State private var searchFocused = false
private var held: Bool { hovering || selected != nil || !search.isEmpty } private var held: Bool { hovering || state.selected != nil || !state.search.isEmpty }
private var selectedRow: ProcessMetrics? { snapshot?.rows.first { $0.id == selected } } private var selectedRow: ProcessMetrics? { snapshot?.rows.first { $0.id == state.selected } }
private var exitedSelection: ProcessIdentity? { private var exitedSelection: ProcessIdentity? {
ProcessTableProjection.exitedSelection(selected, in: snapshot) ProcessTableProjection.exitedSelection(state.selected, in: snapshot)
} }
var body: some View { var body: some View {
@@ -26,33 +32,39 @@ struct ProcessTableView: View {
Spacer(minLength: 0) Spacer(minLength: 0)
searchField.frame(maxWidth: wide ? 220 : 180) searchField.frame(maxWidth: wide ? 220 : 180)
} }
HStack(spacing: 8) {
Text("panel.processScope").lineLimit(2)
Spacer(minLength: 4)
energyStatus
}.font(.system(size: 9)).foregroundStyle(.secondary)
if snapshot?.failed == true { Text("panel.processFailed") } if snapshot?.failed == true { Text("panel.processFailed") }
else if snapshot == nil { Text("metric.waiting").foregroundStyle(.secondary) } else if snapshot == nil { Text("metric.waiting").foregroundStyle(.secondary) }
NativeProcessTable(rows: rows, selection: $selected, sorting: $sortOrder, locale: locale, onExit: handleExit) NativeProcessTable(rows: rows, selection: $state.selected, sorting: $state.sortOrder, locale: locale, onExit: handleExit)
.overlay { if snapshot != nil && rows.isEmpty && snapshot?.failed != true { Text("panel.noResults").foregroundStyle(.secondary).allowsHitTesting(false) } } .overlay { if snapshot != nil && rows.isEmpty && snapshot?.failed != true { Text("panel.noResults").foregroundStyle(.secondary).allowsHitTesting(false) } }
if exitedSelection != nil, let departed { if exitedSelection != nil, let departed = state.departed {
HStack { Text(verbatim: departed.name); Text("panel.exited"); Button("panel.dismiss") { selected = nil; self.departed = nil } } HStack { Text(verbatim: departed.name); Text("panel.exited"); Button("panel.dismiss") { state.selected = nil; state.departed = nil } }
} }
} }
.font(.system(size: 12)).padding(10) .font(.system(size: 12)).padding(10)
.modifier(CardSurface()) .modifier(CardSurface())
.onAppear { rebuild(retainOrder: false) } .onAppear { rebuild(retainOrder: false) }
.onChange(of: energy?.date) { _, _ in rebuild(retainOrder: held && !rows.isEmpty) }
.onChange(of: snapshot?.date) { _, _ in rebuild(retainOrder: held && !rows.isEmpty) } .onChange(of: snapshot?.date) { _, _ in rebuild(retainOrder: held && !rows.isEmpty) }
.onChange(of: search) { _, _ in rebuild(retainOrder: held) } .onChange(of: state.search) { _, _ in rebuild(retainOrder: held) }
.onChange(of: sortOrder) { _, _ in rebuild(retainOrder: false) } .onChange(of: state.sortOrder) { _, _ in rebuild(retainOrder: false) }
.onChange(of: selected) { _, _ in if let row = selectedRow { departed = row } } .onChange(of: state.selected) { _, _ in if let row = selectedRow { state.departed = row } }
.onHover { hovering = $0; if !$0 && !held { rebuild(retainOrder: false) } } .onHover { hovering = $0; if !$0 && !held { rebuild(retainOrder: false) } }
.onChange(of: searchFocused) { _, value in if !value && !held { rebuild(retainOrder: false) } } .onChange(of: searchFocused) { _, value in if !value && !held { rebuild(retainOrder: false) } }
.task(id: exitedSelection) { .task(id: exitedSelection) {
guard let id = exitedSelection else { return } guard let id = exitedSelection else { return }
do { try await Task.sleep(for: .seconds(3)) } catch { return } do { try await Task.sleep(for: .seconds(3)) } catch { return }
if exitedSelection == id { selected = nil; departed = nil } if exitedSelection == id { state.selected = nil; state.departed = nil }
} }
.onExitCommand(perform: handleExit) .onExitCommand(perform: handleExit)
} }
private func handleExit() { private func handleExit() {
if !search.isEmpty { search = "" } if !state.search.isEmpty { state.search = "" }
else if selected != nil { selected = nil; departed = nil } else if state.selected != nil { state.selected = nil; state.departed = nil }
else if searchFocused { searchFocused = false } else if searchFocused { searchFocused = false }
else { NSApp.keyWindow?.close() } else { NSApp.keyWindow?.close() }
} }
@@ -61,11 +73,23 @@ struct ProcessTableView: View {
.font(PanelStyle.title) .font(PanelStyle.title)
} }
private var searchField: some View { private var searchField: some View {
NativeSearchField(text: $search, isFocused: $searchFocused, NativeSearchField(text: $state.search, isFocused: $searchFocused,
placeholder: AppLocalization.string("panel.search", locale: locale)) placeholder: AppLocalization.string("panel.search", locale: locale))
} }
private var energyStatus: some View {
Group {
switch energy?.state {
case .unsupported: Text("energy.unsupported")
case .unavailable: Text("energy.unavailable")
case .available, .partial:
Text("energy.coverage \(energy?.measured ?? 0) \(energy?.candidates ?? 0)")
default: Text("energy.waiting")
}
}.help(Text("energy.scopeHelp")).lineLimit(1)
}
private func rebuild(retainOrder: Bool) { private func rebuild(retainOrder: Bool) {
rows = ProcessTableProjection.rows(snapshot?.rows ?? [], query: search, sorting: sortOrder, order: retainOrder ? rows.map(\.id) : []) rows = ProcessTableProjection.rows(snapshot?.withEnergy(energy).rows ?? [], query: state.search, sorting: state.sortOrder, order: retainOrder ? rows.map(\.id) : [])
} }
} }
+4 -10
View File
@@ -4,21 +4,15 @@ struct StorageDetailsView: View {
let disk: DiskMetrics? let disk: DiskMetrics?
let health: DiskHealthMetrics? let health: DiskHealthMetrics?
let showVolumes: () -> Void let showVolumes: () -> Void
private let color = Color("MetricDisk")
var body: some View { var body: some View {
VStack(alignment: .leading, spacing: 4) { VStack(alignment: .leading, spacing: 4) {
CardSeparator()
CardSectionHeader(title: "disk.distribution", valueLabel: "disk.utilization",
value: MetricFormat.percent(disk?.usage), color: color)
CapacityBar(values: [Double(disk.map { $0.total - min($0.total, $0.available) } ?? 0), Double(disk?.available ?? 0)],
colors: [color, Color("MemoryAvailable")], total: Double(disk?.total ?? 1))
HStack(spacing: 4) {
CapacityField(title: "disk.used", value: MetricFormat.bytes(disk.map { $0.total - min($0.total, $0.available) }), color: color)
CapacityField(title: "memory.available", value: MetricFormat.bytes(disk?.available), color: Color("MemoryAvailable"))
}
CardSeparator() CardSeparator()
HStack(alignment: .top, spacing: 8) { HStack(alignment: .top, spacing: 8) {
CardField(title: "memory.available") {
MetricText(value: MetricFormat.bytes(disk?.available))
}
Divider().frame(height: 32)
CardField(title: "disk.remainingLife") { CardField(title: "disk.remainingLife") {
MetricText(value: MetricFormat.percent(health?.remainingLife)) MetricText(value: MetricFormat.percent(health?.remainingLife))
} }
+69 -3
View File
@@ -1,6 +1,72 @@
{ {
"sourceLanguage" : "en", "sourceLanguage" : "en",
"strings" : { "strings" : {
"panel.power" : {
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "CPU 功率"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "CPU power"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "CPU 功率"
}
}
}
},
"panel.overview" : {
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "概览"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Overview"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "概覽"
}
}
}
},
"panel.page" : {
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "监控页面"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Monitoring page"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "監控頁面"
}
}
}
},
"%@\n%@\n%lld / %lld · %lld" : { "%@\n%@\n%lld / %lld · %lld" : {
"extractionState" : "stale", "extractionState" : "stale",
"localizations" : { "localizations" : {
@@ -1655,19 +1721,19 @@
"en" : { "en" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
"value" : "Ranked by system CPU energy counter deltas among measurable processes. Not total app/device power; GPU, display, network and helper processes are not aggregated. Bars are relative to this list." "value" : "Average power from system CPU energy counter deltas over the measured interval. Not total app/device power; GPU, display, network and helper processes are not aggregated. Missing values are shown as --."
} }
}, },
"zh-Hans" : { "zh-Hans" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
"value" : "在可测进程中按系统 CPU 归属能量差值排序,不代表应用或整机完整功耗;不聚合 GPU、屏幕、网络或辅助进程。条形图仅为列表内相对值。" "value" : "系统 CPU 归属能量差值除以实际统计时长所得的平均功率,不代表应用或整机完整功耗;不聚合 GPU、屏幕、网络或辅助进程。无有效读数显示 --。"
} }
}, },
"zh-Hant" : { "zh-Hant" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
"value" : "在可測程序中依系統 CPU 歸屬能量差值排序,不代表應用程式或整機完整功耗;不彙總 GPU、螢幕、網路或輔助程序。長條僅為清單內相對值。" "value" : "系統 CPU 歸屬能量差值除以實際統計時長所得的平均功率,不代表應用程式或整機完整功耗;不彙總 GPU、螢幕、網路或輔助程序。無有效讀數顯示 --。"
} }
} }
} }
+66
View File
@@ -0,0 +1,66 @@
import Foundation
@main struct DetailDemandChecks {
@MainActor static func main() async throws {
let suite = "kymo-detail-checks-" + UUID().uuidString
let defaults = UserDefaults(suiteName: suite)!
defer { defaults.removePersistentDomain(forName: suite) }
let preferences = SamplingPreferences(defaults: defaults)
preferences.panelMilliseconds = 500
preferences.backgroundEnabled = false
let probe = ProcessProbe()
let store = MetricsStore(sampling: preferences, sampler: SystemSampler(processRead: { probe.read(&$0) }), energyEnabled: false)
store.setPanelVisible(true)
try await until { store.history.samples.count >= 2 }
precondition(probe.count == 0 && store.processSnapshot == nil && store.energy == nil,
"Overview must not enumerate processes or publish process power")
store.setDetailDemand(processes: true, slowMetrics: false)
try await until { probe.count > 0 }
// Withdraw demand while the synchronous OS read still holds the single slot.
store.setDetailDemand(processes: false, slowMetrics: true)
try await Task.sleep(for: .milliseconds(350))
precondition(store.processSnapshot == nil, "A completion from the previous page must not publish")
let stopped = probe.count
try await Task.sleep(for: .milliseconds(650))
precondition(probe.count == stopped && store.snapshot.cpu != nil)
store.setDetailDemand(processes: true, slowMetrics: false)
try await until { store.processSnapshot != nil }
precondition(probe.peak == 1)
precondition(store.history.samples.dropFirst().allSatisfy { !$0.breakBefore && $0.cpu != nil },
"Switching detail demand must not reset base CPU deltas or split history")
store.setDetailDemand(processes: false, slowMetrics: true)
precondition(store.processSnapshot == nil && store.energy == nil)
store.togglePause()
let pausedCount = store.history.samples.count
store.setDetailDemand(processes: true, slowMetrics: false)
try await Task.sleep(for: .milliseconds(650))
precondition(store.history.samples.count == pausedCount && store.processSnapshot == nil)
store.togglePause()
try await until { store.processSnapshot != nil }
store.setPanelVisible(false)
precondition(store.processSnapshot == nil && store.energy == nil)
store.togglePause()
print("PASS: overview performs no process reads, page withdrawal rejects stale completion, single in-flight read, continuous base history and pause/hidden precedence")
}
@MainActor private static func until(_ condition: () -> Bool) async throws {
let deadline = ContinuousClock.now.advanced(by: .seconds(4))
while !condition() && ContinuousClock.now < deadline { try await Task.sleep(for: .milliseconds(10)) }
precondition(condition(), "Timed out waiting for detail demand")
}
}
private final class ProcessProbe: @unchecked Sendable {
private let lock = NSLock()
private var reads = 0
private var active = 0
private var maximum = 0
var count: Int { lock.lock(); defer { lock.unlock() }; return reads }
var peak: Int { lock.lock(); defer { lock.unlock() }; return maximum }
func read(_ monitor: inout ProcessMonitor) -> ProcessSnapshot {
lock.lock(); reads += 1; active += 1; maximum = max(maximum, active); lock.unlock()
defer { lock.lock(); active -= 1; lock.unlock() }
Thread.sleep(forTimeInterval: 0.25)
return monitor.sample()
}
}
+12 -1
View File
@@ -61,11 +61,22 @@ private struct Host: View {
let coordinator = table.delegate as! NativeProcessTable.Coordinator let coordinator = table.delegate as! NativeProcessTable.Coordinator
let probe = DelegateProbe(state, coordinator) let probe = DelegateProbe(state, coordinator)
table.delegate = probe table.delegate = probe
precondition(table.numberOfRows == 500 && table.tableColumns.count == 6) precondition(table.numberOfRows == 500 && table.tableColumns.count == 7)
precondition(table.frame.width >= table.enclosingScrollView!.contentSize.width - 1, "Native table must fill its viewport") precondition(table.frame.width >= table.enclosingScrollView!.contentSize.width - 1, "Native table must fill its viewport")
precondition(coordinator.createdCells > 0 && coordinator.createdCells < 200, "Rows must be virtualized") precondition(coordinator.createdCells > 0 && coordinator.createdCells < 200, "Rows must be virtualized")
let memoryCell = table.view(atColumn: 4, row: 0, makeIfNecessary: true) as! NSTableCellView let memoryCell = table.view(atColumn: 4, row: 0, makeIfNecessary: true) as! NSTableCellView
precondition(memoryCell.textField?.stringValue == "9.5 MB", "Memory column must match Activity Monitor binary MB display") precondition(memoryCell.textField?.stringValue == "9.5 MB", "Memory column must match Activity Monitor binary MB display")
let powerColumn = table.tableColumns.firstIndex { $0.identifier.rawValue == "power" }!
let emptyPower = table.view(atColumn: powerColumn, row: 0, makeIfNecessary: true) as! NSTableCellView
precondition(emptyPower.textField?.stringValue == "--")
state.rows[0].cpuPower = 0.005
state.rows[0].powerWindow = 5
await until { emptyPower.textField?.stringValue == "5.0 mW" }
precondition(emptyPower.toolTip?.contains("5.0 s") == true)
table.sortDescriptors = [NSSortDescriptor(key: "power", ascending: false)]
await until { state.sorting == [ProcessSort(key: .power)] }
table.sortDescriptors = [NSSortDescriptor(key: "power", ascending: true)]
await until { state.sorting == [ProcessSort(key: .power, order: .forward)] }
let chosen = state.rows[10].id let chosen = state.rows[10].id
table.selectRowIndexes(IndexSet(integer: 10), byExtendingSelection: false) table.selectRowIndexes(IndexSet(integer: 10), byExtendingSelection: false)
precondition(state.selection == nil, "Native selection must be deferred") precondition(state.selection == nil, "Native selection must be deferred")
+6 -4
View File
@@ -13,13 +13,13 @@ import CoreGraphics
precondition(visible.insetBy(dx: 16, dy: 16).contains(centered)) precondition(visible.insetBy(dx: 16, dy: 16).contains(centered))
} }
} }
for width: CGFloat in [640, 899, 900, 1159, 1160, 1240] { for width: CGFloat in [640, 679, 680, 899, 900, 960] {
let size = CGSize(width: width, height: 820) let size = CGSize(width: width, height: 820)
let columns = PanelLayout.columns(width: width) let columns = PanelLayout.columns(width: width)
let cardWidth = PanelLayout.cardWidth(size: size) let cardWidth = PanelLayout.cardWidth(size: size)
precondition(abs(CGFloat(columns) * cardWidth + CGFloat(columns - 1) * 8 - (width - 20)) < 0.001) precondition(abs(CGFloat(columns) * cardWidth + CGFloat(columns - 1) * 8 - (width - 20)) < 0.001)
let rows = PanelLayout.rowHeights(columns: columns, coreRows: 3, fanCount: 6) let rows = PanelLayout.rowHeights(columns: columns, coreRows: 3, fanCount: 6)
let requirements: [CGFloat] = [306, 332, 280, 280, 280, 280] let requirements: [CGFloat] = [246, 204, 256, 204, 260, 260]
for index in requirements.indices { for index in requirements.indices {
precondition(rows[index / columns] >= requirements[index]) precondition(rows[index / columns] >= requirements[index])
} }
@@ -27,7 +27,9 @@ import CoreGraphics
precondition(PanelLayout.needsResourceScroll(size: CGSize(width: width, height: 600), rows: rows)) precondition(PanelLayout.needsResourceScroll(size: CGSize(width: width, height: 600), rows: rows))
precondition(!PanelLayout.needsResourceScroll(size: CGSize(width: width, height: 2400), rows: rows)) precondition(!PanelLayout.needsResourceScroll(size: CGSize(width: width, height: 2400), rows: rows))
} }
precondition(PanelLayout.rowHeights(columns: 2, coreRows: 2, fanCount: 0) == [280, 280, 280]) precondition(PanelLayout.rowHeights(columns: 2, coreRows: 2, fanCount: 0) == [220, 204, 260])
precondition(PanelLayout.columns(width: 960) == 2 && PanelLayout.columns(width: 679) == 1)
precondition(!PanelLayout.needsResourceScroll(size: CGSize(width: 960, height: 800), rows: [220, 204, 260]))
let input: [ProcessMetrics] = (0..<2000).map { (index: Int) -> ProcessMetrics in let input: [ProcessMetrics] = (0..<2000).map { (index: Int) -> ProcessMetrics in
let id = ProcessIdentity(pid: Int32(index + 1), seconds: 1, microseconds: 0) let id = ProcessIdentity(pid: Int32(index + 1), seconds: 1, microseconds: 0)
let path: String? = index == 42 ? "/test/needle" : nil let path: String? = index == 42 ? "/test/needle" : nil
@@ -55,6 +57,6 @@ import CoreGraphics
} }
let pidSorted = ProcessTableProjection.rows(input, query: "", sorting: [ProcessSort(key: .pid)], order: []) let pidSorted = ProcessTableProjection.rows(input, query: "", sorting: [ProcessSort(key: .pid)], order: [])
precondition(pidSorted.first?.id.pid == 2000) precondition(pidSorted.first?.id.pid == 2000)
print("PASS: physical-row heights, column breakpoints, width conservation, resource scrolling, visible-frame bounds/chrome/negative origins, 2000-row CPU/RSS projection, frozen order, path search and empty results") print("PASS: physical-row heights, column breakpoints, width conservation, resource scrolling, visible-frame bounds/chrome/negative origins, 2000-row CPU/footprint projection, frozen order, path search and empty results")
} }
} }
+16 -1
View File
@@ -8,10 +8,12 @@ import SwiftUI
Task { @MainActor in Task { @MainActor in
var visible = false var visible = false
var settingsRequests = 0 var settingsRequests = 0
var observedSize = CGSize.zero
let controller = MenuPanelController(installStatusItem: false, visibility: { visible = $0 }, let controller = MenuPanelController(installStatusItem: false, visibility: { visible = $0 },
openSettings: { settingsRequests += 1 }) { _ in openSettings: { settingsRequests += 1 }) { _ in
IntervalControl(milliseconds: .constant(1000)) IntervalControl(milliseconds: .constant(1000))
.frame(maxWidth: .infinity, maxHeight: .infinity) .frame(maxWidth: .infinity, maxHeight: .infinity)
.background(PanelWindowObserver { observedSize = $0 }.frame(width: 0, height: 0))
} }
precondition(!controller.presentation.isPinned) precondition(!controller.presentation.isPinned)
precondition(controller.statusMenu().items.map(\.title) == ["open", "settings", "", "quit"]) precondition(controller.statusMenu().items.map(\.title) == ["open", "settings", "", "quit"])
@@ -20,7 +22,17 @@ import SwiftUI
try? await Task.sleep(for: .milliseconds(150)) try? await Task.sleep(for: .milliseconds(150))
precondition(controller.panel.isVisible && visible) precondition(controller.panel.isVisible && visible)
precondition(controller.panel.firstResponder === controller.panel, "Opening must not focus the interval editor") precondition(controller.panel.firstResponder === controller.panel, "Opening must not focus the interval editor")
let originalSize = controller.panel.contentLayoutRect.size
let compact = CGSize(width: min(760, originalSize.width), height: min(600, originalSize.height))
controller.panel.setContentSize(compact)
let geometryDeadline = ContinuousClock.now.advanced(by: .seconds(2))
while observedSize != compact && ContinuousClock.now < geometryDeadline { try? await Task.sleep(for: .milliseconds(20)) }
precondition(observedSize == compact, "Layout must follow the actual viewport, not assume screen maximum")
controller.panel.setContentSize(originalSize)
// Geometry reports and centering run on subsequent main-queue turns.
try? await Task.sleep(for: .milliseconds(200))
controller.presentation.isPinned = true controller.presentation.isPinned = true
controller.presentation.page = .processes
let cover = NSWindow(contentRect: controller.panel.frame.insetBy(dx: -8, dy: -8), let cover = NSWindow(contentRect: controller.panel.frame.insetBy(dx: -8, dy: -8),
styleMask: [.borderless], backing: .buffered, defer: false) styleMask: [.borderless], backing: .buffered, defer: false)
cover.isReleasedWhenClosed = false cover.isReleasedWhenClosed = false
@@ -42,7 +54,9 @@ import SwiftUI
while visible && ContinuousClock.now < hiddenDeadline { try? await Task.sleep(for: .milliseconds(20)) } while visible && ContinuousClock.now < hiddenDeadline { try? await Task.sleep(for: .milliseconds(20)) }
precondition(!visible && controller.presentation.isOpen, "OS visibility loss must stop demand without closing content/state") precondition(!visible && controller.presentation.isOpen, "OS visibility loss must stop demand without closing content/state")
controller.panel.makeKeyAndOrderFront(nil) controller.panel.makeKeyAndOrderFront(nil)
try? await Task.sleep(for: .milliseconds(150)) controller.panel.orderFrontRegardless()
let restoredDeadline = ContinuousClock.now.advanced(by: .seconds(2))
while !visible && ContinuousClock.now < restoredDeadline { try? await Task.sleep(for: .milliseconds(20)) }
precondition(visible, "OS visibility restoration must restore sampling demand") precondition(visible, "OS visibility restoration must restore sampling demand")
precondition(controller.panel.canBecomeKey && !controller.panel.canBecomeMain) precondition(controller.panel.canBecomeKey && !controller.panel.canBecomeMain)
precondition(controller.statusMenu().items.first?.title == "hide") precondition(controller.statusMenu().items.first?.title == "hide")
@@ -50,6 +64,7 @@ import SwiftUI
precondition(!controller.panel.isVisible && !visible) precondition(!controller.panel.isVisible && !visible)
controller.togglePanel() controller.togglePanel()
precondition(controller.panel.isVisible && visible) precondition(controller.panel.isVisible && visible)
precondition(controller.presentation.page == .overview, "Explicit reopening must select overview")
controller.statusMenu().performActionForItem(at: 1) controller.statusMenu().performActionForItem(at: 1)
precondition(settingsRequests == 1 && !controller.panel.isVisible) precondition(settingsRequests == 1 && !controller.panel.isVisible)
controller.show() controller.show()
+16
View File
@@ -39,6 +39,22 @@ import Foundation
precondition(unsupported.state == .unsupported && unsupported.rows.isEmpty) precondition(unsupported.state == .unsupported && unsupported.rows.isEmpty)
let unverified = monitor.update(processes: processes, readings: [reading(0, at: 25)], capability: .unverified) let unverified = monitor.update(processes: processes, readings: [reading(0, at: 25)], capability: .unverified)
precondition(unverified.rows.isEmpty && unverified.readable == 0) precondition(unverified.rows.isEmpty && unverified.readable == 0)
// Keep more than three measured processes and join by full identity, never PID alone.
let manyRows = (0..<12).map { row(ProcessIdentity(pid: Int32(100 + $0), seconds: 1, microseconds: 0), 0) }
let many = ProcessSnapshot(date: Date(), enumerated: 12, readable: 12, rows: manyRows, failed: false)
_ = monitor.update(processes: many, readings: manyRows.map { reading(0, at: 10, id: $0.id) }, capability: .verifiedCPU)
let all = monitor.update(processes: many, readings: manyRows.enumerated().map {
reading(UInt64($0.offset) * 1_000_000_000, at: 15, id: $0.element.id)
}, capability: .verifiedCPU)
precondition(all.rows.count == 12 && all.measured == 12 && all.state == .available)
let joined = many.withEnergy(all)
precondition(joined.rows[0].cpuPower == 0 && joined.rows[11].cpuPower == 2.2)
precondition(joined.rows[1].formattedPower == "200.0 mW" && joined.rows[11].formattedPower == "2.20 W")
var reused = manyRows[0]
reused = row(ProcessIdentity(pid: reused.id.pid, seconds: 2, microseconds: 0), 0)
let replacement = ProcessSnapshot(date: Date(), enumerated: 1, readable: 1, rows: [reused], failed: false)
precondition(replacement.withEnergy(all).rows[0].cpuPower == nil)
precondition(joined.withEnergy(nil).rows.allSatisfy { $0.cpuPower == nil && $0.powerWindow == nil })
print("PASS: exact large-integer deltas, first/zero/reset/reuse/gap/error/time boundaries, energy-vs-CPU ranking, partial coverage and no CPU fallback") print("PASS: exact large-integer deltas, first/zero/reset/reuse/gap/error/time boundaries, energy-vs-CPU ranking, partial coverage and no CPU fallback")
} }
} }
+6
View File
@@ -28,6 +28,12 @@ import Foundation
precondition(sorted.last?.id == replacement.id, "Missing footprint sorts last in both directions") precondition(sorted.last?.id == replacement.id, "Missing footprint sorts last in both directions")
precondition(sorted.first?.id == (direction == .forward ? row.id : large.id)) precondition(sorted.first?.id == (direction == .forward ? row.id : large.id))
} }
var low = row, high = large, zero = replacement
low.cpuPower = 0.01; high.cpuPower = 3; zero.cpuPower = 0
for direction in [SortOrder.forward, .reverse] {
let sorted = ProcessTableProjection.rows([row, high, low, zero], query: "", sorting: [ProcessSort(key: .power, order: direction)], order: [])
precondition(sorted.last?.cpuPower == nil && sorted.first?.cpuPower == (direction == .forward ? 0 : 3))
}
print("PASS: filtered/live selection, absent selection/snapshot, failed enumeration, actual exit and PID reuse") print("PASS: filtered/live selection, absent selection/snapshot, failed enumeration, actual exit and PID reuse")
} }
} }
+3
View File
@@ -26,6 +26,7 @@ import Observation
preferences.panelMilliseconds = 500 preferences.panelMilliseconds = 500
preferences.backgroundMilliseconds = 1_800_000 preferences.backgroundMilliseconds = 1_800_000
let store = MetricsStore(sampling: preferences) let store = MetricsStore(sampling: preferences)
store.setDetailDemand(processes: true, slowMetrics: false)
store.setPanelVisible(true) store.setPanelVisible(true)
try await until { store.processSnapshot != nil } try await until { store.processSnapshot != nil }
precondition(store.effectiveMilliseconds == 500) precondition(store.effectiveMilliseconds == 500)
@@ -74,6 +75,7 @@ import Observation
changing.panelMilliseconds = 500 changing.panelMilliseconds = 500
changing.backgroundMilliseconds = 1_800_000 changing.backgroundMilliseconds = 1_800_000
let changingStore = MetricsStore(sampling: changing, sampler: SystemSampler(processRead: { slowRead.read(&$0) })) let changingStore = MetricsStore(sampling: changing, sampler: SystemSampler(processRead: { slowRead.read(&$0) }))
changingStore.setDetailDemand(processes: true, slowMetrics: false)
changingStore.setPanelVisible(true) changingStore.setPanelVisible(true)
try await until { !changingStore.history.samples.isEmpty } try await until { !changingStore.history.samples.isEmpty }
precondition(changingStore.processSnapshot == nil) precondition(changingStore.processSnapshot == nil)
@@ -92,6 +94,7 @@ import Observation
try await Task.sleep(for: .milliseconds(650)) try await Task.sleep(for: .milliseconds(650))
precondition(dormant.history.samples.isEmpty && dormant.snapshot.memory == nil, precondition(dormant.history.samples.isEmpty && dormant.snapshot.memory == nil,
"Hidden without a consumer must not perform even an initial full sample") "Hidden without a consumer must not perform even an initial full sample")
dormant.setDetailDemand(processes: true, slowMetrics: false)
dormant.setPanelVisible(true) dormant.setPanelVisible(true)
try await until { dormant.processSnapshot != nil } try await until { dormant.processSnapshot != nil }
dormant.setPanelVisible(false) dormant.setPanelVisible(false)
+1
View File
@@ -53,6 +53,7 @@ import Foundation
let reopened = await sampler.sample() let reopened = await sampler.sample()
precondition(reopened.processes == nil) precondition(reopened.processes == nil)
let store = MetricsStore() let store = MetricsStore()
store.setDetailDemand(processes: true, slowMetrics: false)
store.setPanelVisible(true) store.setPanelVisible(true)
for _ in 0..<40 { for _ in 0..<40 {
if store.processSnapshot != nil { break } if store.processSnapshot != nil { break }
+2 -2
View File
@@ -17,7 +17,7 @@ CORE = sorted(str(p.relative_to(ROOT)) for folder in ("Models", "Monitors", "Ser
for p in (ROOT / "kymo/Core" / folder).glob("*.swift")) for p in (ROOT / "kymo/Core" / folder).glob("*.swift"))
CHECKS = {name: list(CORE) for name in ( CHECKS = {name: list(CORE) for name in (
"SamplingChecks", "SamplingIntervalChecks", "UnifiedPanelChecks", "MemoryChecks", "SamplingChecks", "SamplingIntervalChecks", "UnifiedPanelChecks", "MemoryChecks",
"GPUStatisticsChecks", "StageCChecks", "MachPortChecks", "ReleaseServiceChecks")} "GPUStatisticsChecks", "StageCChecks", "MachPortChecks", "ReleaseServiceChecks", "DetailDemandChecks")}
CHECKS.update({ CHECKS.update({
"BackgroundTrendChecks": CORE + ["kymo/UI/Charts/PanelCurveGeometry.swift"], "BackgroundTrendChecks": CORE + ["kymo/UI/Charts/PanelCurveGeometry.swift"],
"ProcessEnergyChecks": ["kymo/Core/Models/ProcessMetrics.swift", "kymo/Core/Models/ProcessEnergy.swift", "kymo/Core/Monitors/ProcessEnergyMonitor.swift"], "ProcessEnergyChecks": ["kymo/Core/Models/ProcessMetrics.swift", "kymo/Core/Models/ProcessEnergy.swift", "kymo/Core/Monitors/ProcessEnergyMonitor.swift"],
@@ -56,7 +56,7 @@ CHECKS.update({
"LanguageScopeChecks": ["kymo/Core/Services/LanguagePreferences.swift", "kymo/UI/Components/AppLanguageScope.swift"], "LanguageScopeChecks": ["kymo/Core/Services/LanguagePreferences.swift", "kymo/UI/Components/AppLanguageScope.swift"],
"SettingsWindowChecks": ["kymo/Core/Services/SettingsPresentation.swift", "kymo/Features/Settings/SettingsWindowLifecycle.swift"], "SettingsWindowChecks": ["kymo/Core/Services/SettingsPresentation.swift", "kymo/Features/Settings/SettingsWindowLifecycle.swift"],
"PanelWindowChecks": ["kymo/Features/MenuBar/MenuPanelController.swift", "kymo/Features/MenuBar/PanelLayout.swift", "PanelWindowChecks": ["kymo/Features/MenuBar/MenuPanelController.swift", "kymo/Features/MenuBar/PanelLayout.swift",
"kymo/UI/Components/IntervalControl.swift"], "kymo/Features/MenuBar/PanelWindowObserver.swift", "kymo/UI/Components/IntervalControl.swift"],
"SandboxNetworkChecks": ["kymo/Core/Services/PublicIPAddressService.swift"], "SandboxNetworkChecks": ["kymo/Core/Services/PublicIPAddressService.swift"],
}) })
GUI = {"NativeMetricDrawingChecks", "NativeContentHostChecks", "NativeProcessTableChecks", "LanguageScopeChecks", "SettingsWindowChecks", "PanelWindowChecks"} GUI = {"NativeMetricDrawingChecks", "NativeContentHostChecks", "NativeProcessTableChecks", "LanguageScopeChecks", "SettingsWindowChecks", "PanelWindowChecks"}