refactor(project): 清理闲置展示链路与重复采样状态
This commit is contained in:
+45
-80
@@ -4,114 +4,79 @@
|
|||||||
|
|
||||||
| 位置 | 当前职责 |
|
| 位置 | 当前职责 |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| `kymo/App` | AppKit 入口、应用生命周期、依赖装配、主菜单与 SwiftUI Settings 场景 |
|
| `kymo/App` | AppKit 入口、生命周期、依赖装配、主菜单和 SwiftUI Settings 场景 |
|
||||||
| `kymo/Features/MenuBar` | `NSStatusItem`、监控 `NSPanel`、资源卡片、进程表与业务展示投影 |
|
| `kymo/Features/MenuBar` | 状态项、监控 NSPanel、概览卡片、进程表、业务展示投影与本地验证驱动 |
|
||||||
| `kymo/Features/Settings` | 通用 / 关于设置页、设置窗口焦点与 Dock 生命周期 |
|
| `kymo/Features/Settings` | 通用 / 关于设置页、窗口焦点和 Dock 生命周期 |
|
||||||
| `kymo/Core/Monitors` | 系统采样与报告解析;`SystemSampler` 协调基线和慢任务 |
|
| `kymo/Core/Monitors` | 系统采样、报告解析与 SystemSampler actor |
|
||||||
| `kymo/Core/Services` | `MetricsStore`、偏好、XPC 客户端、网络地址、保持唤醒、诊断与能力探测 |
|
| `kymo/Core/Services` | MetricsStore、偏好、XPC 客户端、网络地址、保持唤醒与诊断 |
|
||||||
| `kymo/Core/Models` | 指标快照、历史、进程身份和硬件指标模型 |
|
| `kymo/Core/Models` / `Extensions` | 指标、进程身份、有界历史 / 格式化 |
|
||||||
| `kymo/Core/Extensions` | 指标格式化 |
|
| `kymo/UI` | 无业务副作用的卡片、图表、控件、外观与本地化宿主 |
|
||||||
| `kymo/UI` | 图表、卡片、控件、悬浮呈现、外观与本地化宿主等可复用展示能力 |
|
| `kymo/Resources` / `Assets.xcassets` | 三语字符串 / 颜色和图片 |
|
||||||
| `kymo/Resources` / `kymo/Assets.xcassets` | 字符串目录 / 颜色与图片 |
|
| `SMARTService` | 按需只读 XPC:温度、风扇、SMART、同 UID 进程 footprint 与 CPU 能量 |
|
||||||
| `SMARTService` | 独立 XPC Target,读取磁盘报告、CPU / GPU 温度、风扇和同 UID 进程 CPU 能量计数 |
|
|
||||||
|
|
||||||
`Dashboard` 目录仅有占位文件,没有独立总览功能。统一监控面板位于 MenuBar。
|
App 装配依赖,方向为 Features → UI → Core → 系统 API。Features 可使用窗口所需 AppKit / SwiftUI;模块之间通过 App 注入动作与 Core 状态协作,无横向依赖。Core 不引用 Features 或 UI。SettingsPresentation 仅表示展示请求,不持有窗口。
|
||||||
|
|
||||||
依赖由 App 装配;Features 使用 UI、Core 和窗口所需的 AppKit / SwiftUI,UI 使用 Core 与系统 UI API,Core 不引用 Features 或 UI。Features 之间通过 App 注入动作与 Core 状态协作,无横向引用。`SettingsPresentation` 是设置展示请求状态,不持有窗口。
|
## 窗口与界面
|
||||||
|
|
||||||
## 应用与窗口
|
入口 kymoApp.main() 启动 NSApplication,由 ApplicationLifecycle 管理;应用以 accessory 模式启动,通过 NSHostingSceneRepresentation 注册 Settings。
|
||||||
|
|
||||||
入口为 `kymoApp.main()`,由 `NSApplication` 与 `ApplicationLifecycle` 驱动,当前不使用 `MenuBarExtra`。应用以 accessory 模式启动,通过 `NSHostingSceneRepresentation` 注册 Settings 场景。
|
MenuPanelController 拥有模板品牌 NSStatusItem 和无边框、可成为 key 的非激活 MonitoringPanel。左键切换面板,右键提供打开 / 隐藏、设置和退出。窗口以状态项所在屏幕可见区域为边界,水平居中,边缘至少留 16pt;最大宽 640pt,常规高 658pt,按卡片内容预算调整,最大高 800pt,并受实际屏幕限制。
|
||||||
|
|
||||||
`MenuPanelController` 拥有模板品牌状态项和无边框、可成为 key 的非激活 `MonitoringPanel`。左键切换面板;右键菜单提供打开 / 隐藏、设置和退出。面板不播放开关窗动画、不添加装饰阴影。窗口按状态项所在屏幕可见区域定位,水平居中、顶部预留 16pt;最大宽度 640pt,常规内容高度 658pt;按卡片结构预算可升降,最大 800pt,并按屏幕缩小。面板顶部为概览 / 进程页签,每次显式打开重置概览。常规概览为独立双列:左 CPU / GPU / 内存,右电池 / 存储 / 网络,不强制同行同高;普通两行核心 / 一行风扇配置在内存精简后两列总高均为 564pt,其他硬件仍按实际内容定高。宽度小于 560pt 时退为单列,高度不足时滚动。进程页独占中间内容区。底栏左侧显示设备信息,右侧依次为运行时间与刷新间隔。640pt 下品牌 / 居中页签 / 操作组处于顶部同一行;只有宽度小于 560pt 时将页签另放一行,避免极窄屏重叠。几何观察器以实际 contentLayoutRect 和屏幕上限共同确定布局尺寸。
|
每次显式打开进入概览。概览独立双列:左 CPU / GPU / 内存,右电池 / 存储 / 网络。两行 CPU 核心与一行风扇时两列均高 564pt。宽度小于 560pt 退为单列并将页签另放一行;高度不足时滚动。进程页独占中间内容区,两页共用窗口尺寸。底栏显示设备信息、开机时间和刷新间隔。
|
||||||
|
|
||||||
固定按钮切换普通 / floating 层级。未固定时外部交互或应用失活可收起,固定时仍可通过状态项或显式关闭收起。进程表的 Esc 依次处理搜索、选中和搜索焦点,随后关闭窗口。隐藏面板时先卸载内容视图、关闭底层窗口资源(保留控制器拥有的窗口对象供重开),并停止监听外部鼠标事件;仅显式启用后台趋势时保留常规采样。
|
核心数由静态拓扑、硬件核数及快照共同确定;核心单元格按宽度增加行数,避免文字挤压。风扇在本次打开保留已发现槽位。实际卡片宽度和窗口 contentLayoutRect 驱动布局;仅结构预算变化才请求调整窗口高度。
|
||||||
|
|
||||||
设置窗口打开时切换 regular 模式并处理焦点恢复,关闭时由 `SettingsWindowLifecycle` 恢复 accessory 模式。关闭最后一个窗口不会退出应用。应用退出时关闭状态项、释放窗口引用及保持唤醒断言。
|
固定按钮切换 normal / floating 层级。未固定时外部交互或应用失活收起;固定仍可显式关闭。进程表 Esc 依次清空搜索、清除选择、退出搜索焦点,然后关闭面板。隐藏卸载内容、关闭底层窗口资源并移除外部鼠标监听,控制器保留窗口对象供重开。presentation.isOpen 控制内容装配,采样可见性同时要求窗口 isVisible 与 occlusionState 可见;完全遮挡降级采样而保留内容及交互状态。
|
||||||
|
|
||||||
## 采样与发布
|
设置窗口打开时转为 regular 模式并恢复焦点,SettingsWindowLifecycle 在关闭后恢复 accessory。关闭最后一个窗口不退出应用;退出时清理状态项、窗口、通知和保持唤醒断言。
|
||||||
|
|
||||||
|
## 采样、状态与并发
|
||||||
|
|
||||||
```text
|
```text
|
||||||
系统 API ──→ SystemSampler actor ──→ MetricsSnapshot
|
系统 API → SystemSampler actor → MetricsSnapshot → MetricsStore(MainActor)
|
||||||
│ │
|
│ ├─ snapshot → 概览
|
||||||
├─ 慢任务缓存 ▼
|
├─ 慢任务缓存 ├─ processSnapshot / energy → 进程表
|
||||||
└─ 可见时进程任务 MetricsStore(MainActor)
|
└─ 单在途进程任务 └─ MetricHistory → 趋势图
|
||||||
├─ snapshot → 资源卡片
|
SMARTService(XPC)→ 只读客户端 → 慢缓存 / 进程任务
|
||||||
├─ processSnapshot → 进程表
|
实际可见性、页面需求、睡眠与偏好 → MetricsStore 调度
|
||||||
├─ energy → 进程表 CPU 功率列
|
|
||||||
└─ MetricHistory → 趋势图
|
|
||||||
面板实际可见性 / 系统和显示器睡眠 / SamplingPreferences ──────────→ 调度切换
|
|
||||||
SMARTService(XPC)──→ 温度 / 风扇 / SMART 客户端 ──→ 慢任务缓存
|
|
||||||
```
|
```
|
||||||
|
|
||||||
`MetricsStore` 是 MainActor 上的可观察状态。新配置默认隐藏时不启动采样 Task,展开使用前台间隔;显式启用后台趋势时,隐藏使用后台间隔(新配置 30 秒)。旧配置中存在合法后台间隔且没有显式开关时保留启用状态与间隔,显式关闭优先。无后台需求时隐藏停止采样,重开重置速率基线并标记历史断点。周期以单调时钟按每轮开始时间安排,不补跑错过的批次;间隔修改按上次发布时间调整下一轮。等待显式允许周期 10% 的调度容差,前台最多 200ms、后台最多 1 秒;资源速率仍按实际经过时间差分,容差不改变配置值。
|
MetricsStore 是 MainActor 可观察状态。App 将 PanelPage 转换为 setDetailDemand(processes:slowMetrics:);Core 不依赖页面类型。概览不枚举进程或读取进程 footprint / 能量;进程页不新发起概览传感器、卷、慢报告和公网请求。两页继续基础系统采样与历史,不因切页重置 CPU / 网络 / 磁盘 IO 基线或制造断点。
|
||||||
|
|
||||||
`SystemSampler` actor 持有 CPU、网络、磁盘 IO 差分基线。CPU / 内存每次 Mach 查询取得的 host 发送权在调用结束(含失败路径)释放。卷列表与进程读取放入 utility detached Task;温度、磁盘健康、电池健康独立更新缓存,各类慢任务最多一个在途;隐藏后台趋势不新发起传感器、卷或慢报告读取。慢指标可晚于快照更新,周期详见[监控指标](monitoring.md)。
|
新配置隐藏不采样;显式启用后台趋势后使用后台间隔,默认 30 秒。已有数值后台间隔且没有显式开关时保留启用状态,显式关闭优先。面板可见默认 2 秒,范围与各指标周期见[监控指标](monitoring.md)。周期按单调时钟从每轮开始安排,不补跑错过轮次;配置变化参考上次发布时间。允许 10% 周期容差,前台最多 200ms、后台最多 1 秒,速率仍按实际经过时间差分。
|
||||||
|
|
||||||
进程只在请求进程详情、面板可见且未暂停时读取。App 将 Features 的 PanelPage 转为 Core 的 setDetailDemand(processes:slowMetrics:) 开关;Core 不引用页面类型。概览不枚举进程、不读取 footprint 或 CPU 能量;进程页不发起温度 / 风扇、卷和慢报告读取。已开始的慢报告可能自行结束并更新缓存。两页维持基础系统采样与有界历史,切页不重置 CPU / 网络 / IO 基线、不制造历史断点。进程结果可异步单独发布到 processSnapshot,资源 snapshot 的 processes 保持 nil;能耗独立发布到 energy。进程及能量由独立进程页订阅。只装配当前页;轻量搜索 / 排序 / 选择状态由父层持有,切页卸载原生表格或卡片宿主,显式关闭则释放这些交互状态。可见性代次和调度代次阻止过期结果回写;隐藏时清除已发布进程,重新打开重建基线。同步系统调用即使不能及时取消,也会占用原在途槽,避免重叠读取。路径按完整身份与命令名缓存 30 秒(包含失败结果),每轮复用一个路径缓冲;枚举失败清空缓存,末次身份复核保留。进程退出提示以原始成功快照中的完整身份为准,搜索过滤和枚举失败不作为退出证据。
|
SystemSampler actor 持有差分基线。CPU / 内存 Mach 查询取得的 host 发送权在调用结束释放。卷和进程枚举使用 utility detached Task;温度、磁盘健康、电池健康各最多一个慢任务在途。缓存可晚于快照更新,已开始的系统调用可能在需求结束后完成。快照仅保留当前消费者需要的数据;GPU 总占用直接由 gpu.usage 派生。
|
||||||
|
|
||||||
暂停取消采样发布、停用进程更新,保留当前快照和历史;已启动慢读取可能自行结束。恢复时重置 CPU / 网络 / IO 基线,历史标记断点。全局及每接口历史各最多 60 点,接口移除时清理其历史;实际覆盖时长由采样间隔决定。每点的 expectedInterval 表示其后等待下一点的计划周期;需求连续的重新调度将最长周期记入最近点,即使短暂隐藏未到后台采样截止也不丢失慢周期。下一点重新使用当前配置。图表和 GPU 平均统计只用左端点周期判断当前段,避免反向放宽旧空档,详见[后台趋势修复](background-trend-continuity-fix.md)。绘图按序列跳过无值节点并连接有效点,保留原时间轴和有效 0;显式停采断点、过长采样空档与倒序仍断线,空值点携带的断点也必须检查。原历史保留 nil,悬浮缺失值仍显示 --、无测量点标记;GPU 平均统计继续排除缺失区间。详见[无值点绘图规则](chart-missing-value-policy.md)。
|
进程数据独立发布到 processSnapshot,避免触发资源卡片观察者;能量独立发布,仅保留完整进程身份、功率和统计窗口,测量数量由结果行数派生,排序统一由进程表投影负责。需求代次同时在 Store 与 actor 校验,旧结果不能复活隐藏需求。失效的同步进程读取仍占用单在途槽位,完成后立即补读新代次,无需等待下一轮。
|
||||||
|
|
||||||
## XPC 与系统边界
|
暂停停止周期发布、停用进程更新并保留快照和历史;恢复重置基线并标记历史断点。系统睡眠停止采样;息屏停用前台、进程、能量、公网与慢读取,只保留显式后台趋势。NSWorkspace 事件由 App 转发。
|
||||||
|
|
||||||
主应用启用 App Sandbox,并声明网络客户端权限以访问公网地址 HTTPS 服务;嵌入的 `SMARTService.xpc` 未启用 App Sandbox,启用 Hardened Runtime。它是按需启动的只读辅助服务,不是 root 守护进程,也不执行 SMC 写操作。本机 CLI adhoc 构建的签名 flags 为 adhoc,Xcode 对此会禁用 Hardened Runtime;工程配置启用不等于本次产物已完成正式开发者签名 / 公证验证。
|
历史全局及每接口各最多 60 点,接口移除时清理其历史。每点 expectedInterval 表示其后的计划等待;连续需求重新调度将最长等待记入最近点。绘图按真实时间跳过 nil / 非有限节点,连接有效点,保留有效 0;显式停采、长空档和倒序仍断线,包括空值点携带的断点。原数据不补值,缺失时刻无悬浮测量标记。
|
||||||
|
|
||||||
客户端按包内服务的实际指定签名设置连接要求;服务端要求同 UID,并按所在主应用的实际指定签名校验调用方。温度 / 风扇请求超时 2 秒,SMART 请求超时 15 秒;中断、错误、超时与正常响应统一通过一次性 continuation 完成并关闭连接,完成或取消立即取消超时 DispatchSource;请求支持 Task 取消,包括取消先于安装 continuation 的竞态。包内服务指定签名在客户端进程内只读取一次;每条连接仍设置验证要求。
|
## 展示与本地状态
|
||||||
|
|
||||||
CPU / GPU / 风扇合并为一次只读 XPC 请求,按到期类别选择读取;服务进程共享 actor 隔离的传感器发现缓存。各类别成功后至少 10 秒再读,失败独立按 60 / 120 / 240 / 480 / 600 秒退避,其他类别成功不重置失败退避。服务重启后重新发现;不声称缓存跨服务进程退出保留。
|
ResourceCard 通过 NativeContentHost 使用固定尺寸的独立 NSHostingView,完整传递字体、颜色、语言及外观环境;更新沿用挂载身份,卸载清空子宿主内容。图表锚点和提示层在同一卡片宿主内处理。NativePanelCurve 绘制静态曲线、网格和悬浮标记,只在数据、几何或外观变化时更新。数字和进度条直接展示最终值;不创建应用自定义动画、面积渐变、遮罩、背景模糊或装饰阴影。
|
||||||
|
|
||||||
公网 IP 由 `PublicIPAddressService` 在面板网络任务中访问外部 HTTPS 服务,和本地接口采样分开。任务仅概览挂载且实际可见时持续刷新:成功缓存 600 秒,失败 30 秒后重试,超时 5 秒;有效期使用单调时间。路由键变化、暂停或面板隐藏取消旧任务的请求及等待,取消结果不缓存、不发布。保持唤醒通过两个进程级 IOPM 断言阻止用户空闲息屏与系统空闲睡眠,开关不持久化,失败时释放已取得断言,关闭或退出时释放。
|
概览与设置共享 NeutralTabPicker,使用静态 AppKit 按钮组;保留 tabGroup / tabButton 语义、选中值与键盘导航。绑定仅传递选择,页面和采样生命周期由上层负责。
|
||||||
|
|
||||||
## 状态与资源
|
进程列表使用 view-based NSTableView,只创建可见单元格并原地更新。ProcessTableProjection 负责搜索、排序及悬停 / 选择 / 搜索期间的顺序保持。选择由完整 ProcessIdentity 同步,原生委托回调之后才写回 SwiftUI。列依次为 PID、名称、CPU、内存、CPU 功率、线程数、路径;路径末列可横向滚动,支持排序及复制。ProcessIconCache 保存 30×30 像素缩略图,最多 128 项 / 1 MiB,30 秒过期、LRU 淘汰、内存压力清空,无轮询任务。
|
||||||
|
|
||||||
外观、语言和双采样间隔写入 UserDefaults。图钉、暂停、保持唤醒和进程表交互状态不作为持久化偏好。`AppLanguageScope` 将语言环境注入 AppKit 承载的 SwiftUI 内容,并处理即时刷新;原生菜单文案通过 `AppLocalization` 读取;编号风扇等 SwiftUI 文案保留为带参数的 `Text`,由当前应用语言环境解析。
|
外观、语言和采样配置写入 UserDefaults;固定、暂停、保持唤醒与进程交互不持久化。旧减弱动画偏好键忽略但不清除。AppLanguageScope 传递应用语言并刷新宿主,AppLocalization 为原生菜单取文案;编号风扇保留参数化 Text。
|
||||||
|
|
||||||
面板和资源卡片使用颜色资产中的不透明背景,顶部操作组与页签使用低透明度静态胶囊背景;不再以全窗口液态玻璃概念图作为实现依据。品牌图标与颜色以 Assets 为运行时来源。
|
## XPC 与数据边界
|
||||||
|
|
||||||
固定 frame 的面板宿主关闭 NSHostingView 自动尺寸协商。每张 ResourceCard 通过 UI 层 NativeContentHost 获得独立、固定尺寸的 NSHostingView,局部数据和状态更新在卡片宿主内处理;父层按稳定列顺序、内容行数和硬件拓扑计算卡片尺寸,并经 App 注入首选高度回调交给 MenuPanelController 约束到屏幕可用区域。窗口高度取较长列加顶部、底栏和间隔,两页共用外框;结构预算相同不触发重复 setFrame,数值刷新不改变高度。核心数优先使用静态拓扑 / 硬件核数,避免首帧无值收缩;风扇在本次打开保留已发现槽位,确认无风扇时可移除发现占位。完整 SwiftUI 环境注入子宿主,保留字体、前景样式、语言和外观;更新沿用原有挂载身份,卸载时清空子宿主内容。坐标、图例、悬浮偏好与提示层都保留在同一卡片宿主内,不跨原生边界传递锚点。趋势图的业务投影继续由 Features 管理;曲线 / 网格 / 悬浮标记与百分比圆环分别由 UI 层 NativePanelCurve、NativeMetricRing 绘制。保留 PanelCurveGeometry 的真实时间、缺失值与断点规则。
|
主应用启用 App Sandbox 和出站网络权限;SMARTService 不启用沙盒,启用 Hardened Runtime,是同用户按需启动的只读服务,不是 root 守护进程,不写 SMC。客户端以包内服务实际 designated requirement 限制连接;服务按同 UID 和所属主应用的实际签名要求认证调用方。
|
||||||
|
|
||||||
进程表使用 MenuBar 的 NativeProcessTable(view-based NSTableView),继续消费 ProcessTableProjection 的搜索 / 排序 / 冻结投影。仅创建可见单元格,行数改变时增删尾行,刷新时原地修改可见文本与图像;选择以完整 ProcessIdentity 同步,用户选择 / 排序延后到委托回调之外写回 SwiftUI。原生 Esc 转发至原有分层退出逻辑,右键菜单保留复制能力。共享 ProcessIconCache 将 NSWorkspace 原图绘制为 30×30 像素、15pt 的单一位图,不保留原图;最多 128 项 / 1 MiB 解码像素,30 秒过期、LRU 淘汰、内存压力清空,不启动轮询。其预算不代表系统图标服务内部缓存已受控。
|
ServiceRequest 统一一次性完成响应、错误、中断、超时和取消,并释放计时器与连接。温度 / 风扇超时 2 秒,SMART 超时 15 秒。传感器发现由服务 actor 缓存,各能力独立退避。进程 footprint 和能量经原有签名认证服务批量读取,最多 256 项 / 请求 64 KiB / 响应 256 KiB;客户端总截止 3 秒、单请求 1.5 秒,服务每批 1 秒。服务限制同 UID、PID 与启动时间,能量额外校验请求 UUID、启动标记和计数。进程单在途任务先合并 footprint 再发布、调度能量;缺失内存不回退 RSS。具体口径见[监控指标](monitoring.md)。
|
||||||
|
|
||||||
进程表列顺序为 PID / 名称 / CPU / 内存 / CPU 功率 / 线程数 / 路径。路径保持末列的弹性宽度与横向滚动,排序和复制按稳定列标识及进程身份处理,不依赖显示位置。
|
system_profiler / diskutil 共用 BoundedProcess,流式保留最多 256 KiB,额外至多读 1 字节检测溢出;10 秒截止、超限或调用 Task 取消时终止并回收本轮直接子进程。取消管道唤醒 poll,无周期检查计时器,不杀其他进程。XPC 断开尚不保证取消已进入服务的报告任务。
|
||||||
|
|
||||||
资源监控统一采用静态呈现:MetricText 直接显示最新字符串,圆环和进度条直接使用最终比例;趋势图保留 Core Graphics 贝塞尔路径、网格、真实时间、有效点接续、显式断点和悬浮标记,只在数据 / 几何 / 外观变化时更新,不生成过渡帧、移动变换或逐帧任务。曲线不再绘制面积渐变或遮罩;空的尾部序列不创建图层。CATransaction 禁止原生图层隐式动画,面板与设置的 SwiftUI transaction 禁止应用自定义插值。旧 MetricMotion、共享收尾定时器和滚动几何已删除。设置移除减弱动画开关,AppearancePreferences 只管理外观;旧 appearance.reduceMotion 键忽略但不清除,不影响外观、语言和采样偏好。后台记录继续只由 SamplingPreferences 控制。悬浮提示和旧详情窗使用不透明颜色背景,无 NSVisualEffectView、入场缩放 / 淡入及装饰阴影。此决定替代此前保留原动效的方案;历史数据见[1.1 初版记录](v1.1-efficiency-plan.md),当前实现与验收见[静态呈现计划](static-presentation-plan.md)。
|
PanelPublicIPRefresh 由概览挂载并控制请求及等待生命周期。路由键包含主接口候选、路径状态和全部活动地址,地址变化可能触发额外刷新。PublicIPAddressService 使用专用 ephemeral URLSession,禁用 URLCache、Cookie 和凭据存储;600 秒成功 / 30 秒失败缓存仅在内存。取消结果不缓存或发布。该约束不覆盖 macOS 容器元数据、日志、崩溃报告或旧版遗留数据。
|
||||||
|
|
||||||
`PanelResourceAudit` 与纯文字对照渲染器仅在 Debug 或显式 `KYMO_AUDIT` 编译条件下包含实现;普通 Release 不包含诊断驱动与文字列表实现。测试构建还需设置 `KYMO_RESOURCE_AUDIT=1` 才驱动真实面板测试生命周期,App 只装配调用。正常启动不创建测试任务;该入口不是鼠标 / AX 交互验证。诊断日志仍需 `KYMO_DIAGNOSTICS=1` 显式开启;静态版保留兼容字段 animatedPlots 并固定为 0;审计标记附带原生图区数量 / 尺寸、悬浮状态和指针是否在面板内,窗口编号只在可见时读取。
|
保持唤醒使用两个进程级 IOPM 断言阻止用户空闲息屏与系统空闲睡眠;失败、关闭或退出释放。Release 与服务配置 Hardened Runtime;本地 ad-hoc 签名不等同于 Developer ID 和 Apple 公证,详见[测试分发](free-test-distribution.md)。
|
||||||
|
|
||||||
外部 `system_profiler` / `diskutil` 报告共用 Core 的 `BoundedProcess`(同时编入 XPC Target)。utility 队列阻塞于输出 / 取消 / 退出事件,累计保留输出不超过 256 KiB,最多多读 1 字节判断溢出;10 秒截止、输出超限或调用 Task 取消时 SIGKILL 本轮直接子进程并等待回收。子进程关闭 stdout 后不退出也受截止约束。取消管道唤醒 poll,无周期检查计时器;不杀进程组或其他进程。此取消能力不代表 XPC 连接断开已传播到服务内部 Task,暂停后已启动慢报告的上层取消仍需完善。
|
## 验证能力与边界
|
||||||
|
|
||||||
## 实际需求与能量数据流
|
SamplingDiagnostics 仅在 KYMO_DIAGNOSTICS=1 时输出 JSON 行。PanelCapabilityProbe 显式开启才运行。PanelResourceAudit 的真实面板生命周期 / 局部截图 / XPC 检查只在 Debug 或 KYMO_AUDIT 构建中包含,普通启动不创建验证任务,普通 Release 不包含驱动实现。验证参数见[开发指南](development.md)。
|
||||||
|
|
||||||
控制器分别维护 presentation.isOpen(内容装配)和采样可见性(isVisible 且 occlusionState 可见),监听窗口遮挡通知和 isVisible KVO。固定面板完全遮挡或 orderOut 后按隐藏需求降级,恢复后补采;遮挡不销毁已打开内容和表格交互状态,显式隐藏仍卸载内容。App 仅转发 NSWorkspace 的系统 / 显示器睡眠事件。系统睡眠停止全部周期采样;息屏停止前台、进程、能量、公网和慢读取,只允许用户显式开启的后台趋势。保持唤醒仍由用户独立控制。
|
独立检查、实际应用交互和长期性能是不同证据。已开始的慢报告取消、极大进程集合在总截止内的公平性、跨硬件指标支持及真实多屏仍存在验证边界,详见[测试与验证](testing.md)。
|
||||||
|
|
||||||
Store 将递增需求代次交给 SystemSampler;actor 在开始系统调用前拒绝过期代次,旧停止不能覆盖新恢复,旧采样不能复活已隐藏需求。异步结果仍需通过 MainActor 和 actor 两侧代次检查。重建需求使能量基线失效;不能跨暂停或睡眠差分。
|
|
||||||
|
|
||||||
一次成功进程枚举的全部已识别行进入 ProcessEnergyServiceClient,不按 CPU 预筛选。签名认证 XPC 每批最多 256 项 / 请求 64 KiB,总客户端截止 3 秒、每请求最多 1.5 秒;服务串行读取(忙时拒绝),每批截止 1 秒。服务限制同 UID,读取前后复核 PID + 启动时间,返回原请求 UUID、Mach 启动标记、单调时间及 UInt64 能量。客户端复核 UUID、身份集合与响应大小。受限或超时部分明确反映为覆盖不全。
|
|
||||||
|
|
||||||
ProcessEnergyMonitor 在相同身份、Mach 启动标记和连续有效计数间,以整数先相减再转浮点,得到 nJ / 秒 / 1e9 的 W;保留全部有效测量,不添加 CPU 代理。进程页将其按完整 ProcessIdentity 合并到当前列表,显示 CPU 功率 W/mW 与实际统计窗口,支持双向排序;缺失值显示 -- 且两方向均排末。覆盖数、等待、不支持及不可用状态在表头下方展示。失败、缺失、计数回退、重建需求均使旧基线失效。普通间隔最长允许 30 秒差分;用户设置长采样间隔时放宽至两倍前台间隔、上限 3600 秒,并显示实际窗口。详情见监控口径。
|
|
||||||
|
|
||||||
网络展示和诊断文字窗口共用 PanelPublicIPRefresh,遵循同一可见 / 暂停 / 睡眠与缓存策略。出口键仍包含全部活动地址,L07 尚待修正。外观观察器在挂载后延迟初始化,避免每次 View 值构造就创建 KVO / 通知订阅者。
|
|
||||||
|
|
||||||
## 进程内存读取
|
|
||||||
|
|
||||||
ProcessMonitor 负责枚举、身份、CPU / 线程 / 路径;不把 RSS 写入进程内存列。SystemSampler 现有 processTask 在 utility 枚举后调用 Core/Services/ProcessMemoryServiceClient,经 SMARTServiceProtocol.readProcessMemory 请求现有签名认证的 SMARTService。ProcessMemoryReader(与能量读取器同文件编译)使用独立锁和 RUSAGE_INFO_V4,按同 UID、正 PID、启动时间及前后身份复核读取 footprint;不受 CPU 能量 arm64 能力门槛影响。
|
|
||||||
|
|
||||||
批量上限 256 项、请求 64 KiB、响应 256 KiB,客户端总截止 3 秒 / 单请求 1.5 秒,服务每批 1 秒;不增加权限、不扫描 VM、不新增周期任务。ProcessSnapshot.withMemory 以完整身份合并,缺失即 nil,随后才发布列表并触发原能量调度。保留单在途、隐藏 / 重开代际校验;列表显示及排序只消费 footprintBytes。XPC 失败仍发布 CPU 等其余指标,内存显示 --;不混用 RSS。细节及验证见[内存口径修正](process-memory-alignment-plan.md)。
|
|
||||||
|
|
||||||
## 网络数据持久化约束
|
|
||||||
|
|
||||||
PublicIPAddressService 默认持有专用 ephemeral URLSession,URLCache / HTTPCookieStorage / URLCredentialStorage 均为 nil,禁用 Cookie 自动处理;不使用 shared 网络会话,服务销毁时撤销自建会话,注入会话由测试调用方管理。600 秒结果 / 30 秒失败缓存仍只在 actor 内存中,路由 / 可见性 / 取消行为不变。生产查询不主动生成 HTTP 缓存、Cookie 或凭据数据库;该保证不覆盖 macOS 自身日志、崩溃报告、容器元数据,也不意味着旧版本缓存自动消失。偏好设置继续持久化。验证及旧缓存清理状态见[不持久化网络数据](no-persistent-network-data-plan.md)。
|
|
||||||
|
|
||||||
## Release 包安全约束
|
|
||||||
|
|
||||||
主应用的 Release 与 SMARTService 均启用 Hardened Runtime;主应用既有沙盒 / 出站网络 / 用户选中文件只读权限未扩大。免费测试打包使用本地 ad-hoc 签名,无 Developer ID 身份 / 公证;认证仍由实际嵌入的双方 designated requirement 派生,必须保持 app 与 XPC 配对。打包工具仅在 tools/,不参与产品运行、不新增启动任务或数据写入路径。验收和分发边界见[Release 记录](release-readiness.md)。
|
|
||||||
|
|
||||||
## 紧凑双页展示
|
|
||||||
|
|
||||||
CPU 逐核显示使用数值与静态短条,内存保留分布条;GPU 渲染器 / 分块器独立进度条和统计区、电池内的耗电前三列表已移除,存储重复容量条改为可用容量 / 健康 / 通电时长 / 卷入口文本。六张趋势保留既有真实时间及断点规则。页面布局和数据需求详见[实施记录](compact-tab-panel-plan.md)。
|
|
||||||
|
|
||||||
进一步收窄阶段中,概览与设置共享 UI/Components/NeutralTabPicker,保持中性色分段导航。按后续扁平样式要求,控件改用静态绘制的 AppKit 按钮组,不调用系统分段控件的液态玻璃 bezel;设置 ToolbarItem 显式隐藏系统共享背景,避免宿主再次包裹玻璃。4pt 内边距、2pt 间距及底色 / 悬停 / 按下透明度与顶部操作组一致。当前页以选中底色和字重区分,辅助功能保留 tabGroup / tabButton 语义及选中值;原生按钮负责点击与焦点,左右 / Home / End 在页签内切换并转移焦点,Tab 键只停在当前页签。该组件只通过绑定传递选择,不管理页面生命周期或采样。
|
|
||||||
|
|
||||||
窄卡片的内存趋势图例省略重复实时值,完整分类数值仍在内存分布区及悬浮中提供。外接电源的时间项简写为不适用,完整说明在提示中。独立双列和按内容定高已按[实施方案](compact-panel-refinement-plan.md)落实:趋势绘图区 48pt、分隔线竖向留白 2pt;内存使用率移至标题徽标,存储为双列文本,网络合并状态 / 接口及地址行。核心按至少 16pt 单元格动态增加行数,不再限制最多三行;超出屏幕时通过概览滚动访问。
|
|
||||||
|
|
||||||
内存卡片后续收至 180pt:压力移到标题旁的带色状态徽标,缓存与 Swap 由该徽标的系统悬浮提示及辅助功能标签提供;分布条和四类数值保留。Features 的 MemoryHeaderInfo 按当前快照与应用 locale 生成显示数据,ResourceCard 只接受通用颜色 / 文本 / 提示参数;悬浮不发起采样或额外任务,缺失值继续为 --,有效零仍显示 0 B。
|
|
||||||
|
|||||||
+31
-31
@@ -1,62 +1,62 @@
|
|||||||
# 开发指南
|
# 开发指南
|
||||||
|
|
||||||
## 工程与构建
|
## 构建与工程
|
||||||
|
|
||||||
部署目标为 macOS 27.0。使用提供该 SDK 的 Xcode,本轮核对工具为 Xcode 27.2;工程 `SWIFT_VERSION = 5.0`,主应用开启 MainActor 默认隔离与 Approachable Concurrency。不要将使用新工具链等同于 Swift 6 语言模式。
|
部署目标 macOS 27.0,使用提供该 SDK 的 Xcode。工程使用 Swift 5 语言模式,主应用开启 MainActor 默认隔离与 Approachable Concurrency。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
open kymo.xcodeproj
|
open kymo.xcodeproj
|
||||||
xcodebuild -project kymo.xcodeproj -scheme kymo -configuration Debug build
|
xcodebuild -project kymo.xcodeproj -scheme kymo -configuration Debug build
|
||||||
```
|
```
|
||||||
|
|
||||||
工程有 `kymo` 应用和 `SMARTService` XPC 两个 Target。应用依赖并嵌入 XPC,应用 Info.plist 由构建系统生成,服务使用 `SMARTService/Info.plist`。主应用启用沙盒,并在 Debug / Release 显式启用出站网络客户端权限(`ENABLE_OUTGOING_NETWORK_CONNECTIONS`);统一检查入口核对实际签名 entitlement,`--network` 额外验证隔离签名沙盒包访问公网端点。服务的安全边界见[架构](architecture.md)。
|
工程包含 kymo 应用与 SMARTService XPC 两个 Target,没有 Xcode 测试 Target。应用依赖并嵌入服务,主应用 Info.plist 由构建系统生成,服务使用 SMARTService/Info.plist。主应用启用沙盒、出站网络和用户选中文件只读权限;服务认证与系统边界见[架构](architecture.md)。
|
||||||
|
|
||||||
`kymo/` 使用文件系统同步组,新增源码自动纳入应用 Target。非源码文件必须配置成员例外;已有模块 README 与占位文件已列入例外。XPC 源码和共享文件由工程显式列举,修改共享协议 / 模型时检查服务 Target 是否包含所需文件。
|
kymo/ 使用文件系统同步组,源码自动纳入应用;新增非源码文件须设置 Target 成员例外。当前目录仅保留源码与运行资源,没有模块 README 或空占位。XPC 源码与共享协议 / 模型由工程显式列举,修改时检查服务 Target 的 Sources。
|
||||||
|
|
||||||
## 运行与修改入口
|
## 修改入口
|
||||||
|
|
||||||
- 应用入口 / 装配:`kymo/App/kymoApp.swift`。
|
| 内容 | 源码 |
|
||||||
- 状态项与 NSPanel:`MenuPanelController.swift`;面板布局:`PanelLayout.swift`。
|
| --- | --- |
|
||||||
- 面板内容:`MenuPanelView.swift` 及资源卡片 / 网络扩展;进程表:`ProcessTableView.swift`。
|
| 入口与装配 | kymo/App/kymoApp.swift |
|
||||||
- 采样调度与慢缓存:`MetricsStore.swift`、`SystemSampler.swift`。
|
| 状态项 / 窗口 / 布局 | MenuPanelController.swift、PanelLayout.swift、PanelWindowObserver.swift |
|
||||||
- 设置:`AppearanceSettingsView.swift`、`SettingsWindowLifecycle.swift`;当前只有通用 / 关于两页。
|
| 概览 | MenuPanelView.swift 及 ResourceCards / Network 扩展 |
|
||||||
|
| 进程 | ProcessTableView.swift、ProcessTableProjection.swift、NativeProcessTable.swift |
|
||||||
|
| 采样 | MetricsStore.swift、SystemSampler.swift |
|
||||||
|
| 设置 | AppearanceSettingsView.swift、SettingsWindowLifecycle.swift |
|
||||||
|
|
||||||
正常启动不显示 Dock 图标,点击菜单栏模板品牌图标打开面板。面板顶部修改可见时刷新频率,通用设置显式启用后台趋势并修改其刷新频率(新配置默认不在隐藏时采样)。不要沿用旧 MenuBarExtra 或独立 Dashboard 的假设。
|
通常启动仅显示菜单栏图标;打开设置时临时显示 Dock 图标。面板底栏修改可见采样间隔,通用设置控制后台趋势与后台间隔。概览和进程的按页需求由 App 转为 Core 布尔开关。
|
||||||
|
|
||||||
颜色和品牌图标修改 `kymo/Assets.xcassets`,当前运行资源不依赖 `docs/` 中的设计图片或生成脚本。外观仅系统 / 浅色 / 深色,没有强调色自选设置。
|
颜色与图片放入 Assets.xcassets;字符串位于 Resources 的 Localizable、CPUDetails、Process、StatusItem 四个目录,支持简体中文、繁体中文、英文及跟随系统。SwiftUI 文案使用当前 locale,原生文案通过 AppLocalization 读取。新增文案同步三语、格式参数并检查真实布局:
|
||||||
|
|
||||||
## 本地化
|
|
||||||
|
|
||||||
字符串目录位于 `kymo/Resources`:`Localizable`、`CPUDetails`、`Process`、`StatusItem`。支持简体中文、繁体中文、英文和跟随系统。语言偏好由 `LanguagePreferences` 管理,AppKit 宿主中的 SwiftUI 内容通过 `AppLanguageScope` 刷新,原生菜单通过 `AppLocalization` 显式取文案。
|
|
||||||
|
|
||||||
新增文案同步三语及格式参数,执行:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 kymoTests/LocalizationCatalogChecks.py
|
python3 kymoTests/LocalizationCatalogChecks.py
|
||||||
```
|
```
|
||||||
|
|
||||||
该检查覆盖键与格式参数,翻译语义和布局仍需审阅。
|
## 本地诊断
|
||||||
|
|
||||||
## 诊断与探测
|
对自己构建的副本显式开启,不修改用户现有应用或偏好:
|
||||||
|
|
||||||
对自己构建的副本可显式开启标准输出 JSON 行诊断:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
KYMO_DIAGNOSTICS=1 /absolute/path/kymo.app/Contents/MacOS/kymo > /private/tmp/kymo-diagnostics.jsonl
|
KYMO_DIAGNOSTICS=1 /absolute/path/kymo.app/Contents/MacOS/kymo > /private/tmp/kymo-diagnostics.jsonl
|
||||||
```
|
```
|
||||||
|
|
||||||
输出包括采样指标、PID、时间、RSS 与物理足迹,周期随当前采样间隔变化。差分首帧和不可用字段可以缺失。`KYMO_PANEL_PROBE=1` 额外启用能力探测与采样耗时输出;正常启动均不输出这些诊断。
|
输出采样数据、PID、时间、RSS 和物理足迹;KYMO_PANEL_PROBE=1 额外输出能力覆盖及采样耗时。正常启动均不输出诊断。
|
||||||
|
|
||||||
`tools/` 保留 GPU 能力、负载、原始计数和驱动调用调查工具,它们不参与产品构建,不代表已实现的功能;使用前阅读各文件入口说明,避免将探测或压测用于常规运行。
|
Debug 或显式 KYMO_AUDIT 构建可设置 KYMO_RESOURCE_AUDIT=1 驱动三轮真实面板开关,配合 KYMO_DIAGNOSTICS=1 读取日志。可选参数:
|
||||||
|
|
||||||
## 验证与协作
|
| 参数 | 行为 |
|
||||||
|
| --- | --- |
|
||||||
|
| KYMO_AUDIT_QUICK=1 | 缩短隐藏等待并跳过暂停阶段 |
|
||||||
|
| KYMO_AUDIT_PAGE=processes | 每轮打开后进入进程页 |
|
||||||
|
| KYMO_AUDIT_CAPTURE=1 | 第一轮打开 10 秒后输出本应用面板 PNG 的 JSON 事件 |
|
||||||
|
| KYMO_AUDIT_INTERACTIVE=1 | 打开固定面板供人工 / UI 工具操作,不自动退出 |
|
||||||
|
| KYMO_AUDIT_SIZE=480x500 | 交互模式限制测试视口,不覆盖自动尺寸;最小 480×360pt |
|
||||||
|
| KYMO_XPC_AUDIT=1 | 运行请求重复 / 并发完成、超时及取消检查后退出 |
|
||||||
|
|
||||||
代码改动按 [AGENTS.md](../AGENTS.md) 构建并验证受影响行为,独立检查与验收方法见[测试与验证](testing.md)。工程当前没有 Xcode 测试 Target,不能以独立 Swift 检查冒充 `xcodebuild test`。
|
截图来自本应用 contentView,不采集桌面。生命周期驱动不证明菜单栏鼠标或 AX 事件已投递。tools/ 中 GPU 能力、负载和驱动调查程序不参与产品构建,也不代表已实现功能;使用前阅读对应入口。
|
||||||
|
|
||||||
文档以当前代码事实为准;改动模块边界、数据流或指标含义时同步主题文档。提交规范见 [CONTRIBUTING.md](../CONTRIBUTING.md),推送需用户授权。
|
## 验证与分发
|
||||||
|
|
||||||
## 免费测试分发包
|
统一入口为 tools/check.py,检查范围及实际交互验收见[测试与验证](testing.md)。本地 ad-hoc Release ZIP 用 tools/package_release.py 生成,不上传或公证,详见[测试分发](free-test-distribution.md)。
|
||||||
|
|
||||||
使用 `python3 tools/package_release.py` 生成本地 ad-hoc 签名的普通 Release ZIP 与 SHA-256,默认输出到 Git 忽略的 dist/;可以用 `--output` 指定其他目录。主程序 Release 与 XPC 均启用 Hardened Runtime。打包不会上传、公证或修改系统安全策略;临时构建目录自动清理,也不会修改用户 Xcode 的 DerivedData。
|
实现变化同步主题文档;提交规范见 [CONTRIBUTING.md](../CONTRIBUTING.md),推送须用户授权。
|
||||||
|
|
||||||
这是未公证测试包,当前产物最低 macOS 27、arm64。安装边界与校验方式见[测试包说明](free-test-distribution.md)。如需 Developer ID 正式分发,另行配置证书、签名与公证,不能把本地签名完整性通过等同于其他 Mac 默认 Gatekeeper 放行。
|
|
||||||
|
|||||||
@@ -1,31 +1,29 @@
|
|||||||
# Kymo 免费测试包
|
# Kymo 免费测试包
|
||||||
|
|
||||||
## 适用范围
|
|
||||||
|
|
||||||
当前产物:Kymo 1.1(build 13),macOS 27.0 及以上、Apple silicon arm64。Intel 或较低系统不在该产物支持范围。软件使用 ad-hoc 本地签名,未经过 Apple 公证,不是 Developer ID 官方分发包;下载后的系统提示取决于接收方安全策略。
|
|
||||||
|
|
||||||
## 构建与校验
|
## 构建与校验
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 tools/package_release.py
|
python3 tools/package_release.py
|
||||||
```
|
```
|
||||||
|
|
||||||
默认输出:`dist/kymo-1.1-13-arm64-adhoc.zip` 和同名 `.sha256`。首次打包前会通过签名、Hardened Runtime、权限和包内容检查,ZIP 解压后再次检查。再次构建不覆盖已存在同名产物,可用 `--output` 另选目录。校验下载文件:
|
工具构建普通 Release,验证主程序与 XPC 的 ad-hoc 签名、Hardened Runtime、权限和包内容,再校验 ZIP 解压后的签名。默认输出到 Git 忽略的 dist/,文件名按实际版本、构建号与架构生成,包含 ZIP 和同名 .sha256;不覆盖已有产物,可用 --output 指定目录。临时构建目录自动清理。
|
||||||
|
|
||||||
|
下载后在校验文件所在目录执行:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
shasum -a 256 -c kymo-1.1-13-arm64-adhoc.zip.sha256
|
shasum -a 256 -c <实际文件名>.zip.sha256
|
||||||
```
|
```
|
||||||
|
|
||||||
SHA-256 用于核对文件是否与发布者给出的文件一致,不等同于 Apple 身份认证;校验值应从可信渠道获取。
|
SHA-256 核对内容一致性,不等同于 Apple 身份认证;校验值应来自可信渠道。
|
||||||
|
|
||||||
## 接收方安装
|
## 支持与安装边界
|
||||||
|
|
||||||
解压 ZIP,将完整 kymo.app 放入“应用程序”目录;不要只提取主可执行文件或混搭其他版本的内嵌 XPC。先退出旧版,再启动新版本,通过菜单栏 Kymo 图标打开面板,没有 Dock 主窗口属于既有设计。
|
工程最低 macOS 27.0;实际产物架构由打包输出决定。该工具生成未公证的本地 ad-hoc 签名包,没有 Developer ID 分发身份,不上传、不公证、不修改系统安全策略。
|
||||||
|
|
||||||
系统可能提示无法验证开发者或检查恶意软件。接收方应确认来源与校验值,再按 [Apple 对未识别开发者应用的说明](https://support.apple.com/en-gb/102445) 自行决定是否允许该应用。企业管理策略可能禁止运行。此包没有要求关闭 Gatekeeper / SIP,也没有安装移除隔离属性的脚本,不保证直接双击即可运行。
|
解压后安装完整 kymo.app,先退出旧版再启动新版本;不要单独提取可执行文件或混搭内嵌 XPC。应用通常仅显示菜单栏图标,设置窗口打开时才显示 Dock 图标。
|
||||||
|
|
||||||
主程序与内嵌 XPC 均有 Hardened Runtime,但这不替代 Developer ID 和公证。完整主程序在其他 Mac / 默认 Gatekeeper 下启动尚未验收;本机环境的放行结果不作为分发保证。
|
接收方需核对来源、校验值和本机安全策略,再按 [Apple 对未识别开发者应用的说明](https://support.apple.com/en-gb/102445) 决定是否允许运行。企业管理策略可能禁止运行。本地签名校验通过不能证明其他 Mac 的默认 Gatekeeper 放行,也不代表跨机器安装已验收。
|
||||||
|
|
||||||
## 本地数据
|
## 本地数据
|
||||||
|
|
||||||
保留外观、语言及采样设置;旧减弱动画键不再使用但不会被主动清除;Debug / Release 通常共用 bundle ID 对应偏好。趋势和图标仅缓存于内存。公网查询使用禁用缓存 / Cookie / 凭据持久化的临时会话;macOS 管理的容器元数据、日志和崩溃报告不属于零写盘保证。旧版 HTTP 缓存已在本机退出旧进程后单独清理,这不代表其他安装机器上的旧数据已自动清理。
|
外观、语言与采样配置持久化;旧减弱动画键忽略但不主动删除。Debug / Release 通常使用同一 bundle ID,因此共享偏好与容器。趋势和图标缓存仅在内存,公网请求禁用 HTTP 缓存、Cookie 和凭据持久化。macOS 管理的容器元数据、日志、崩溃报告及旧版遗留数据不属于零写盘保证。
|
||||||
|
|||||||
+8
-9
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
本页按当前采样器和展示代码描述。实现接口不保证每种机型均可读取;缺失、无效和权限受限数据保留为空,不伪造为零。
|
本页按当前采样器和展示代码描述。实现接口不保证每种机型均可读取;缺失、无效和权限受限数据保留为空,不伪造为零。
|
||||||
|
|
||||||
趋势图跳过无值节点,按真实时间连接前后有效点;有效 0 仍绘制,暂停 / 休眠等显式断点及真实采样空档仍断线。连接只影响曲线外观:缺失时刻悬浮读数为 `--`,原历史与统计不补值。详见[图表无值处理](chart-missing-value-policy.md)。
|
趋势图跳过无值节点,按真实时间连接前后有效点;有效 0 仍绘制,暂停 / 休眠等显式断点及真实采样空档仍断线。连接只影响曲线外观:缺失时刻悬浮读数为 `--`,原历史不补值。
|
||||||
|
|
||||||
## 数据来源
|
## 数据来源
|
||||||
|
|
||||||
@@ -10,8 +10,8 @@
|
|||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| 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 卡片不再重复展示负载;负载不是 CPU 百分比 |
|
| 开机时间 | `systemUptime` | 底栏显示系统启动以来的小时数 |
|
||||||
| GPU | `GPUMonitor`,IOAccelerator `PerformanceStatistics` | 读取 Device / Renderer / Tiler Utilization、核心数、In use / Alloc system memory;只接受单设备结果,多 GPU 不合并 |
|
| GPU | `GPUMonitor`,IOAccelerator `PerformanceStatistics` | 读取 Device / Renderer / Tiler Utilization 与核心数;只接受单设备结果,多 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 解码;零转速有效,单风扇不可读保持缺失,无风扇返回空数组 |
|
||||||
| 内存 | `MemoryMonitor`,`host_statistics64`、sysctl | 应用 = internal − purgeable(下限 0);已用 = 应用 + wired + compressed(上限物理内存);可用 = 总量 − 已用;缓存 = external + purgeable;Swap 与压力独立可缺失 |
|
| 内存 | `MemoryMonitor`,`host_statistics64`、sysctl | 应用 = internal − purgeable(下限 0);已用 = 应用 + wired + compressed(上限物理内存);可用 = 总量 − 已用;缓存 = external + purgeable;Swap 与压力独立可缺失 |
|
||||||
@@ -30,10 +30,9 @@
|
|||||||
## 需要明确区分的指标
|
## 需要明确区分的指标
|
||||||
|
|
||||||
- GPU Renderer / Tiler 是活动阶段指标,可能重叠,不能相加成为总占用。GPU 核心数不代表逐核计数;目前没有独立逐核 GPU 占用。
|
- GPU Renderer / Tiler 是活动阶段指标,可能重叠,不能相加成为总占用。GPU 核心数不代表逐核计数;目前没有独立逐核 GPU 占用。
|
||||||
- GPU 驱动内存不是独立显存容量,也不是可计算占比的统一内存上限。近期统计模型仍保留最近 60 秒有效区间的加权平均与峰值算法,当前概览不再展示这些统计或驱动内存。
|
|
||||||
- 网络“全部”仅汇总 active 且名称以 `en` 开头的接口,避免物理链路与 `utun` 双计。接口选择仍可查看其他活动接口;这个规则不等于所有设备和隧道的通用流量归因。
|
- 网络“全部”仅汇总 active 且名称以 `en` 开头的接口,避免物理链路与 `utun` 双计。接口选择仍可查看其他活动接口;这个规则不等于所有设备和隧道的通用流量归因。
|
||||||
- 进程 CPU 以一个逻辑核满载为 100%,多线程可超过 100%,不能直接与整机 CPU 百分比比较。首次进程采样没有差分值;功率列使用独立 CPU 能量计数差分,不能将进程 CPU 百分比当成耗电。
|
- 进程 CPU 以一个逻辑核满载为 100%,多线程可超过 100%,不能直接与整机 CPU 百分比比较。首次进程采样没有差分值;功率列使用独立 CPU 能量计数差分,不能将进程 CPU 百分比当成耗电。
|
||||||
- 电池模型可计算充电 / 放电时间,但当前卡片仅在非外接电源时显示剩余时间,外接电源显示不适用。系统未给出有效估计时显示未知。
|
- 电池卡片仅在非外接电源时显示剩余时间;外接电源显示不适用,系统未给出有效估计时显示未知。
|
||||||
|
|
||||||
## 采样与缓存周期
|
## 采样与缓存周期
|
||||||
|
|
||||||
@@ -48,7 +47,7 @@
|
|||||||
| 公网 IP | 同一路由键成功缓存 600 秒,失败缓存 30 秒,请求超时 5 秒;概览可见时按缓存到期持续刷新,路由键变化、暂停或面板隐藏取消请求及等待,取消不缓存;有效期使用单调时间 |
|
| 公网 IP | 同一路由键成功缓存 600 秒,失败缓存 30 秒,请求超时 5 秒;概览可见时按缓存到期持续刷新,路由键变化、暂停或面板隐藏取消请求及等待,取消不缓存;有效期使用单调时间 |
|
||||||
| 趋势 | 全局与每接口最多各 60 点,仅内存保存 |
|
| 趋势 | 全局与每接口最多各 60 点,仅内存保存 |
|
||||||
|
|
||||||
传感器、卷与慢报告只在请求概览慢指标的可见采样轮次检查是否到期;后台趋势不启动这些慢读取。快照中的慢指标可能来自之前的缓存;磁盘 / 电池健康快照带读取日期。暂停停止发布,不保证取消已进入系统调用的工作。
|
传感器、卷与慢报告只在请求概览慢指标的可见采样轮次检查是否到期;后台趋势不启动这些慢读取。快照中的慢指标可能来自之前的缓存。暂停停止发布,不保证取消已进入系统调用的工作。
|
||||||
|
|
||||||
常规周期允许系统在配置周期 10% 的容差内合并唤醒,前台最多 200ms、后台最多 1 秒;不是严格实时截止。差分的时间分母始终取实际经过的单调时间,历史保留真实采样日期,配置周期不被改写。
|
常规周期允许系统在配置周期 10% 的容差内合并唤醒,前台最多 200ms、后台最多 1 秒;不是严格实时截止。差分的时间分母始终取实际经过的单调时间,历史保留真实采样日期,配置周期不被改写。
|
||||||
|
|
||||||
@@ -60,19 +59,19 @@ AppleSMC 和 GPU 驱动字段不是稳定公开的跨机型指标接口,缺失
|
|||||||
|
|
||||||
## 耗电进程:CPU 归属能量
|
## 耗电进程:CPU 归属能量
|
||||||
|
|
||||||
读取 `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 排名。受限读取仍按覆盖情况返回,不以硬件型号假定当前可用性。
|
||||||
|
|
||||||
该口径是系统归属的 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 平均功率,列头可切换升降序;缺失值显示 -- 并始终排末。悬浮功率单元格可查看实际统计窗口。
|
该口径是系统归属的 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 平均功率,列头可切换升降序;缺失值显示 -- 并始终排末。悬浮功率单元格可查看实际统计窗口。
|
||||||
|
|
||||||
按全部可测候选的有效能量差分排名。权限受限、进程退出和截止会降低覆盖率;进程页显示已形成差分数 / 枚举总数,首帧等待,失败或不支持明确显示状态。零增量只有连续两帧有效时才代表 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%。不按整机核心数再平均。真实 CPU 能量采用独立 nJ 计数差分。
|
||||||
|
|
||||||
## 进程表内存口径
|
## 进程表内存口径
|
||||||
|
|
||||||
进程表“内存”与内存排序使用 proc_pid_rusage(RUSAGE_INFO_V4).ri_phys_footprint,按 1,048,576 字节折算并沿用活动监视器的 MB 标签;不使用 PROC_PIDTASKALLINFO.pti_resident_size(RSS)。[Apple WWDC22](https://developer.apple.com/videos/play/wwdc2022/10106/) 说明 Activity Monitor 使用 footprint。RSS 包括可回收的干净驻留页,而 footprint 包含压缩等归属账目,两者无固定换算比例。
|
进程表“内存”与内存排序使用 proc_pid_rusage(RUSAGE_INFO_V4).ri_phys_footprint,按 1,048,576 字节折算并沿用活动监视器的 MB 标签;不使用 PROC_PIDTASKALLINFO.pti_resident_size(RSS)。[Apple WWDC22](https://developer.apple.com/videos/play/wwdc2022/10106/) 说明 Activity Monitor 使用 footprint。RSS 包括可回收的干净驻留页,而 footprint 包含压缩等归属账目,两者无固定换算比例。
|
||||||
|
|
||||||
沙盒主程序不能直接取得其他进程 rusage,因此通过原有签名认证只读 XPC、按完整 ProcessIdentity 请求同 UID footprint。数据合并在单在途进程任务结束前完成;读取失败显示 --,不回退 RSS 或沿用旧值。保护进程 / 其他 UID 可能不可读,辅助进程独立统计。刷新时刻不同仍允许短时波动。来源核对与边界见[修正记录](process-memory-alignment-plan.md)。系统总内存卡片口径不变。
|
沙盒主程序不能直接取得其他进程 rusage,因此通过原有签名认证只读 XPC、按完整 ProcessIdentity 请求同 UID footprint。数据合并在单在途进程任务结束前完成;读取失败显示 --,不回退 RSS 或沿用旧值。保护进程 / 其他 UID 可能不可读,辅助进程独立统计。刷新时刻不同仍允许短时波动。系统总内存卡片口径不变。
|
||||||
|
|
||||||
公网 IP 网络会话使用 ephemeral 配置并关闭 URLCache、Cookie 与凭据存储;已有 600 秒 / 30 秒缓存是进程内数据,不写磁盘。签名沙盒网络检查直接调用生产服务,核对重复 / 新路由 HTTPS 查询后持久网络目录未新增或变更文件。
|
公网 IP 网络会话使用 ephemeral 配置并关闭 URLCache、Cookie 与凭据存储;已有 600 秒 / 30 秒缓存是进程内数据,不写磁盘。签名沙盒网络检查直接调用生产服务,核对重复 / 新路由 HTTPS 查询后持久网络目录未新增或变更文件。
|
||||||
|
|
||||||
|
|||||||
+49
-329
@@ -1,352 +1,72 @@
|
|||||||
# 测试与验证
|
# 测试与验证
|
||||||
|
|
||||||
## 当前测试形态
|
|
||||||
|
|
||||||
静态版检查覆盖:`NativeContentHostChecks`(`--gui`)验证数字更新后立即稳定、父级字体 / 颜色 / 语言继承、挂载身份、有限尺寸和卸载;`NativeMetricDrawingChecks` 验证曲线 / 圆环像素、直接更新、无动画 / 渐变 / 遮罩、悬浮不重建路径及满 60 点历史。`AppearancePreferencesChecks` 验证外观持久化、采样独立和旧动效键不被误改。`NetworkAddressChecks` 连续读取 30 轮,核对有效速率和地址格式。
|
|
||||||
|
|
||||||
`kymoTests/` 包含可独立编译的 Swift 检查程序和 Python 字符串检查,工程未创建 XCTest / UI 测试 Target;`kymoUITests/` 目前仅占位。以下命令在仓库根目录执行,每次只编译一个检查入口。需要实际应用包的命令必须传入本轮构建产物的绝对路径。
|
|
||||||
|
|
||||||
本页保留当前检查入口和验收边界,不沿用旧阶段报告中的“通过”结论。源码存在、命令可编译、独立程序通过、正式应用实测是不同层次的证据,每轮应记录实际执行项。
|
|
||||||
|
|
||||||
## 统一入口
|
## 统一入口
|
||||||
|
|
||||||
```bash
|
工程包含应用与 XPC Target,没有 XCTest / UI 测试 Target。kymoTests/ 是独立 Swift 检查程序及 Python 目录检查,不称为 xcodebuild test。
|
||||||
python3 tools/check.py
|
|
||||||
python3 tools/check.py --configuration Release
|
|
||||||
# 额外启动真实原生窗口检查,并发起一次公网 HTTPS 请求
|
|
||||||
python3 tools/check.py --gui --network
|
|
||||||
# 使用已有构建包,只跑指定回归(仍检查资源目录和签名权限)
|
|
||||||
python3 tools/check.py --app /absolute/path/to/kymo.app --only MachPortChecks ProcessSelectionChecks PublicIPAddressChecks
|
|
||||||
python3 tools/check.py --list
|
|
||||||
```
|
|
||||||
|
|
||||||
默认构建 Debug,运行全部非 GUI / 非真实网络检查,显式列出跳过项;任一编译、运行或断言失败时返回非零退出码。脚本核对新增 Swift 检查是否已登记,并在退出时清理自己的临时构建、测试包、缓存和日志。`--app` 指定的用户已有构建产物不清理。GUI 检查以独立标识的完整签名应用逐个启动(面板检查为 accessory,设置检查为常规应用),使用自身窗口,不操作用户已有应用;不等于实际菜单栏鼠标 / 键盘事件已投递。`--network` 将实际主应用的 entitlement 应用到隔离探针,访问与产品相同的 HTTPS 端点,不输出公网地址;服务不可达也会使该检查失败。
|
|
||||||
|
|
||||||
新增回归:`MachPortChecks` 对 CPU / 内存各采样 1,000 轮,直接核对 host 发送权引用数无增长;`ProcessSelectionChecks` 验证搜索过滤、失败枚举、真实退出及 PID 复用。`LocalizationChecks` 另检查编译后的三语编号风扇格式,`LanguageScopeChecks` 检查已挂载宿主即时切换语言。前者不等于读取了实际风扇标签的渲染文本。
|
|
||||||
|
|
||||||
## 构建与人工验收
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
xcodebuild -project kymo.xcodeproj -scheme kymo -configuration Debug build
|
xcodebuild -project kymo.xcodeproj -scheme kymo -configuration Debug build
|
||||||
|
python3 tools/check.py
|
||||||
|
python3 tools/check.py --configuration Release
|
||||||
|
# 启动隔离原生测试应用、实际签名 XPC 与真实 HTTPS 检查
|
||||||
|
python3 tools/check.py --gui --services --network
|
||||||
|
# 复用本轮构建包,运行指定检查
|
||||||
|
python3 tools/check.py --app /absolute/path/to/kymo.app --only SamplingChecks GPUStatisticsChecks
|
||||||
|
python3 tools/check.py --list
|
||||||
```
|
```
|
||||||
|
|
||||||
按改动选择以下验收项:
|
默认构建 Debug,执行非 GUI / 非真实网络 / 非打包服务检查,并明确列出跳过项。任一编译、断言或运行失败返回非零。所有模式都检查三语目录及实际主应用沙盒 / 网络权限。新增 Swift 入口须登记到 tools/check.py,否则脚本报错。
|
||||||
|
|
||||||
- 菜单栏:左键打开 / 收起,右键快捷菜单,打开设置与退出。
|
脚本使用临时目录构建和编译,退出清理自己的测试包、缓存与日志;--app 传入的产物不删除。GUI 检查逐个启动完整签名应用,超时只终止对应测试二进制。网络和服务探针使用随机 bundle ID,退出只清理自己的容器。不要与固定浮动的面板验证窗口同时运行 GUI 检查,避免遮挡影响可见性断言。
|
||||||
- 面板:屏幕区域约束、紧凑两列 / 窄屏单列、概览和进程页独立滚动、关闭重开默认概览、图表悬浮、缺失值展示。
|
|
||||||
- 生命周期:外部点击、固定 / 取消固定、Esc 分层处理、设置焦点 / 最小化恢复及 Dock 显隐。
|
|
||||||
- 采样:前后台间隔切换、暂停 / 恢复、概览 / 隐藏后停止进程采样、进程页重建进程基线与异步列表发布、切页不打断基础趋势。
|
|
||||||
- 数据:实际签名沙盒应用的 GPU、温度 / 风扇、SMART、电池与网络读数,分别核对来源、单位和不可用状态。
|
|
||||||
- 语言 / 外观:三语即时切换、重启持久化、浅深色和系统跟随、文本截断与复制。
|
|
||||||
- 保持唤醒:断言开关及退出释放;真实空闲息屏行为另验收。
|
|
||||||
|
|
||||||
多显示器 / 刘海屏、动效与玻璃观感需要对应真实环境和用户体验验收。长期 CPU、内存与能耗需持续观测,单次资源快照不证明达标。
|
## 自动检查范围
|
||||||
|
|
||||||
原生 UI 工具的应用绑定、AX 读取、元素点击、坐标点击、局部截图和键盘分别实测;历史超时或成功不代表当前工具权限和能力。普通 NSWindow 的代理内容检查不能代替正式 NSPanel 事件投递。测试前记录已有进程,仅退出本轮副本;截图限定任务区域,结束后清理临时包、二进制、缓存与日志。
|
具体断言以检查源码为准,以下按当前行为分组:
|
||||||
|
|
||||||
## CPU 核心布局
|
| 检查 | 覆盖范围 |
|
||||||
|
| --- | --- |
|
||||||
|
| SamplingChecks、SamplingIntervalChecks、DetailDemandChecks | 差分首帧与重置、间隔与旧偏好、暂停 / 恢复、隐藏零采样、分页需求、独立进程发布与需求代次 |
|
||||||
|
| BackgroundTrendChecks、PanelCurveChecks | 真实时间域、周期切换、短暂隐藏连续性、60 点有界历史、缺失与非有限点、有效 0、显式停采及真实空档 |
|
||||||
|
| UnifiedPanelChecks、StageCChecks | 本机采样边界、网络汇总与接口历史、电池估时及系统报告解析 |
|
||||||
|
| MachPortChecks | CPU / 内存各 1,000 轮后 host 发送权引用无增长 |
|
||||||
|
| MemoryChecks、MemoryHeaderChecks | 分类守恒、二进制容量、压力 / 缓存 / Swap 标题及三语缺失 / 零值 |
|
||||||
|
| GPUStatisticsChecks、CPUTemperatureChecks、FanChecks、DiskHealthChecks | 当前 GPU 利用率与历史、温度范围与解码、风扇零值 / 无效值、SMART 边界与多物理存储拒绝合并 |
|
||||||
|
| SensorScheduleChecks、BoundedProcessChecks | 各能力独立退避;真实受控子进程输出上限、超时、取消、异常退出与回收 |
|
||||||
|
| ProcessEnergyChecks、ProcessEnergyReaderChecks、ProcessCPULiveChecks | UInt64 能量差分、身份 / UID / 缺失 / 回退 / 时间边界、受控本机能量增长和 Mach 时基 CPU 差分 |
|
||||||
|
| ProcessSelectionChecks、PanelLayoutChecks、CPUCoreGridChecks | 退出与 PID 复用、搜索 / 排序、640pt / 窄屏预算、核心行数与边界 |
|
||||||
|
| PublicIPAddressChecks | 隔离 URLProtocol、600 秒成功 / 30 秒失败缓存、单调时间、持续刷新及取消,不发送真实请求 |
|
||||||
|
| NetworkAddressChecks、ProcessIconCacheChecks | 沙盒下地址格式 / 速率;图标位图、尺寸、共享、过期、LRU 与严格预算 |
|
||||||
|
| AppearancePreferencesChecks、LocalizationChecks、PresentationChecks | 外观与偏好隔离、语言持久化、编译资源、窗口显式 / 系统外观切换 |
|
||||||
|
| CodeIdentityChecks、PanelAssetChecks、KeepAwakeChecks | 签名身份拒绝边界、编译颜色及对比度、真实 IOPM 断言开关与释放 |
|
||||||
|
| NativeMetricDrawingChecks(--gui) | 实际曲线像素、直接稳定更新、缺失点接续与真实断点、悬浮缓存、无动画 / 渐变 / 遮罩、卸载 |
|
||||||
|
| NativeContentHostChecks(--gui) | 数字更新、父环境继承、挂载身份、有限尺寸和卸载 |
|
||||||
|
| NativeProcessTableChecks(--gui) | 原生虚拟表格、原地更新、身份选择、排序 / 列序 / 复制 / 三语列头、合成 Esc 投递 |
|
||||||
|
| TabPickerChecks、LanguageScopeChecks、SettingsWindowChecks(--gui) | 原生页签选择与键盘、已挂载语言即时切换、设置焦点 / 最小化恢复 / Dock 生命周期 |
|
||||||
|
| PanelWindowChecks(--gui) | 真实 NSPanel 居中、尺寸反馈、固定、遮挡可见性、显式关闭重开默认概览和退出复位 |
|
||||||
|
| ReleaseServiceChecks(--services) | 临时 hardened sandbox 主程序调用本轮实际嵌入服务,核对同 UID footprint / 能量与传感器 |
|
||||||
|
| SandboxNetworkChecks(--network) | 使用实际主应用 entitlement 访问产品 HTTPS 端点,核对持久网络目录无新增或变更文件 |
|
||||||
|
|
||||||
检查不同行宽、0–128 核的行数与均分边界;可视效果另看 `CPUCoreGrid` 的 Xcode 预览:
|
LocalizationCatalogChecks.py 检查全部保留键的三语完整性与格式参数,不替代翻译语义和实际排版。服务 / 网络不可达也会使对应检查失败。
|
||||||
|
|
||||||
```bash
|
## 实际应用验收
|
||||||
swiftc -parse-as-library -module-cache-path /private/tmp/kymo-core-grid-cache \
|
|
||||||
kymo/Features/MenuBar/CPUCoreGrid.swift kymo/Core/Services/CPUCoreTopology.swift \
|
|
||||||
kymo/Core/Extensions/MetricFormat.swift kymo/UI/Components/MetricProgressBar.swift \
|
|
||||||
kymo/UI/Components/NativeMetricRing.swift \
|
|
||||||
kymoTests/CPUCoreGridChecks.swift -o /private/tmp/kymo-core-grid-checks
|
|
||||||
/private/tmp/kymo-core-grid-checks
|
|
||||||
```
|
|
||||||
|
|
||||||
## CPU 温度
|
自动检查可验证模型、原生组件和窗口策略,不能代替正式应用事件。代码改动涉及相应路径时,应在本机完成:
|
||||||
|
|
||||||
检查 AppleSMC C 结构对齐、90°C 提示边界,并在接口可用时核对实时值范围:
|
- 菜单栏左键打开 / 收起、右键菜单、设置入口与退出。
|
||||||
|
- 概览六张卡片、双列 / 窄屏单列和滚动,进程分页与关闭重开默认概览。
|
||||||
|
- 固定 / 取消固定、外部点击、Esc 分层处理,图表悬浮、复制、缺失值。
|
||||||
|
- 底栏刷新间隔、后台趋势、暂停 / 恢复;概览停止进程读取,进程页停止概览慢读取,基础趋势延续。
|
||||||
|
- 实际签名沙盒应用的 GPU、温度、风扇、SMART、电池、网络、footprint 和 CPU 功率来源 / 单位 / 不可用状态。
|
||||||
|
- 三语即时切换、浅深色与系统跟随、重启持久化、设置焦点与 Dock 显隐。
|
||||||
|
|
||||||
```bash
|
测试前记录已有进程及来源,仅退出本轮启动的副本。只操作任务所需控件,保留用户已有应用和偏好。临时截图仅限面板或必要菜单栏区域,验证结束删除。
|
||||||
swiftc -parse-as-library -module-cache-path /private/tmp/kymo-temperature-cache \
|
|
||||||
kymo/Core/Monitors/CPUTemperatureMonitor.swift kymoTests/CPUTemperatureChecks.swift \
|
|
||||||
-o /private/tmp/kymo-temperature-checks
|
|
||||||
/private/tmp/kymo-temperature-checks
|
|
||||||
```
|
|
||||||
|
|
||||||
## 采样与状态检查
|
原生 UI 工具的应用绑定、AX 状态、元素点击、坐标点击、局部截图及键盘路径各自实测;某条路径失败不能推出其他路径不可用。系统授权由用户完成,缺失时说明影响,不绕过。合成 NSEvent 与方法调用不等于系统鼠标 / 键盘已投递。
|
||||||
|
|
||||||
尚无 Xcode 测试 Target。以下命令编译实际核心源码,检查差分边界、真实采样以及 Store 暂停/恢复发布行为:
|
## 验收边界
|
||||||
|
|
||||||
```bash
|
真实多显示器 / 刘海屏、硬件支持范围、外观手感及长期 CPU / 内存 / 能耗,需要相应环境和持续观测;单次快照不证明长期达标。真实空闲息屏不由断言开关检查替代。
|
||||||
swiftc -module-cache-path /private/tmp/kymo-check-cache \
|
|
||||||
kymo/Core/Models/*.swift kymo/Core/Monitors/*.swift \
|
|
||||||
kymo/Core/Services/*.swift kymo/Core/Extensions/*.swift kymoTests/SamplingChecks.swift -o /private/tmp/kymo-sampling-checks
|
|
||||||
/private/tmp/kymo-sampling-checks
|
|
||||||
```
|
|
||||||
|
|
||||||
此检查不证明应用沙盒权限、SwiftUI 展示、暂停按钮交互或长期性能达标。
|
PanelResourceAudit 可驱动本轮 Debug 或 KYMO_AUDIT 包的真实生命周期、局部截图和请求取消检查,参数见[开发指南](development.md)。它不是替代 UI,不屏蔽产品组件。关闭内容弱引用、图区数量 / 尺寸和资源日志只是对应时刻证据;采样、组件检查、应用交互和长期测量须分别报告。
|
||||||
|
|
||||||
`SamplingChecks` 同时包含历史容量、缺失值、格式化和外观持久化等检查;以检查源码为具体断言依据。
|
服务端报告任务在 XPC 断开后的取消传播、极大进程集合的公平覆盖、其他 Mac 默认 Gatekeeper 与跨机安装均不能由本机检查直接证明。分发约束见[测试包说明](free-test-distribution.md)。
|
||||||
|
|
||||||
## 呈现边界检查
|
|
||||||
|
|
||||||
以下检查定位与非显示窗口的外观覆盖清除,不验证鼠标交互或屏幕截图:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
swiftc -module-cache-path /private/tmp/kymo-check-cache \
|
|
||||||
kymo/Core/Services/AppearancePreferences.swift kymo/Core/Services/LanguagePreferences.swift \
|
|
||||||
kymo/UI/Components/AppearanceStyle.swift kymo/UI/Components/DetailPlacement.swift \
|
|
||||||
kymo/UI/Components/AppLocalization.swift \
|
|
||||||
kymoTests/PresentationChecks.swift -o /private/tmp/kymo-presentation-checks
|
|
||||||
/private/tmp/kymo-presentation-checks
|
|
||||||
```
|
|
||||||
|
|
||||||
## 静态趋势边界检查
|
|
||||||
|
|
||||||
当前绘图会跳过 nil / 非有限值并接续有效点;检查保留原时间戳、有效 0、全空与首尾空值,并确认空值点上的显式停采 / 长时间空档仍断线。原生像素检查另验证无值时刻没有测量标记。GPU 统计仍排除缺失区间,详见[图表无值处理](chart-missing-value-policy.md)。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
swiftc -parse-as-library -module-cache-path /private/tmp/kymo-chart-cache \
|
|
||||||
kymo/UI/Charts/PanelCurveGeometry.swift kymo/UI/Charts/PanelCurveFrame.swift \
|
|
||||||
kymoTests/PanelCurveChecks.swift -o /private/tmp/kymo-curve-checks
|
|
||||||
/private/tmp/kymo-curve-checks
|
|
||||||
```
|
|
||||||
|
|
||||||
覆盖真实时间域、满 60 点历史、缺失值与非有限值、长采样周期、暂停断点和不规则时间戳;图层像素与无动画状态由 GUI 检查另验。
|
|
||||||
|
|
||||||
## 多语言行为检查
|
|
||||||
|
|
||||||
先构建应用,再传入实际 .app 路径,检查语言匹配、即时偏好值、隔离 suite 持久化与真实三语资源:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
swiftc -module-cache-path /private/tmp/kymo-check-cache \
|
|
||||||
kymo/Core/Services/LanguagePreferences.swift kymo/UI/Components/AppLocalization.swift \
|
|
||||||
kymoTests/LocalizationChecks.swift -o /private/tmp/kymo-localization-checks
|
|
||||||
/private/tmp/kymo-localization-checks /absolute/path/to/kymo.app
|
|
||||||
```
|
|
||||||
|
|
||||||
不修改用户语言或系统 AppleLanguages;不以该检查代替窗口即时切换验收。
|
|
||||||
|
|
||||||
基础边界与本机采样补充检查(保留源码文件名 `StageCChecks`):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
swiftc -module-cache-path /private/tmp/kymo-c-cache kymo/Core/Models/*.swift kymo/Core/Monitors/*.swift kymo/Core/Services/*.swift kymo/Core/Extensions/*.swift kymoTests/StageCChecks.swift -o /private/tmp/kymo-c-check
|
|
||||||
/private/tmp/kymo-c-check
|
|
||||||
```
|
|
||||||
|
|
||||||
磁盘 SMART 解析边界检查(不证明应用沙盒可读取 SMART):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
swiftc -module-cache-path /private/tmp/kymo-disk-check-cache kymo/Core/Models/DiskHealthMetrics.swift kymo/Core/Monitors/DiskHealthReport.swift kymoTests/DiskHealthChecks.swift -o /private/tmp/kymo-disk-check
|
|
||||||
/private/tmp/kymo-disk-check
|
|
||||||
```
|
|
||||||
|
|
||||||
XPC 两端签名要求校验(先构建带辅助服务的实际应用):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
swiftc -module-cache-path /private/tmp/kymo-identity-cache kymo/Core/Services/CodeIdentity.swift kymoTests/CodeIdentityChecks.swift -o /private/tmp/kymo-identity-check
|
|
||||||
/private/tmp/kymo-identity-check /absolute/path/to/kymo.app /absolute/path/to/kymo.app/Contents/XPCServices/SMARTService.xpc
|
|
||||||
```
|
|
||||||
|
|
||||||
验证各自合法签名通过、对方身份要求拒绝及缺失代码降级;不替代主应用与 XPC 的实际端到端采样。XPC 边界见[架构](architecture.md)。
|
|
||||||
|
|
||||||
## 保持唤醒实际断言检查
|
|
||||||
|
|
||||||
```bash
|
|
||||||
swiftc -module-cache-path /private/tmp/kymo-check-cache \
|
|
||||||
kymo/Core/Services/KeepAwakeService.swift kymoTests/KeepAwakeChecks.swift \
|
|
||||||
-o /private/tmp/kymo-awake-checks
|
|
||||||
/private/tmp/kymo-awake-checks
|
|
||||||
```
|
|
||||||
|
|
||||||
检查真实 IOKit 请求的创建、重复开关与生命周期释放;测试结束不保留唤醒断言。不能替代实际空闲锁屏、息屏及面板视觉验收。
|
|
||||||
|
|
||||||
## 设置窗口展示检查
|
|
||||||
|
|
||||||
检查必须作为完整 `.app` 启动,直接运行 CLI 可执行文件时 macOS 不会自动激活测试应用:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
swiftc -module-cache-path /private/tmp/kymo-settings-cache \
|
|
||||||
kymo/Core/Services/SettingsPresentation.swift \
|
|
||||||
kymo/Features/Settings/SettingsWindowLifecycle.swift \
|
|
||||||
kymoTests/SettingsWindowChecks.swift -o /private/tmp/kymo-settings-checks
|
|
||||||
```
|
|
||||||
|
|
||||||
将临时可执行文件放入带 Info.plist 并已完成代码签名的临时 `.app/Contents/MacOS`,再用 `open -n -W` 启动。检查首次展示、焦点恢复、隐藏重开、最小化恢复、普通窗口层级及关闭生命周期;不替代实际多窗口场景与视觉验收。
|
|
||||||
|
|
||||||
## 统一面板数据检查
|
|
||||||
|
|
||||||
```bash
|
|
||||||
swiftc -module-cache-path /private/tmp/kymo-unified-cache \
|
|
||||||
kymo/Core/Models/*.swift kymo/Core/Monitors/*.swift \
|
|
||||||
kymo/Core/Services/*.swift kymo/Core/Extensions/*.swift \
|
|
||||||
kymoTests/UnifiedPanelChecks.swift -o /private/tmp/kymo-unified-checks
|
|
||||||
/private/tmp/kymo-unified-checks
|
|
||||||
```
|
|
||||||
|
|
||||||
覆盖进程 CPU 首帧/差分与可见性基线、GPU 数值范围、VPN 防双计和接口历史容量。签名沙盒包、三语资源与真实 UI 仍需单独验证。无 Xcode 测试 Target,不能将上述程序称为 xcodebuild test。
|
|
||||||
|
|
||||||
布局和列表投影边界、实际编译颜色检查:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
swiftc -module-cache-path /private/tmp/kymo-unified-cache \
|
|
||||||
kymo/Core/Models/ProcessMetrics.swift kymo/Features/MenuBar/PanelLayout.swift \
|
|
||||||
kymo/Features/MenuBar/ProcessTableProjection.swift kymoTests/PanelLayoutChecks.swift \
|
|
||||||
-o /private/tmp/kymo-panel-layout-checks
|
|
||||||
/private/tmp/kymo-panel-layout-checks
|
|
||||||
swiftc -parse-as-library -module-cache-path /private/tmp/kymo-unified-cache \
|
|
||||||
kymoTests/PanelAssetChecks.swift -o /private/tmp/kymo-panel-asset-checks
|
|
||||||
/private/tmp/kymo-panel-asset-checks /absolute/path/to/kymo.app
|
|
||||||
```
|
|
||||||
|
|
||||||
前者覆盖屏幕预算、边界约束和 2000 行投影,不证明原生定位或滚动手感;后者读取编译资源,确认主面板/卡片不透明、浮层资源保留既有透明度,检查 CPU 三序列色相间隔至少 36°,以及所有指标/序列颜色对卡片背景的图形对比度至少 3:1。
|
|
||||||
|
|
||||||
复合图几何检查(真实时间追加、满历史平移、暂停断线、缺失/非有限值):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
swiftc -module-cache-path /private/tmp/kymo-check-cache \
|
|
||||||
kymo/UI/Charts/PanelCurveGeometry.swift kymo/UI/Charts/PanelCurveFrame.swift kymoTests/PanelCurveChecks.swift \
|
|
||||||
-o /private/tmp/kymo-panel-curve-checks
|
|
||||||
/private/tmp/kymo-panel-curve-checks
|
|
||||||
```
|
|
||||||
|
|
||||||
该检查不证明悬浮事件投递或动画观感。
|
|
||||||
|
|
||||||
## 独立刷新频率与固定窗口检查
|
|
||||||
|
|
||||||
```bash
|
|
||||||
swiftc -module-cache-path /private/tmp/kymo-check-cache \
|
|
||||||
kymo/Core/Models/*.swift kymo/Core/Monitors/*.swift \
|
|
||||||
kymo/Core/Services/*.swift kymo/Core/Extensions/*.swift \
|
|
||||||
kymoTests/SamplingIntervalChecks.swift -o /private/tmp/kymo-interval-checks
|
|
||||||
/private/tmp/kymo-interval-checks
|
|
||||||
swiftc -parse-as-library -module-cache-path /private/tmp/kymo-check-cache \
|
|
||||||
kymo/Features/MenuBar/MenuPanelController.swift kymo/Features/MenuBar/PanelLayout.swift \
|
|
||||||
kymo/UI/Components/IntervalControl.swift \
|
|
||||||
kymoTests/PanelWindowChecks.swift -o /private/tmp/kymo-window-checks
|
|
||||||
```
|
|
||||||
|
|
||||||
窗口程序应放进独立 `.app/Contents/MacOS`、配置隔离 Info.plist 并签名后运行。前者覆盖双频持久化/边界、30min 等待唤醒、暂停优先级、隐藏进程清理及长间隔初始列表发布;后者创建真实 NSPanel,检查居中/层级/外部关闭策略/显式关闭/退出复位,不安装状态栏图标。外部关闭策略方法检查不等于实际系统鼠标事件已投递。GUI 操作按本页验收项在当前环境实测。
|
|
||||||
|
|
||||||
## GPU 信息与统计
|
|
||||||
|
|
||||||
```bash
|
|
||||||
swiftc kymo/Core/Models/*.swift kymo/Core/Monitors/*.swift \
|
|
||||||
kymo/Core/Services/*.swift kymo/Core/Extensions/*.swift \
|
|
||||||
kymoTests/GPUStatisticsChecks.swift -o /private/tmp/kymo-gpu-statistics-checks
|
|
||||||
/private/tmp/kymo-gpu-statistics-checks
|
|
||||||
```
|
|
||||||
|
|
||||||
覆盖实际时间加权、窗口截断、缺失/休眠边界、阶段曲线历史和驱动内存边界;命令行采样不代替签名 XPC 与实际卡片验收。
|
|
||||||
|
|
||||||
## 风扇解码与动画状态
|
|
||||||
|
|
||||||
```bash
|
|
||||||
swiftc kymo/Core/Models/FanMetrics.swift kymo/Core/Monitors/CPUTemperatureMonitor.swift \
|
|
||||||
kymo/UI/Components/FanSpeedIndicator.swift kymo/UI/Components/MetricText.swift \
|
|
||||||
kymoTests/FanChecks.swift -o /private/tmp/kymo-fan-checks
|
|
||||||
/private/tmp/kymo-fan-checks
|
|
||||||
```
|
|
||||||
|
|
||||||
检查解码/非法/零RPM、速度档位、连续相位及停转。动态手感仍需实际面板验收,不将状态检查等同于帧呈现验证。
|
|
||||||
|
|
||||||
## 内存
|
|
||||||
|
|
||||||
容量单位、分类守恒与本机采样:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
swiftc -parse-as-library kymo/Core/Models/*.swift kymo/Core/Monitors/*.swift kymo/Core/Services/*.swift kymo/Core/Extensions/*.swift kymoTests/MemoryChecks.swift -o /private/tmp/kymo-memory-check
|
|
||||||
/private/tmp/kymo-memory-check
|
|
||||||
```
|
|
||||||
|
|
||||||
## 公网地址
|
|
||||||
|
|
||||||
服务检查使用隔离 URLProtocol,不发送真实请求。可控单调时钟检查 600 秒成功缓存 / 30 秒失败重试边界;模拟 `URLError.timedOut` 检查错误恢复,短周期运行面板实际调用的持续刷新逻辑并核对取消请求 / 等待后不再发布。这不等于真实传输等待 5 秒超时:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
swiftc -parse-as-library kymo/Core/Services/PublicIPAddressService.swift kymoTests/PublicIPAddressChecks.swift -o /private/tmp/kymo-ip-checks
|
|
||||||
/private/tmp/kymo-ip-checks
|
|
||||||
```
|
|
||||||
|
|
||||||
## 字符串与语言宿主
|
|
||||||
|
|
||||||
完整字符串表覆盖与格式参数检查:`python3 kymoTests/LocalizationCatalogChecks.py`。以 zh-Hans 为参数语义基准检查三语完整性,不能替代翻译语义审阅和界面排版验收。
|
|
||||||
|
|
||||||
AppKit 宿主即时语言刷新回归检查:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
swiftc -parse-as-library kymo/Core/Services/LanguagePreferences.swift kymo/UI/Components/AppLanguageScope.swift kymoTests/LanguageScopeChecks.swift -o /private/tmp/kymo-scope-checks
|
|
||||||
/private/tmp/kymo-scope-checks
|
|
||||||
```
|
|
||||||
|
|
||||||
## 资源开关周期测量
|
|
||||||
|
|
||||||
显式开启的真实面板入口、组件隔离参数与首批证据见[轻量化实施记录](efficiency-first-batch.md)。`SensorScheduleChecks` 核对分能力失败退避、封顶与恢复;`SamplingIntervalChecks` 同时核对隐藏无消费者零采样、旧偏好迁移、显式开关与重开断点。它们不替代真实签名 XPC 故障注入、完整面板输入或长期功耗验收。
|
|
||||||
|
|
||||||
Release 配置由各 Target 在签名前 strip,保留包外 dSYM;测量必须对最终签名包统计文件逻辑大小、相同格式 ZIP 与资源 rendition,不能使用只改 DerivedData 的手工 strip 结果。首次局部结果低于包大小预算,不代表内存 / CPU / W / 8 小时已经通过。
|
|
||||||
|
|
||||||
`BoundedProcessChecks` 实际启动本检查程序的子模式,验证精确上限 / 超限、大输出、非零退出、关闭 stdout 后挂起、忽略 SIGTERM 的静默挂起、截止时间、启动前与启动后取消,以及直接子进程全部回收。独立运行不需要 GUI、网络或管理员权限;禁止以真实系统进程充当终止测试对象。
|
|
||||||
|
|
||||||
## 第二批效率回归与对照
|
|
||||||
|
|
||||||
`ProcessEnergyChecks` 覆盖大 UInt64 差分与序列化、首帧 / 零值 / 回退 / 身份复用 / 缺失 / 时间边界、真实能量与 CPU 排序相反、部分覆盖与无 CPU 降级;`ProcessEnergyReaderChecks` 覆盖本机受控 CPU 能量增长、身份 / UID、重复和超限请求。`SamplingIntervalChecks` 增加进程发布不触发资源观察者、系统 / 显示器睡眠、显式后台保留及旧需求代次不能覆盖新状态。状态注入不等于真实硬件睡眠实测。
|
|
||||||
|
|
||||||
`PanelWindowChecks` 额外用独立原生窗口完全遮挡固定面板,检查采样降级、恢复及 orderOut / orderFront。测试时不要同时运行固定浮动的资源审计窗口,否则测试窗口被覆盖会使“可见”断言失效。
|
|
||||||
|
|
||||||
纯文字与完整面板对照使用同一 Release 诊断包,构建时设置 `SWIFT_ACTIVE_COMPILATION_CONDITIONS=KYMO_AUDIT`;普通 Release 已排除诊断实现。`KYMO_RESOURCE_AUDIT=1 KYMO_DIAGNOSTICS=1` 启用三轮真实窗口生命周期,`KYMO_AUDIT_OMIT=text` 选择原生虚拟文字列表;保留全部后端、历史、公网策略和候选进程,只取消图表、图标、动画与复杂交互呈现。每次顺序运行,固定鼠标位置、不并行编译或 GUI 检查。日志记录 materialized cells 与关闭内容弱引用;这是诊断前端,并非产品界面已替换。
|
|
||||||
|
|
||||||
同一诊断包增加 `KYMO_XPC_AUDIT=1` 可检查 ServiceRequest 重复 / 并发响应、超时、启动前与在途取消。这使用真实连接生命周期与注入的本地完成回调,不代表服务端中断 / 崩溃传播已经实测;对端认证和实际读取另行验证。
|
|
||||||
|
|
||||||
## 第三批原生绘制与表格回归
|
|
||||||
|
|
||||||
第三批新增四项,当时共 33 个 Swift 检查入口:
|
|
||||||
|
|
||||||
- `NativeMetricDrawingChecks`(GUI):真实 NSWindow 中捕获组件位图,检查曲线连续 / 跳过无值点 / 显式断点 / 全缺失、悬浮输入、深色外观、重复输入不重绘,以及圆环零 / 四分之一 / 完整像素。
|
|
||||||
- `NativeProcessTableChecks`(GUI):500 行真实原生表格的可见单元格创建上限、原地刷新、身份选择重排 / 删除、委托外发布、排序、三语列头和复制菜单;将合成 Esc NSEvent 经窗口 sendEvent 投递到 firstResponder,验证退出回调。合成事件不是实际系统键盘或菜单栏事件。
|
|
||||||
- `ProcessIconCacheChecks`:显示位图内容 / 尺寸、同应用共享、到期、LRU / 严格数量与像素字节上限、清空。
|
|
||||||
- `NetworkAddressChecks`:应用沙盒下 IPv4 / IPv6 / mapped / 已知和未知 scope 与系统 numeric formatter 的文本等价性,核对本机实际地址但不输出地址值;空缓冲失败边界。
|
|
||||||
|
|
||||||
原生表格测试临时包复制实际编译的本地化资源后签名;不在运行时伪造资源。全部检查:`python3 tools/check.py --app /absolute/path/to/kymo.app --gui --network`。不要与固定浮动的性能审计窗口并行运行。
|
|
||||||
|
|
||||||
NativeProcessTableChecks 同时检查进程指标在前、路径在末的列顺序,末列路径内容、有效路径复制菜单、路径双向排序,以及原有内存 / 功率列、缺失路径和选择身份回归;列位置调整后按稳定标识定位数值列。
|
|
||||||
|
|
||||||
本轮组件隔离、完整三轮、CPU 与未解决项见[第三批记录](efficiency-third-batch.md)。正式面板局部截图与实际鼠标 / 键盘输入需单独确认;组件像素检查不等同完整面板视觉验收。
|
|
||||||
|
|
||||||
## 静态呈现与后台记录
|
|
||||||
|
|
||||||
`BackgroundTrendChecks` 使用真实 Store 验证前台 2 秒 / 后台 30 秒、隐藏 6 秒未到后台截止即重开的曲线连续性;另验实际后台样本、隐藏进程 / 能量停止、关闭后台后保留真实断点。`SamplingChecks` 覆盖总历史与每接口的后续周期记录,`PanelCurveChecks`、`GPUStatisticsChecks` 和原生图层检查防止周期变化反向连接真正的漏采。修复与验证记录见[后台趋势连续性](background-trend-continuity-fix.md)。
|
|
||||||
|
|
||||||
界面统一静态刷新,不再提供减弱动画开关,也不再接受该旧偏好改变呈现。`AppearancePreferencesChecks` 检查旧键保持原值、外观与后台记录互不影响;`SamplingIntervalChecks` 继续覆盖暂停、隐藏、睡眠、恢复和历史断点。
|
|
||||||
|
|
||||||
此前保留动效和命令行减弱模式的实验属于历史,见[动效排查](motion-and-efficiency-plan.md)与[保留动效记录](motion-preservation-plan.md)。本次以相同采样配置比较旧 1.1 和静态版,不通过同时停采获取虚假动效收益。当前测量与工具能力以[静态呈现计划](static-presentation-plan.md)的本轮记录为准。
|
|
||||||
|
|
||||||
## 进程 CPU 实际时钟
|
|
||||||
|
|
||||||
`ProcessCPULiveChecks` 使用实际 ProcessMonitor 对本检查程序采样,再执行约 200 ms CPU 工作,与独立 CLOCK_PROCESS_CPUTIME_ID 对照,防止把 Mach CPU tick 当纳秒而在 Apple Silicon 上少报;包含零差分与非法 timebase。不能用纯合成纳秒计数替代此检查。
|
|
||||||
|
|
||||||
自己的面板内容位图可用 `KYMO_AUDIT_CAPTURE=1` 在 open1.10 时经 stdout 返回 audit.capture 的 PNG;仅 Debug / KYMO_AUDIT 编入,实现只绘制自身宿主、限制面积,不读取桌面。该操作会增加内存和 CPU,必须单独运行,不纳入资源基线;原始图含本应用展示的进程 / 网络信息,验收后清理。
|
|
||||||
|
|
||||||
历史第四批的 AX / 截图结果不代表当前工具可用;每轮重新核查并记录具体受阻路径。full 分配历史需按本机 `man malloc` 显式设置 MallocStackLogging=full;不能将 lite 的当前分配当成峰值历史。
|
|
||||||
|
|
||||||
## 历史动效回归
|
|
||||||
|
|
||||||
原 numericText、曲线关键帧和圆环插值检查已随静态方案移除,不能再作为当前产品行为。旧三轮 Release 对照与当时未达标项保留在[历史记录](motion-preservation-plan.md);当前结论见[静态呈现计划](static-presentation-plan.md)。
|
|
||||||
|
|
||||||
## 进程内存口径回归
|
|
||||||
|
|
||||||
ProcessEnergyReaderChecks 同时验证独立于能量能力的 ProcessMemoryReader:真实 footprint 与 TASK_VM_INFO.phys_footprint 接近、错启动时间 / 零 PID / 其他 UID 拒绝、重复 PID / 大包 / 解码 / 批量上限、完整身份合并、缺失清空和有效零。ProcessSelectionChecks 检查 footprint 双向排序及缺失置后;NativeProcessTableChecks 在真实原生表格检查活动监视器一致的二进制 MB 显示。端到端签名沙盒 → XPC → 表格及同 PID 对照记录见[内存修正记录](process-memory-alignment-plan.md)。不同时间点的截图不能要求逐字节相等。
|
|
||||||
|
|
||||||
## 无持久网络数据检查
|
|
||||||
|
|
||||||
PublicIPAddressChecks 使用生产 sessionConfiguration,验证缓存 / Cookie / 凭据存储禁用,保留内存缓存、错误重试、连续刷新、路由切换与取消行为。SandboxNetworkChecks 编译生产 PublicIPAddressService,使用构建产物真实 entitlement 在独立签名沙盒中执行有效 HTTPS、重复查询和新路由查询,对比请求前后 Library/Caches、HTTPStorages、Cookies、WebKit 内常规文件的路径、大小与修改时间,避免仅检查配置就声称无落盘。只输出成功 / 失败,不记录公网 IP。网络 / 网络接口测试在 finally 中清理本轮随机 bundle ID 对应的临时容器,遇到非本工具标识或符号链接拒绝删除,真实应用容器不在范围内。该短时检查不证明 macOS 系统级零写盘或长期行为。
|
|
||||||
|
|
||||||
## Hardened Release 服务验证
|
|
||||||
|
|
||||||
`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。
|
|
||||||
|
|
||||||
## 双页与 CPU 功率
|
|
||||||
|
|
||||||
DetailDemandChecks 验证概览零进程枚举、切页时旧同步任务不回写、单在途、基础 CPU 差分和历史连续、暂停 / 隐藏优先。ProcessEnergyChecks 增加多于三项功率、完整身份合并和 PID 复用;ProcessSelectionChecks 增加功率双向排序、零值与缺失置后;NativeProcessTableChecks 验证真实原生功率列文本、统计窗口和排序回调;PanelWindowChecks 验证关闭重开默认概览。PanelLayoutChecks 覆盖两列配对行高和小屏滚动。
|
|
||||||
|
|
||||||
显式诊断构建(DEBUG 或 KYMO_AUDIT)可设置 KYMO_RESOURCE_AUDIT=1、KYMO_AUDIT_INTERACTIVE=1 打开固定面板供实际交互,可加 KYMO_AUDIT_SIZE=760x600 检查实际小 viewport;KYMO_AUDIT_PAGE=processes 选择资源循环中的进程页;KYMO_AUDIT_QUICK=1 使用 3 秒初始隐藏、每轮 30 秒展开 / 5 秒关闭,不执行暂停段。普通 Release 不包含驱动实现。此类诊断驱动不能替代实际输入事件,也不能证明长期性能预算。
|
|
||||||
|
|
||||||
TabPickerChecks 使用实际挂载的扁平页签检查双向选择绑定、原生点击 / 辅助功能按下、tabGroup / tabButton 角色及选中值、左右 / Home / End 切换和焦点跟随、三语标签原地更新及选择保留。外观是否存在玻璃高光仍需实际截图检查,程序语义检查不能替代视觉验收。640pt 面板与后续高度建议见[收窄方案](compact-panel-refinement-plan.md);卡片高度阶段新增独立列预算、动态窗口高度、0–128 核可读行数及小屏滚动回归;不复用上一轮资源数据宣称进一步节能。
|
|
||||||
|
|
||||||
卡片高度阶段的 PanelLayoutChecks 验证左 / 右卡片独立、内存精简后普通两列底部同高 564pt / 窗口 658pt、无风扇时右列决定高度、高核心数 / 屏幕上限及滚动;PanelWindowChecks 验证控制器响应首选高度、重复预算不重设窗口与实际 contentLayoutRect;CPUCoreGridChecks 检查不再把高核心数挤进三行。MemoryHeaderChecks 使用构建产物的三语资源检查压力标签、缓存与 Swap 提示、有效零及未知 / 缺失样本;实际悬浮触发与窄标题可读性另以原生 UI 验收。实际设备只代表本机,纯几何检查不替代真实高核心数 / 多显示器验收。
|
|
||||||
|
|||||||
@@ -60,32 +60,9 @@
|
|||||||
D9E51E73309338B0000608DE /* kymo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = kymo.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
D9E51E73309338B0000608DE /* kymo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = kymo.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */
|
|
||||||
AA00000000000000000000A1 /* Exceptions for "kymo" folder in "kymo" target */ = {
|
|
||||||
isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
|
|
||||||
membershipExceptions = (
|
|
||||||
Core/Extensions/.gitkeep,
|
|
||||||
Core/Models/.gitkeep,
|
|
||||||
Core/Monitors/.gitkeep,
|
|
||||||
Core/README.md,
|
|
||||||
Features/Dashboard/.gitkeep,
|
|
||||||
Features/README.md,
|
|
||||||
Features/Settings/.gitkeep,
|
|
||||||
Resources/README.md,
|
|
||||||
UI/Charts/.gitkeep,
|
|
||||||
UI/Components/.gitkeep,
|
|
||||||
UI/README.md,
|
|
||||||
);
|
|
||||||
target = D9E51E72309338B0000608DE /* kymo */;
|
|
||||||
};
|
|
||||||
/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */
|
|
||||||
|
|
||||||
/* Begin PBXFileSystemSynchronizedRootGroup section */
|
/* Begin PBXFileSystemSynchronizedRootGroup section */
|
||||||
D9E51E75309338B0000608DE /* kymo */ = {
|
D9E51E75309338B0000608DE /* kymo */ = {
|
||||||
isa = PBXFileSystemSynchronizedRootGroup;
|
isa = PBXFileSystemSynchronizedRootGroup;
|
||||||
exceptions = (
|
|
||||||
AA00000000000000000000A1 /* Exceptions for "kymo" folder in "kymo" target */,
|
|
||||||
);
|
|
||||||
path = kymo;
|
path = kymo;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import AppKit
|
|||||||
}
|
}
|
||||||
|
|
||||||
@MainActor private final class ApplicationLifecycle: NSObject, NSApplicationDelegate {
|
@MainActor private final class ApplicationLifecycle: NSObject, NSApplicationDelegate {
|
||||||
private let metrics = MetricsStore(energyEnabled: PanelResourceAudit.omitted != "energy")
|
private let metrics = MetricsStore()
|
||||||
private let awake = KeepAwakeService()
|
private let awake = KeepAwakeService()
|
||||||
private let presentation = SettingsPresentation()
|
private let presentation = SettingsPresentation()
|
||||||
private let appearance = AppearancePreferences()
|
private let appearance = AppearancePreferences()
|
||||||
@@ -53,11 +53,6 @@ import AppKit
|
|||||||
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
|
||||||
if PanelResourceAudit.omitted == "text" {
|
|
||||||
TextMonitoringAuditView(metrics: self.metrics, appearance: self.appearance)
|
|
||||||
} else if PanelResourceAudit.omitted == "all" {
|
|
||||||
Text(verbatim: "Kymo").frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
||||||
} else {
|
|
||||||
AppLanguageScope(preferences: language) {
|
AppLanguageScope(preferences: language) {
|
||||||
MenuPanelView(metrics: self.metrics, preferences: self.appearance, keepAwake: self.awake, settingsPresentation: self.presentation,
|
MenuPanelView(metrics: self.metrics, preferences: self.appearance, keepAwake: self.awake, settingsPresentation: self.presentation,
|
||||||
presentation: panel, onOpenSettings: { [weak self] in
|
presentation: panel, onOpenSettings: { [weak self] in
|
||||||
@@ -68,7 +63,6 @@ import AppKit
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if let menuBar { PanelResourceAudit.run(controller: menuBar, metrics: metrics) }
|
if let menuBar { PanelResourceAudit.run(controller: menuBar, metrics: metrics) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,4 @@ nonisolated enum MetricFormat {
|
|||||||
guard let value, value.isFinite, value >= 0 else { return "--" }
|
guard let value, value.isFinite, value >= 0 else { return "--" }
|
||||||
return String(format: "%.1f W", value)
|
return String(format: "%.1f W", value)
|
||||||
}
|
}
|
||||||
|
|
||||||
static func decimal(_ value: Double) -> String { String(format: "%.1f", value) }
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ nonisolated struct TrendSample: Sendable {
|
|||||||
let gpu: Double?
|
let gpu: Double?
|
||||||
let memory: Double?
|
let memory: Double?
|
||||||
var download: Double?
|
var download: Double?
|
||||||
var disk: Double?
|
|
||||||
var battery: Double?
|
var battery: Double?
|
||||||
var batteryPower: Double?
|
var batteryPower: Double?
|
||||||
var upload: Double?
|
var upload: Double?
|
||||||
@@ -45,7 +44,7 @@ nonisolated struct MetricHistory: Sendable {
|
|||||||
mutating func append(_ snapshot: MetricsSnapshot, breakBefore: Bool = false, expectedInterval: TimeInterval = 2) {
|
mutating func append(_ snapshot: MetricsSnapshot, breakBefore: Bool = false, expectedInterval: TimeInterval = 2) {
|
||||||
samples.append(TrendSample(date: snapshot.date, cpu: snapshot.cpu?.usage,
|
samples.append(TrendSample(date: snapshot.date, cpu: snapshot.cpu?.usage,
|
||||||
gpu: snapshot.gpuUsage, memory: snapshot.memory?.usage,
|
gpu: snapshot.gpuUsage, memory: snapshot.memory?.usage,
|
||||||
download: snapshot.downloadRate, disk: snapshot.disk?.usage,
|
download: snapshot.downloadRate,
|
||||||
battery: snapshot.battery?.charge, batteryPower: snapshot.battery?.power,
|
battery: snapshot.battery?.charge, batteryPower: snapshot.battery?.power,
|
||||||
upload: snapshot.uploadRate,
|
upload: snapshot.uploadRate,
|
||||||
read: snapshot.diskIO?.read, write: snapshot.diskIO?.written,
|
read: snapshot.diskIO?.read, write: snapshot.diskIO?.written,
|
||||||
@@ -71,30 +70,3 @@ nonisolated struct InterfaceTrendSample: Sendable {
|
|||||||
/// Scheduled cadence from this point to the next interface sample.
|
/// Scheduled cadence from this point to the next interface sample.
|
||||||
var expectedInterval: TimeInterval = 2
|
var expectedInterval: TimeInterval = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Time-weighted observed utilization; never bridge failures or sleep boundaries.
|
|
||||||
nonisolated struct GPUUtilizationSummary {
|
|
||||||
let average: Double?
|
|
||||||
let peak: Double?
|
|
||||||
let coverage: TimeInterval
|
|
||||||
|
|
||||||
init(samples: [TrendSample], window: TimeInterval = 60) {
|
|
||||||
guard let end = samples.last?.date else { average = nil; peak = nil; coverage = 0; return }
|
|
||||||
let start = end.addingTimeInterval(-window)
|
|
||||||
peak = samples.filter { $0.date >= start }.compactMap(\.gpu).max()
|
|
||||||
var area = 0.0
|
|
||||||
var duration = 0.0
|
|
||||||
for (a, b) in zip(samples, samples.dropFirst()) {
|
|
||||||
let dt = b.date.timeIntervalSince(a.date)
|
|
||||||
guard !b.breakBefore, dt > 0, dt <= a.expectedInterval * 2.5,
|
|
||||||
let av = a.gpu, let bv = b.gpu else { continue }
|
|
||||||
let overlap = b.date.timeIntervalSince(max(a.date, start))
|
|
||||||
guard overlap > 0 else { continue }
|
|
||||||
let left = av + (bv - av) * (1 - overlap / dt)
|
|
||||||
area += (left + bv) * 0.5 * overlap
|
|
||||||
duration += overlap
|
|
||||||
}
|
|
||||||
coverage = duration
|
|
||||||
average = duration > 0 ? area / duration : nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -35,15 +35,12 @@ nonisolated struct MetricsSnapshot: Sendable {
|
|||||||
var diskIO: DiskIOMetrics?
|
var diskIO: DiskIOMetrics?
|
||||||
var volumes: [VolumeMetrics]?
|
var volumes: [VolumeMetrics]?
|
||||||
var battery: BatteryMetrics?
|
var battery: BatteryMetrics?
|
||||||
var load: [Double] = []
|
|
||||||
var uptime: TimeInterval = 0
|
var uptime: TimeInterval = 0
|
||||||
var gpu: GPUMetrics?
|
var gpu: GPUMetrics?
|
||||||
var processes: ProcessSnapshot?
|
var processes: ProcessSnapshot?
|
||||||
var diskHealthDate: Date?
|
|
||||||
var batteryHealthDate: Date?
|
|
||||||
var batteryState: BatteryAvailability = .unknown
|
var batteryState: BatteryAvailability = .unknown
|
||||||
// GPU total is backed by validated IOAccelerator device statistics.
|
// GPU total is backed by validated IOAccelerator device statistics.
|
||||||
var gpuUsage: Double? = nil
|
var gpuUsage: Double? { gpu?.usage }
|
||||||
}
|
}
|
||||||
|
|
||||||
nonisolated extension MetricsSnapshot {
|
nonisolated extension MetricsSnapshot {
|
||||||
|
|||||||
@@ -23,19 +23,17 @@ nonisolated struct ProcessEnergyReply: Codable, Sendable {
|
|||||||
let readings: [ProcessEnergyReading]
|
let readings: [ProcessEnergyReading]
|
||||||
}
|
}
|
||||||
nonisolated struct ProcessEnergyUsage: Identifiable, Sendable {
|
nonisolated struct ProcessEnergyUsage: Identifiable, Sendable {
|
||||||
let process: ProcessMetrics
|
let id: ProcessIdentity
|
||||||
let watts: Double
|
let watts: Double
|
||||||
let seconds: TimeInterval
|
let seconds: TimeInterval
|
||||||
var id: ProcessIdentity { process.id }
|
|
||||||
var formattedPower: String { watts >= 1 ? String(format: "%.2f W", watts) : String(format: "%.1f mW", watts * 1000) }
|
|
||||||
}
|
}
|
||||||
nonisolated struct ProcessEnergySnapshot: Sendable {
|
nonisolated struct ProcessEnergySnapshot: Sendable {
|
||||||
enum State: Sendable { case waiting, available, partial, unavailable, unsupported }
|
enum State: Sendable { case waiting, available, partial, unavailable, unsupported }
|
||||||
let date: Date
|
let date: Date
|
||||||
let candidates: Int
|
let candidates: Int
|
||||||
let readable: Int
|
let readable: Int
|
||||||
let measured: Int
|
|
||||||
let rows: [ProcessEnergyUsage] // All valid measurements; no CPU prefilter.
|
let rows: [ProcessEnergyUsage] // All valid measurements; no CPU prefilter.
|
||||||
|
var measured: Int { rows.count }
|
||||||
let state: State
|
let state: State
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,6 @@ nonisolated struct GPUMetrics: Sendable {
|
|||||||
let coreCount: Int?
|
let coreCount: Int?
|
||||||
var renderer: Double? = nil
|
var renderer: Double? = nil
|
||||||
var tiler: Double? = nil
|
var tiler: Double? = nil
|
||||||
// Driver accounting, not dedicated VRAM or a capacity denominator.
|
|
||||||
var inUseMemory: UInt64? = nil
|
|
||||||
var allocatedMemory: UInt64? = nil
|
|
||||||
// Independent per-core counters have not been obtained. Never split total usage.
|
// Independent per-core counters have not been obtained. Never split total usage.
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,21 +24,12 @@ nonisolated enum GPUMonitor {
|
|||||||
let cores = (IORegistryEntryCreateCFProperty(service, "gpu-core-count" as CFString, kCFAllocatorDefault, 0)?.takeRetainedValue() as? NSNumber)?.intValue
|
let cores = (IORegistryEntryCreateCFProperty(service, "gpu-core-count" as CFString, kCFAllocatorDefault, 0)?.takeRetainedValue() as? NSNumber)?.intValue
|
||||||
devices.append(GPUMetrics(usage: normalized(raw), coreCount: cores.flatMap { $0 > 0 ? $0 : nil },
|
devices.append(GPUMetrics(usage: normalized(raw), coreCount: cores.flatMap { $0 > 0 ? $0 : nil },
|
||||||
renderer: normalized((stats?["Renderer Utilization %"] as? NSNumber)?.doubleValue),
|
renderer: normalized((stats?["Renderer Utilization %"] as? NSNumber)?.doubleValue),
|
||||||
tiler: normalized((stats?["Tiler Utilization %"] as? NSNumber)?.doubleValue),
|
tiler: normalized((stats?["Tiler Utilization %"] as? NSNumber)?.doubleValue)))
|
||||||
inUseMemory: memoryBytes(stats?["In use system memory"]),
|
|
||||||
allocatedMemory: memoryBytes(stats?["Alloc system memory"])))
|
|
||||||
}
|
}
|
||||||
// Do not average incompatible utilization counters on multi-GPU machines.
|
// Do not average incompatible utilization counters on multi-GPU machines.
|
||||||
return devices.count == 1 ? devices[0] : nil
|
return devices.count == 1 ? devices[0] : nil
|
||||||
}
|
}
|
||||||
|
|
||||||
static func memoryBytes(_ raw: Any?) -> UInt64? {
|
|
||||||
guard let number = raw as? NSNumber else { return nil }
|
|
||||||
let value = number.doubleValue
|
|
||||||
guard value.isFinite, value >= 0, value < Double(UInt64.max) else { return nil }
|
|
||||||
return UInt64(value)
|
|
||||||
}
|
|
||||||
|
|
||||||
static func normalized(_ value: Double?) -> Double? {
|
static func normalized(_ value: Double?) -> Double? {
|
||||||
value.flatMap { $0.isFinite && (0...100).contains($0) ? $0 / 100 : nil }
|
value.flatMap { $0.isFinite && (0...100).contains($0) ? $0 / 100 : nil }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,30 +17,26 @@ nonisolated struct ProcessEnergyMonitor: Sendable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mutating func update(processes: ProcessSnapshot, readings: [ProcessEnergyReading], capability: EnergyCapability, maximumInterval: TimeInterval = 30) -> ProcessEnergySnapshot {
|
mutating func update(processes: ProcessSnapshot, readings: [ProcessEnergyReading], capability: EnergyCapability, maximumInterval: TimeInterval = 30) -> ProcessEnergySnapshot {
|
||||||
let processesByID = Dictionary(processes.rows.map { ($0.id, $0) }, uniquingKeysWith: { first, _ in first })
|
let identities = Set(processes.rows.map(\.id))
|
||||||
var next: [ProcessIdentity: ProcessEnergyReading] = [:]
|
var next: [ProcessIdentity: ProcessEnergyReading] = [:]
|
||||||
var usages: [ProcessEnergyUsage] = []
|
var usages: [ProcessEnergyUsage] = []
|
||||||
var measured = 0
|
|
||||||
if capability == .verifiedCPU && !processes.failed {
|
if capability == .verifiedCPU && !processes.failed {
|
||||||
for reading in readings where next[reading.id] == nil {
|
for reading in readings where next[reading.id] == nil {
|
||||||
guard let process = processesByID[reading.id], reading.status == .available,
|
guard identities.contains(reading.id), reading.status == .available,
|
||||||
reading.nanojoules != nil, reading.birth > 0, reading.uptime.isFinite else { continue }
|
reading.nanojoules != nil, reading.birth > 0, reading.uptime.isFinite else { continue }
|
||||||
next[reading.id] = reading
|
next[reading.id] = reading
|
||||||
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
|
usages.append(ProcessEnergyUsage(id: reading.id, watts: power, seconds: seconds))
|
||||||
let usage = ProcessEnergyUsage(process: process, watts: power, seconds: seconds)
|
|
||||||
usages.append(usage)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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 }
|
||||||
else if measured == 0 { state = .waiting }
|
else if usages.isEmpty { state = .waiting }
|
||||||
else { state = measured < processes.enumerated ? .partial : .available }
|
else { state = usages.count < processes.enumerated ? .partial : .available }
|
||||||
return ProcessEnergySnapshot(date: Date(), candidates: processes.enumerated, readable: next.count,
|
return ProcessEnergySnapshot(date: Date(), candidates: processes.enumerated, readable: next.count,
|
||||||
measured: measured, rows: usages, state: state)
|
rows: usages, state: state)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,8 +24,6 @@ actor SystemSampler {
|
|||||||
private var batteryTask: Task<Void, Never>?
|
private var batteryTask: Task<Void, Never>?
|
||||||
private var diskCache: DiskHealthMetrics?
|
private var diskCache: DiskHealthMetrics?
|
||||||
private var batteryCache: Double?
|
private var batteryCache: Double?
|
||||||
private var diskDate: Date?
|
|
||||||
private var batteryDate: Date?
|
|
||||||
private var nextDisk: TimeInterval = 0
|
private var nextDisk: TimeInterval = 0
|
||||||
private var nextBattery: TimeInterval = 0
|
private var nextBattery: TimeInterval = 0
|
||||||
private let processRead: @Sendable (inout ProcessMonitor) -> ProcessSnapshot
|
private let processRead: @Sendable (inout ProcessMonitor) -> ProcessSnapshot
|
||||||
@@ -67,7 +65,7 @@ actor SystemSampler {
|
|||||||
// A synchronous OS read may outlive cancellation. Keep the in-flight slot occupied.
|
// A synchronous OS read may outlive cancellation. Keep the in-flight slot occupied.
|
||||||
}
|
}
|
||||||
|
|
||||||
func sample(includeProcesses: Bool? = nil, includeSlowMetrics: Bool = true, maximumEnergyInterval: TimeInterval = 30, includeEnergy: Bool = true, demandRevision: Int? = nil,
|
func sample(includeProcesses: Bool? = nil, includeSlowMetrics: Bool = true, maximumEnergyInterval: TimeInterval = 30, demandRevision: Int? = nil,
|
||||||
processUpdate: (@Sendable (ProcessSnapshot) -> Void)? = nil,
|
processUpdate: (@Sendable (ProcessSnapshot) -> Void)? = nil,
|
||||||
energyUpdate: (@Sendable (ProcessEnergySnapshot) -> Void)? = nil) -> MetricsSnapshot {
|
energyUpdate: (@Sendable (ProcessEnergySnapshot) -> Void)? = nil) -> MetricsSnapshot {
|
||||||
guard !Task.isCancelled else { return MetricsSnapshot() }
|
guard !Task.isCancelled else { return MetricsSnapshot() }
|
||||||
@@ -75,7 +73,7 @@ actor SystemSampler {
|
|||||||
setProcessVisible(includeProcesses ?? processVisible, revision: demandRevision)
|
setProcessVisible(includeProcesses ?? processVisible, revision: demandRevision)
|
||||||
self.maximumEnergyInterval = min(3600, max(30, maximumEnergyInterval))
|
self.maximumEnergyInterval = min(3600, max(30, maximumEnergyInterval))
|
||||||
self.processUpdate = processUpdate
|
self.processUpdate = processUpdate
|
||||||
self.energyUpdate = includeEnergy ? energyUpdate : nil
|
self.energyUpdate = energyUpdate
|
||||||
if !didProbe {
|
if !didProbe {
|
||||||
didProbe = true
|
didProbe = true
|
||||||
if ProcessInfo.processInfo.environment["KYMO_PANEL_PROBE"] == "1" { PanelCapabilityProbe.run() }
|
if ProcessInfo.processInfo.environment["KYMO_PANEL_PROBE"] == "1" { PanelCapabilityProbe.run() }
|
||||||
@@ -104,7 +102,6 @@ actor SystemSampler {
|
|||||||
result.battery = BatteryMonitor.sample()
|
result.battery = BatteryMonitor.sample()
|
||||||
result.batteryState = result.battery == nil ? BatteryMonitor.availability() : .present
|
result.batteryState = result.battery == nil ? BatteryMonitor.availability() : .present
|
||||||
result.gpu = GPUMonitor.sample()
|
result.gpu = GPUMonitor.sample()
|
||||||
result.gpuUsage = result.gpu?.usage
|
|
||||||
if includeSlowMetrics && volumeTask == nil && start - volumeSampleTime >= 30 {
|
if includeSlowMetrics && volumeTask == nil && start - volumeSampleTime >= 30 {
|
||||||
volumeTask = Task.detached(priority: .utility) { [self] in
|
volumeTask = Task.detached(priority: .utility) { [self] in
|
||||||
let value = DiskMonitor.volumes()
|
let value = DiskMonitor.volumes()
|
||||||
@@ -120,13 +117,9 @@ actor SystemSampler {
|
|||||||
startProcessesIfNeeded()
|
startProcessesIfNeeded()
|
||||||
result.processes = processVisible ? processCache : nil
|
result.processes = processVisible ? processCache : nil
|
||||||
result.diskHealth = diskCache
|
result.diskHealth = diskCache
|
||||||
result.diskHealthDate = diskDate
|
|
||||||
result.battery?.health = batteryCache
|
result.battery?.health = batteryCache
|
||||||
result.batteryHealthDate = batteryDate
|
|
||||||
result.volumes = volumes
|
result.volumes = volumes
|
||||||
result.uptime = ProcessInfo.processInfo.systemUptime
|
result.uptime = ProcessInfo.processInfo.systemUptime
|
||||||
var load = [Double](repeating: 0, count: 3)
|
|
||||||
if getloadavg(&load, 3) == 3 { result.load = load }
|
|
||||||
if ProcessInfo.processInfo.environment["KYMO_PANEL_PROBE"] == "1" {
|
if ProcessInfo.processInfo.environment["KYMO_PANEL_PROBE"] == "1" {
|
||||||
let line = "{\"event\":\"sampleDuration\",\"milliseconds\":\((ProcessInfo.processInfo.systemUptime - start) * 1000)}\n"
|
let line = "{\"event\":\"sampleDuration\",\"milliseconds\":\((ProcessInfo.processInfo.systemUptime - start) * 1000)}\n"
|
||||||
try? FileHandle.standardOutput.write(contentsOf: Data(line.utf8))
|
try? FileHandle.standardOutput.write(contentsOf: Data(line.utf8))
|
||||||
@@ -146,11 +139,11 @@ actor SystemSampler {
|
|||||||
volumes = value; volumeSampleTime = ProcessInfo.processInfo.systemUptime; volumeTask = nil
|
volumes = value; volumeSampleTime = ProcessInfo.processInfo.systemUptime; volumeTask = nil
|
||||||
}
|
}
|
||||||
private func finishDisk(_ value: DiskHealthMetrics?) {
|
private func finishDisk(_ value: DiskHealthMetrics?) {
|
||||||
diskCache = value; diskDate = value == nil ? nil : Date()
|
diskCache = value
|
||||||
nextDisk = ProcessInfo.processInfo.systemUptime + (value == nil ? 600 : 3600); diskTask = nil
|
nextDisk = ProcessInfo.processInfo.systemUptime + (value == nil ? 600 : 3600); diskTask = nil
|
||||||
}
|
}
|
||||||
private func finishBattery(_ value: Double?) {
|
private func finishBattery(_ value: Double?) {
|
||||||
batteryCache = value; batteryDate = value == nil ? nil : Date()
|
batteryCache = value
|
||||||
nextBattery = ProcessInfo.processInfo.systemUptime + (value == nil ? 600 : 3600); batteryTask = nil
|
nextBattery = ProcessInfo.processInfo.systemUptime + (value == nil ? 600 : 3600); batteryTask = nil
|
||||||
}
|
}
|
||||||
private func startProcessesIfNeeded() {
|
private func startProcessesIfNeeded() {
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
# 核心层
|
|
||||||
|
|
||||||
模块职责统一见[架构](../../docs/architecture.md)。
|
|
||||||
@@ -14,7 +14,6 @@ final class MetricsStore {
|
|||||||
private(set) var processUpdatesRequested = false
|
private(set) var processUpdatesRequested = false
|
||||||
private(set) var slowMetricsRequested = true
|
private(set) var slowMetricsRequested = true
|
||||||
let sampling: SamplingPreferences
|
let sampling: SamplingPreferences
|
||||||
private let energyEnabled: Bool
|
|
||||||
private var panelDemand: Bool { isPanelVisible && !isDisplaySleeping }
|
private var panelDemand: Bool { isPanelVisible && !isDisplaySleeping }
|
||||||
private var processDemand: Bool { panelDemand && processUpdatesRequested }
|
private var processDemand: Bool { panelDemand && processUpdatesRequested }
|
||||||
var effectiveMilliseconds: Int { panelDemand ? sampling.panelMilliseconds : sampling.backgroundMilliseconds }
|
var effectiveMilliseconds: Int { panelDemand ? sampling.panelMilliseconds : sampling.backgroundMilliseconds }
|
||||||
@@ -31,9 +30,8 @@ final class MetricsStore {
|
|||||||
@ObservationIgnored private var needsHistoryBoundary = true
|
@ObservationIgnored private var needsHistoryBoundary = true
|
||||||
@ObservationIgnored private var lastPublishedAt: ContinuousClock.Instant?
|
@ObservationIgnored private var lastPublishedAt: ContinuousClock.Instant?
|
||||||
|
|
||||||
init(sampling: SamplingPreferences? = nil, sampler: SystemSampler = SystemSampler(), energyEnabled: Bool = true) {
|
init(sampling: SamplingPreferences? = nil, sampler: SystemSampler = SystemSampler()) {
|
||||||
self.sampler = sampler
|
self.sampler = sampler
|
||||||
self.energyEnabled = energyEnabled
|
|
||||||
self.sampling = sampling ?? SamplingPreferences()
|
self.sampling = sampling ?? SamplingPreferences()
|
||||||
self.sampling.onChange = { [weak self] in
|
self.sampling.onChange = { [weak self] in
|
||||||
guard let self, !self.isPaused,
|
guard let self, !self.isPaused,
|
||||||
@@ -78,7 +76,7 @@ final class MetricsStore {
|
|||||||
var next = await sampler.sample(includeProcesses: self?.processDemand == true,
|
var next = await sampler.sample(includeProcesses: self?.processDemand == true,
|
||||||
includeSlowMetrics: self?.panelDemand == true && self?.slowMetricsRequested == 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
|
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.processDemand, !self.isPaused, !self.isSystemSleeping else { return }
|
self.processDemand, !self.isPaused, !self.isSystemSleeping else { return }
|
||||||
|
|||||||
@@ -5,12 +5,6 @@ import Darwin
|
|||||||
nonisolated enum SamplingDiagnostics {
|
nonisolated enum SamplingDiagnostics {
|
||||||
static let enabled = ProcessInfo.processInfo.environment["KYMO_DIAGNOSTICS"] == "1"
|
static let enabled = ProcessInfo.processInfo.environment["KYMO_DIAGNOSTICS"] == "1"
|
||||||
|
|
||||||
static func recordTextPresentation(processes: Int, cells: Int) {
|
|
||||||
guard enabled else { return }
|
|
||||||
let line = "{\"event\":\"textPresentation\",\"processes\":\(processes),\"createdCells\":\(cells)}\n"
|
|
||||||
try? FileHandle.standardOutput.write(contentsOf: Data(line.utf8))
|
|
||||||
}
|
|
||||||
|
|
||||||
static func recordEnergy(_ snapshot: ProcessEnergySnapshot) {
|
static func recordEnergy(_ snapshot: ProcessEnergySnapshot) {
|
||||||
guard enabled else { return }
|
guard enabled else { return }
|
||||||
let payload: [String: Any] = ["event": "energy", "recordedAt": Date().timeIntervalSince1970,
|
let payload: [String: Any] = ["event": "energy", "recordedAt": Date().timeIntervalSince1970,
|
||||||
@@ -21,14 +15,13 @@ nonisolated enum SamplingDiagnostics {
|
|||||||
try? FileHandle.standardOutput.write(contentsOf: data + Data([10]))
|
try? FileHandle.standardOutput.write(contentsOf: data + Data([10]))
|
||||||
}
|
}
|
||||||
|
|
||||||
static func record(_ snapshot: MetricsSnapshot, event: String = "sample", hiddenHostAlive: Bool? = nil, windowNumber: Int? = nil, hoveredPlots: Int? = nil, nativePlots: Int? = nil, pointerInsidePanel: Bool? = nil, plotBounds: [[Double]]? = nil, animatedPlots: Int? = nil) {
|
static func record(_ snapshot: MetricsSnapshot, event: String = "sample", hiddenHostAlive: Bool? = nil, windowNumber: Int? = nil, hoveredPlots: Int? = nil, nativePlots: Int? = nil, pointerInsidePanel: Bool? = nil, plotBounds: [[Double]]? = nil) {
|
||||||
guard enabled else { return }
|
guard enabled else { return }
|
||||||
var payload: [String: Any] = [
|
var payload: [String: Any] = [
|
||||||
"event": event, "timestamp": snapshot.date.timeIntervalSince1970,
|
"event": event, "timestamp": snapshot.date.timeIntervalSince1970,
|
||||||
"recordedAt": Date().timeIntervalSince1970,
|
"recordedAt": Date().timeIntervalSince1970,
|
||||||
"uptime": ProcessInfo.processInfo.systemUptime,
|
"uptime": ProcessInfo.processInfo.systemUptime,
|
||||||
"pid": ProcessInfo.processInfo.processIdentifier,
|
"pid": ProcessInfo.processInfo.processIdentifier
|
||||||
"load": snapshot.load
|
|
||||||
]
|
]
|
||||||
payload["hiddenHostAlive"] = hiddenHostAlive
|
payload["hiddenHostAlive"] = hiddenHostAlive
|
||||||
payload["windowNumber"] = windowNumber
|
payload["windowNumber"] = windowNumber
|
||||||
@@ -36,7 +29,6 @@ nonisolated enum SamplingDiagnostics {
|
|||||||
payload["nativePlots"] = nativePlots
|
payload["nativePlots"] = nativePlots
|
||||||
payload["pointerInsidePanel"] = pointerInsidePanel
|
payload["pointerInsidePanel"] = pointerInsidePanel
|
||||||
payload["plotBounds"] = plotBounds
|
payload["plotBounds"] = plotBounds
|
||||||
payload["animatedPlots"] = animatedPlots
|
|
||||||
payload["cpu"] = snapshot.cpu?.usage
|
payload["cpu"] = snapshot.cpu?.usage
|
||||||
payload["cores"] = snapshot.cpu?.cores.count
|
payload["cores"] = snapshot.cpu?.cores.count
|
||||||
payload["cpuTemperature"] = snapshot.cpuTemperature
|
payload["cpuTemperature"] = snapshot.cpuTemperature
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import SwiftUI
|
|||||||
struct CPUCoreGrid: View {
|
struct CPUCoreGrid: View {
|
||||||
let values: [Double]
|
let values: [Double]
|
||||||
let kinds: [Int: CPUCoreTopology.Kind]
|
let kinds: [Int: CPUCoreTopology.Kind]
|
||||||
let interval: TimeInterval
|
|
||||||
|
|
||||||
private func color(_ kind: CPUCoreTopology.Kind?) -> Color {
|
private func color(_ kind: CPUCoreTopology.Kind?) -> Color {
|
||||||
switch kind {
|
switch kind {
|
||||||
@@ -141,7 +140,7 @@ private struct CPUCoreGridPreviews: View {
|
|||||||
VStack(alignment: .leading, spacing: 4) {
|
VStack(alignment: .leading, spacing: 4) {
|
||||||
Text("\(count) cores").font(.caption)
|
Text("\(count) cores").font(.caption)
|
||||||
CPUCoreGrid(values: (0..<count).map { Double(($0 * 17) % 90 + 5) / 100 },
|
CPUCoreGrid(values: (0..<count).map { Double(($0 * 17) % 90 + 5) / 100 },
|
||||||
kinds: Dictionary(uniqueKeysWithValues: (0..<count).map { ($0, $0 < count / 3 ? .efficiency : .performance) }), interval: 2)
|
kinds: Dictionary(uniqueKeysWithValues: (0..<count).map { ($0, $0 < count / 3 ? .efficiency : .performance) }))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.padding().frame(width: width)
|
}.padding().frame(width: width)
|
||||||
|
|||||||
@@ -1,38 +0,0 @@
|
|||||||
import SwiftUI
|
|
||||||
|
|
||||||
/// Memory bars share a byte scale, not a used/allocated capacity ratio.
|
|
||||||
struct GPUStatisticsView: View {
|
|
||||||
let inUse: UInt64?
|
|
||||||
let allocated: UInt64?
|
|
||||||
let average: Double?
|
|
||||||
let peak: Double?
|
|
||||||
|
|
||||||
private var reference: Double { max(1, Double(max(inUse ?? 0, allocated ?? 0))) }
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
HStack(spacing: 10) {
|
|
||||||
VStack(spacing: 5) {
|
|
||||||
memoryRow("gpu.driverMemory", bytes: inUse, color: Color("MetricMemory"))
|
|
||||||
memoryRow("gpu.allocatedMemory", bytes: allocated, color: Color("MetricNetwork"))
|
|
||||||
}.frame(maxWidth: .infinity)
|
|
||||||
Divider()
|
|
||||||
HStack(spacing: 6) {
|
|
||||||
MetricRingGauge(title: "gpu.recentAverage", value: average, color: Color("MetricCPU"))
|
|
||||||
MetricRingGauge(title: "gpu.peak", value: peak, color: Color("MetricGPU"))
|
|
||||||
}.frame(maxWidth: .infinity)
|
|
||||||
}.frame(height: 46)
|
|
||||||
}
|
|
||||||
|
|
||||||
private func memoryRow(_ title: LocalizedStringKey, bytes: UInt64?, color: Color) -> some View {
|
|
||||||
VStack(spacing: 3) {
|
|
||||||
HStack(spacing: 4) {
|
|
||||||
Text(title).foregroundStyle(.secondary)
|
|
||||||
Spacer(minLength: 0)
|
|
||||||
MetricText(value: MetricFormat.bytes(bytes)).font(PanelStyle.value)
|
|
||||||
}.font(PanelStyle.label).lineLimit(1)
|
|
||||||
MetricProgressBar(value: bytes.map { Double($0) / reference } ?? 0, color: color)
|
|
||||||
.frame(height: 3)
|
|
||||||
.accessibilityHidden(true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -35,7 +35,7 @@ extension MenuPanelView {
|
|||||||
CardSeparator()
|
CardSeparator()
|
||||||
if let cpu = snapshot.cpu {
|
if let cpu = snapshot.cpu {
|
||||||
CPUCoreGrid(
|
CPUCoreGrid(
|
||||||
values: cpu.cores, kinds: CPUCoreTopology.cores, interval: chartInterval,
|
values: cpu.cores, kinds: CPUCoreTopology.cores,
|
||||||
availableWidth: cardContentWidth)
|
availableWidth: cardContentWidth)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ struct MenuPanelView: View {
|
|||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
VStack(spacing: PanelStyle.gap) {
|
VStack(spacing: PanelStyle.gap) {
|
||||||
if PanelResourceAudit.omitted != "header" { header }
|
header
|
||||||
if presentation.page == .overview {
|
if presentation.page == .overview {
|
||||||
if PanelLayout.needsResourceScroll(size: panelSize, heights: cardHeights) {
|
if PanelLayout.needsResourceScroll(size: panelSize, heights: cardHeights) {
|
||||||
ScrollView { resourceColumns }
|
ScrollView { resourceColumns }
|
||||||
@@ -59,8 +59,8 @@ struct MenuPanelView: View {
|
|||||||
resourceColumns
|
resourceColumns
|
||||||
.frame(maxHeight: .infinity, alignment: .top)
|
.frame(maxHeight: .infinity, alignment: .top)
|
||||||
}
|
}
|
||||||
} else if presentation.isOpen && PanelResourceAudit.omitted != "processes" {
|
} else if presentation.isOpen {
|
||||||
PanelProcessSection(metrics: metrics, state: processState, wide: panelSize.width >= 800)
|
PanelProcessSection(metrics: metrics, state: processState)
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||||
}
|
}
|
||||||
footer
|
footer
|
||||||
@@ -111,9 +111,6 @@ struct MenuPanelView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ViewBuilder private func resourceCard(_ card: PanelCard) -> some View {
|
@ViewBuilder private func resourceCard(_ card: PanelCard) -> some View {
|
||||||
if PanelResourceAudit.omitted == "resources" {
|
|
||||||
Color.clear
|
|
||||||
} else {
|
|
||||||
switch card {
|
switch card {
|
||||||
case .cpu: cpuCard
|
case .cpu: cpuCard
|
||||||
case .battery: batteryCard
|
case .battery: batteryCard
|
||||||
@@ -123,7 +120,6 @@ struct MenuPanelView: View {
|
|||||||
case .network: networkCard
|
case .network: networkCard
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private var brand: some View {
|
private var brand: some View {
|
||||||
HStack(spacing: 6) {
|
HStack(spacing: 6) {
|
||||||
@@ -254,6 +250,5 @@ private struct PanelControlButtonBody<Content: View>: View {
|
|||||||
private struct PanelProcessSection: View {
|
private struct PanelProcessSection: View {
|
||||||
let metrics: MetricsStore
|
let metrics: MetricsStore
|
||||||
let state: ProcessTableState
|
let state: ProcessTableState
|
||||||
let wide: Bool
|
var body: some View { ProcessTableView(snapshot: metrics.processSnapshot, energy: metrics.energy, state: state) }
|
||||||
var body: some View { ProcessTableView(snapshot: metrics.processSnapshot, energy: metrics.energy, state: state, wide: wide) }
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ import SwiftUI
|
|||||||
if cell.toolTip != tooltip { cell.toolTip = tooltip }
|
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 = process.path.flatMap { ProcessIconCache.shared.image(for: $0) }
|
||||||
let desired = image ?? Self.placeholder
|
let desired = image ?? Self.placeholder
|
||||||
if cell.imageView?.image !== desired { cell.imageView?.image = desired }
|
if cell.imageView?.image !== desired { cell.imageView?.image = desired }
|
||||||
} else if key == "threads" {
|
} else if key == "threads" {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
/// Shared by the dashboard and the text-only audit so network work is comparable.
|
/// The mounted overview owns public-IP work and cancels it when demand ends.
|
||||||
struct PanelPublicIPRefresh: ViewModifier {
|
struct PanelPublicIPRefresh: ViewModifier {
|
||||||
let metrics: MetricsStore
|
let metrics: MetricsStore
|
||||||
@Binding var address: String?
|
@Binding var address: String?
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import AppKit
|
|||||||
@MainActor enum PanelResourceAudit {
|
@MainActor enum PanelResourceAudit {
|
||||||
#if DEBUG || KYMO_AUDIT
|
#if DEBUG || KYMO_AUDIT
|
||||||
static let enabled = ProcessInfo.processInfo.environment["KYMO_RESOURCE_AUDIT"] == "1"
|
static let enabled = ProcessInfo.processInfo.environment["KYMO_RESOURCE_AUDIT"] == "1"
|
||||||
static let omitted = enabled ? ProcessInfo.processInfo.environment["KYMO_AUDIT_OMIT"] ?? "" : ""
|
|
||||||
|
|
||||||
static func run(controller: MenuPanelController, metrics: MetricsStore) {
|
static func run(controller: MenuPanelController, metrics: MetricsStore) {
|
||||||
guard enabled else { return }
|
guard enabled else { return }
|
||||||
@@ -30,8 +29,7 @@ import AppKit
|
|||||||
windowNumber: controller.panel.isVisible ? controller.panel.windowNumber : nil,
|
windowNumber: controller.panel.isVisible ? controller.panel.windowNumber : nil,
|
||||||
hoveredPlots: views.filter { $0.input?.hoveredIndex != nil }.count, nativePlots: views.count,
|
hoveredPlots: views.filter { $0.input?.hoveredIndex != nil }.count, nativePlots: views.count,
|
||||||
pointerInsidePanel: controller.panel.isVisible && controller.panel.frame.contains(NSEvent.mouseLocation),
|
pointerInsidePanel: controller.panel.isVisible && controller.panel.frame.contains(NSEvent.mouseLocation),
|
||||||
plotBounds: views.map { [Double($0.bounds.width), Double($0.bounds.height)] },
|
plotBounds: views.map { [Double($0.bounds.width), Double($0.bounds.height)] })
|
||||||
animatedPlots: 0)
|
|
||||||
if event == "open1.10", ProcessInfo.processInfo.environment["KYMO_AUDIT_CAPTURE"] == "1",
|
if event == "open1.10", ProcessInfo.processInfo.environment["KYMO_AUDIT_CAPTURE"] == "1",
|
||||||
let content = controller.panel.contentView { capture(content) }
|
let content = controller.panel.contentView { capture(content) }
|
||||||
}
|
}
|
||||||
@@ -125,8 +123,6 @@ import AppKit
|
|||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
static let enabled = false
|
|
||||||
static let omitted = ""
|
|
||||||
static func run(controller: MenuPanelController, metrics: MetricsStore) {}
|
static func run(controller: MenuPanelController, metrics: MetricsStore) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ struct ProcessTableView: View {
|
|||||||
let snapshot: ProcessSnapshot?
|
let snapshot: ProcessSnapshot?
|
||||||
let energy: ProcessEnergySnapshot?
|
let energy: ProcessEnergySnapshot?
|
||||||
@Bindable var state: ProcessTableState
|
@Bindable var state: ProcessTableState
|
||||||
var wide: Bool = true
|
|
||||||
@Environment(\.locale) private var locale
|
@Environment(\.locale) private var locale
|
||||||
@State private var hovering = false
|
@State private var hovering = false
|
||||||
@State private var rows: [ProcessMetrics] = []
|
@State private var rows: [ProcessMetrics] = []
|
||||||
@@ -30,7 +29,7 @@ struct ProcessTableView: View {
|
|||||||
HStack(spacing: 10) {
|
HStack(spacing: 10) {
|
||||||
processTitle
|
processTitle
|
||||||
Spacer(minLength: 0)
|
Spacer(minLength: 0)
|
||||||
searchField.frame(maxWidth: wide ? 220 : 180)
|
searchField.frame(maxWidth: 180)
|
||||||
}
|
}
|
||||||
HStack(spacing: 8) {
|
HStack(spacing: 8) {
|
||||||
Text("panel.processScope").lineLimit(2)
|
Text("panel.processScope").lineLimit(2)
|
||||||
|
|||||||
@@ -1,165 +0,0 @@
|
|||||||
import AppKit
|
|
||||||
import SwiftUI
|
|
||||||
|
|
||||||
#if DEBUG || KYMO_AUDIT
|
|
||||||
/// An opt-in comparison frontend. Sampling, history, IPC and public-IP policy remain enabled.
|
|
||||||
struct TextMonitoringAuditView: View {
|
|
||||||
let metrics: MetricsStore
|
|
||||||
let appearance: AppearancePreferences
|
|
||||||
@State private var publicAddress: String?
|
|
||||||
var body: some View {
|
|
||||||
TextReportHost(snapshot: metrics.snapshot, processes: metrics.processSnapshot, energy: metrics.energy,
|
|
||||||
historyPoints: metrics.history.samples.count, publicAddress: publicAddress, appearance: appearance.appearance)
|
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
||||||
.modifier(PanelPublicIPRefresh(metrics: metrics, address: $publicAddress))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private struct TextReportHost: NSViewRepresentable {
|
|
||||||
let snapshot: MetricsSnapshot
|
|
||||||
let processes: ProcessSnapshot?
|
|
||||||
let energy: ProcessEnergySnapshot?
|
|
||||||
let historyPoints: Int
|
|
||||||
let publicAddress: String?
|
|
||||||
let appearance: AppAppearance
|
|
||||||
func makeCoordinator() -> Coordinator { Coordinator() }
|
|
||||||
func makeNSView(context: Context) -> ReportScrollView {
|
|
||||||
let scroll = ReportScrollView()
|
|
||||||
scroll.hasVerticalScroller = true
|
|
||||||
scroll.hasHorizontalScroller = true
|
|
||||||
scroll.autohidesScrollers = false
|
|
||||||
scroll.scrollerStyle = .legacy
|
|
||||||
let table = NSTableView(frame: NSRect(x: 0, y: 0, width: 3200, height: 800))
|
|
||||||
table.headerView = nil
|
|
||||||
table.style = .plain
|
|
||||||
table.rowHeight = 15
|
|
||||||
table.intercellSpacing = .zero
|
|
||||||
table.selectionHighlightStyle = .none
|
|
||||||
table.backgroundColor = .windowBackgroundColor
|
|
||||||
table.columnAutoresizingStyle = .noColumnAutoresizing
|
|
||||||
let column = NSTableColumn(identifier: NSUserInterfaceItemIdentifier("text"))
|
|
||||||
column.width = 3200
|
|
||||||
table.addTableColumn(column)
|
|
||||||
table.delegate = context.coordinator
|
|
||||||
table.dataSource = context.coordinator
|
|
||||||
scroll.documentView = table
|
|
||||||
return scroll
|
|
||||||
}
|
|
||||||
func updateNSView(_ scroll: ReportScrollView, context: Context) {
|
|
||||||
scroll.choice = appearance
|
|
||||||
guard let table = scroll.documentView as? NSTableView else { return }
|
|
||||||
let c = context.coordinator
|
|
||||||
if c.processDate != processes?.date {
|
|
||||||
c.processDate = processes?.date
|
|
||||||
c.rows = ProcessTableProjection.rows(processes?.rows ?? [], query: "", sorting: [ProcessSort(key: .cpu)], order: [])
|
|
||||||
}
|
|
||||||
let heading = Self.resourceText(snapshot) + "\nHistory points retained: \(historyPoints)\nPublic IP: \(publicAddress ?? "--")\n\n" + Self.energyText(energy)
|
|
||||||
+ "\nProcesses: \(processes?.readable ?? 0)/\(processes?.enumerated ?? 0), failed=\(processes?.failed ?? false)\nPID\tCPU %\tFootprint bytes\tThreads\tRestricted\tName\tPath"
|
|
||||||
c.lines = heading.components(separatedBy: "\n")
|
|
||||||
let origin = scroll.contentView.bounds.origin
|
|
||||||
let oldCount = table.numberOfRows
|
|
||||||
let newCount = c.lines.count + c.rows.count
|
|
||||||
if newCount != oldCount {
|
|
||||||
table.beginUpdates()
|
|
||||||
if newCount > oldCount { table.insertRows(at: IndexSet(integersIn: oldCount..<newCount), withAnimation: []) }
|
|
||||||
else { table.removeRows(at: IndexSet(integersIn: newCount..<oldCount), withAnimation: []) }
|
|
||||||
table.endUpdates()
|
|
||||||
}
|
|
||||||
let visible = table.rows(in: table.visibleRect)
|
|
||||||
if visible.location != NSNotFound, visible.length > 0 {
|
|
||||||
for row in visible.location..<min(newCount, visible.location + visible.length) {
|
|
||||||
if let cell = table.view(atColumn: 0, row: row, makeIfNecessary: false) as? NSTableCellView {
|
|
||||||
c.update(cell, row: row)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
scroll.contentView.scroll(to: origin)
|
|
||||||
scroll.reflectScrolledClipView(scroll.contentView)
|
|
||||||
SamplingDiagnostics.recordTextPresentation(processes: c.rows.count, cells: c.createdCells)
|
|
||||||
}
|
|
||||||
/// Fixed-height native text rows format only visible records. All sampled rows remain scrollable.
|
|
||||||
final class Coordinator: NSObject, NSTableViewDataSource, NSTableViewDelegate {
|
|
||||||
var processDate: Date?
|
|
||||||
var rows: [ProcessMetrics] = []
|
|
||||||
var lines: [String] = []
|
|
||||||
var createdCells = 0
|
|
||||||
func numberOfRows(in tableView: NSTableView) -> Int { lines.count + rows.count }
|
|
||||||
func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
|
|
||||||
guard row >= 0, row < lines.count + rows.count else { return nil }
|
|
||||||
let key = NSUserInterfaceItemIdentifier("text.cell")
|
|
||||||
let cell: NSTableCellView
|
|
||||||
if let reused = tableView.makeView(withIdentifier: key, owner: nil) as? NSTableCellView { cell = reused }
|
|
||||||
else {
|
|
||||||
cell = NSTableCellView()
|
|
||||||
cell.identifier = key
|
|
||||||
let field = NSTextField(labelWithString: "")
|
|
||||||
field.font = .monospacedSystemFont(ofSize: 11, weight: .regular)
|
|
||||||
field.lineBreakMode = .byClipping
|
|
||||||
field.translatesAutoresizingMaskIntoConstraints = false
|
|
||||||
cell.addSubview(field)
|
|
||||||
cell.textField = field
|
|
||||||
NSLayoutConstraint.activate([
|
|
||||||
field.leadingAnchor.constraint(equalTo: cell.leadingAnchor, constant: 8),
|
|
||||||
field.trailingAnchor.constraint(equalTo: cell.trailingAnchor, constant: -4),
|
|
||||||
field.topAnchor.constraint(equalTo: cell.topAnchor), field.bottomAnchor.constraint(equalTo: cell.bottomAnchor)
|
|
||||||
])
|
|
||||||
createdCells += 1
|
|
||||||
}
|
|
||||||
update(cell, row: row)
|
|
||||||
return cell
|
|
||||||
}
|
|
||||||
func update(_ cell: NSTableCellView, row: Int) {
|
|
||||||
guard row >= 0, row < lines.count + rows.count else { return }
|
|
||||||
let value = row < lines.count ? lines[row] : TextReportHost.processLine(rows[row - lines.count])
|
|
||||||
if cell.textField?.stringValue != value { cell.textField?.stringValue = value }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
final class ReportScrollView: NSScrollView {
|
|
||||||
var choice = AppAppearance.system { didSet { apply() } }
|
|
||||||
override func viewDidMoveToWindow() { super.viewDidMoveToWindow(); apply() }
|
|
||||||
private func apply() {
|
|
||||||
let target = choice.windowAppearance
|
|
||||||
if window?.appearance?.name != target?.name { window?.appearance = target }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private static func number(_ value: Double?) -> String { value.map { String(format: "%.3f", $0) } ?? "--" }
|
|
||||||
private static func bytes(_ value: UInt64?) -> String { value.map(String.init) ?? "--" }
|
|
||||||
private static func resourceText(_ s: MetricsSnapshot) -> String {
|
|
||||||
var lines = ["Kymo — plain text comparison (no charts, icons or animation)", "Resource timestamp: \(s.date.timeIntervalSince1970)"]
|
|
||||||
lines += ["CPU total/user/system fraction: \(number(s.cpu?.usage)) / \(number(s.cpu?.user)) / \(number(s.cpu?.system))",
|
|
||||||
"CPU cores: \(s.cpu?.cores.map { number($0) }.joined(separator: " ") ?? "--")",
|
|
||||||
"CPU/GPU temperature °C: \(number(s.cpuTemperature)) / \(number(s.gpuTemperature))",
|
|
||||||
"Fans RPM: \(s.fans?.map { "\($0.id)=\(number($0.rpm))" }.joined(separator: " ") ?? "--")",
|
|
||||||
"GPU usage/renderer/tiler/cores: \(number(s.gpu?.usage)) / \(number(s.gpu?.renderer)) / \(number(s.gpu?.tiler)) / \(s.gpu?.coreCount.map(String.init) ?? "--")",
|
|
||||||
"GPU in-use/allocated bytes: \(bytes(s.gpu?.inUseMemory)) / \(bytes(s.gpu?.allocatedMemory))",
|
|
||||||
"Memory total/used/available/cached/wired/compressed/swap bytes: \(bytes(s.memory?.total)) / \(bytes(s.memory?.used)) / \(bytes(s.memory?.available)) / \(bytes(s.memory?.cached)) / \(bytes(s.memory?.wired)) / \(bytes(s.memory?.compressed)) / \(bytes(s.memory?.swapUsed))",
|
|
||||||
"Memory pressure: \(s.memory?.pressure.map(String.init) ?? "--")",
|
|
||||||
"Disk total/available bytes: \(bytes(s.disk?.total)) / \(bytes(s.disk?.available))",
|
|
||||||
"Disk IO read/write B/s: \(number(s.diskIO?.read)) / \(number(s.diskIO?.written))",
|
|
||||||
"SMART remaining/hour: \(number(s.diskHealth?.remainingLife)) / \(bytes(s.diskHealth?.powerOnHours))",
|
|
||||||
"Battery charge/health/power W/cycles: \(number(s.battery?.charge)) / \(number(s.battery?.health)) / \(number(s.battery?.power)) / \(s.battery?.cycles.map(String.init) ?? "--")",
|
|
||||||
"Battery charging/external/minutes/state: \(String(describing: s.battery?.charging)) / \(String(describing: s.battery?.externalPower)) / \(s.battery?.minutesRemaining.map(String.init) ?? "--") / \(s.batteryState)",
|
|
||||||
"Uptime/load: \(number(s.uptime)) / \(s.load.map { number($0) }.joined(separator: " "))",
|
|
||||||
"Network path/default interface: \(String(describing: s.networkPath)) / \(s.defaultNetworkInterface ?? "--")"]
|
|
||||||
for i in s.network ?? [] { lines.append("\(i.name) active=\(i.active) received/sent=\(i.received)/\(i.sent) B, down/up=\(number(i.download))/\(number(i.upload)) B/s, addresses=\(i.addresses.joined(separator: ","))") }
|
|
||||||
for v in s.volumes ?? [] { lines.append("Volume \(v.name) \(v.path): total/available \(v.capacity.total)/\(v.capacity.available) B") }
|
|
||||||
return lines.joined(separator: "\n")
|
|
||||||
}
|
|
||||||
private static func energyText(_ energy: ProcessEnergySnapshot?) -> String {
|
|
||||||
guard let energy else { return "CPU energy: waiting\n" }
|
|
||||||
return "CPU energy: \(energy.state), measured/readable/enumerated=\(energy.measured)/\(energy.readable)/\(energy.candidates)\n" + energy.rows.map { "\($0.id.pid) \($0.process.name): \($0.formattedPower), interval \(number($0.seconds)) s" }.joined(separator: "\n") + "\n"
|
|
||||||
}
|
|
||||||
private static func processLine(_ process: ProcessMetrics) -> String {
|
|
||||||
"\(process.id.pid)\t\(number(process.cpu.map { $0 * 100 }))\t\(bytes(process.footprintBytes))\t\(process.threads.map(String.init) ?? "--")\t\(process.restricted)\t\(process.name)\t\(process.path ?? "--")"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
/// The diagnostic renderer is excluded from distribution builds.
|
|
||||||
struct TextMonitoringAuditView: View {
|
|
||||||
let metrics: MetricsStore
|
|
||||||
let appearance: AppearancePreferences
|
|
||||||
var body: some View { EmptyView() }
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
# 业务特性
|
|
||||||
|
|
||||||
模块职责统一见[架构](../../docs/architecture.md)。
|
|
||||||
@@ -70,75 +70,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"cpu.load.help": {
|
|
||||||
"extractionState": "manual",
|
|
||||||
"localizations": {
|
|
||||||
"en": {
|
|
||||||
"stringUnit": {
|
|
||||||
"state": "translated",
|
|
||||||
"value": "Average system load over the last minute. The bar is full at the number of logical CPU cores; load can exceed that number."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"zh-Hans": {
|
|
||||||
"stringUnit": {
|
|
||||||
"state": "translated",
|
|
||||||
"value": "最近 1 分钟的系统平均负载。进度条满格对应逻辑核心数,负载可能超过该数值。"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"zh-Hant": {
|
|
||||||
"stringUnit": {
|
|
||||||
"state": "translated",
|
|
||||||
"value": "最近 1 分鐘的系統平均負載。進度條滿格對應邏輯核心數,負載可能超過該數值。"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"cpu.load.oneMinute": {
|
|
||||||
"extractionState": "manual",
|
|
||||||
"localizations": {
|
|
||||||
"en": {
|
|
||||||
"stringUnit": {
|
|
||||||
"state": "translated",
|
|
||||||
"value": "Load · 1 min"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"zh-Hans": {
|
|
||||||
"stringUnit": {
|
|
||||||
"state": "translated",
|
|
||||||
"value": "负载 · 1 分钟"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"zh-Hant": {
|
|
||||||
"stringUnit": {
|
|
||||||
"state": "translated",
|
|
||||||
"value": "負載 · 1 分鐘"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"cpu.temperature.help": {
|
|
||||||
"extractionState": "manual",
|
|
||||||
"localizations": {
|
|
||||||
"en": {
|
|
||||||
"stringUnit": {
|
|
||||||
"state": "translated",
|
|
||||||
"value": "Highest valid sensor reading in the CPU core area; warning at 90°C."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"zh-Hans": {
|
|
||||||
"stringUnit": {
|
|
||||||
"state": "translated",
|
|
||||||
"value": "CPU 核心区域的最高有效传感器读数;达到 90°C 时提示。"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"zh-Hant": {
|
|
||||||
"stringUnit": {
|
|
||||||
"state": "translated",
|
|
||||||
"value": "CPU 核心區域的最高有效感測器讀數;達到 90°C 時提示。"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"cpu.temperature.high": {
|
"cpu.temperature.high": {
|
||||||
"extractionState": "manual",
|
"extractionState": "manual",
|
||||||
"localizations": {
|
"localizations": {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,29 +1,6 @@
|
|||||||
{
|
{
|
||||||
"sourceLanguage" : "en",
|
"sourceLanguage" : "en",
|
||||||
"strings" : {
|
"strings" : {
|
||||||
"clearSearch" : {
|
|
||||||
"extractionState" : "manual",
|
|
||||||
"localizations" : {
|
|
||||||
"en" : {
|
|
||||||
"stringUnit" : {
|
|
||||||
"state" : "translated",
|
|
||||||
"value" : "Clear Search"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"zh-Hans" : {
|
|
||||||
"stringUnit" : {
|
|
||||||
"state" : "translated",
|
|
||||||
"value" : "清空搜索"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"zh-Hant" : {
|
|
||||||
"stringUnit" : {
|
|
||||||
"state" : "translated",
|
|
||||||
"value" : "清除搜尋"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"copyName" : {
|
"copyName" : {
|
||||||
"extractionState" : "stale",
|
"extractionState" : "stale",
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
# 本地化资源
|
|
||||||
|
|
||||||
模块职责统一见[架构](../../docs/architecture.md)。
|
|
||||||
字符串维护与检查见[开发指南](../../docs/development.md)。
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
import SwiftUI
|
|
||||||
|
|
||||||
struct MiniTrendChart: View {
|
|
||||||
let values: [Double?]
|
|
||||||
let color: Color
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
Canvas { context, size in
|
|
||||||
let values = Array(values.suffix(MetricHistory.capacity))
|
|
||||||
guard values.count > 1 else { return }
|
|
||||||
var path = Path()
|
|
||||||
var run: [CGPoint] = []
|
|
||||||
func appendRun() {
|
|
||||||
guard let first = run.first, let last = run.last else { return }
|
|
||||||
path.move(to: first)
|
|
||||||
if run.count == 1 { path.addLine(to: CGPoint(x: first.x + 0.1, y: first.y)) }
|
|
||||||
for index in 1..<run.count {
|
|
||||||
let previous = run[index - 1]
|
|
||||||
let current = run[index]
|
|
||||||
let midpoint = CGPoint(x: (previous.x + current.x) / 2, y: (previous.y + current.y) / 2)
|
|
||||||
path.addQuadCurve(to: midpoint, control: previous)
|
|
||||||
}
|
|
||||||
path.addQuadCurve(to: last, control: last)
|
|
||||||
run.removeAll(keepingCapacity: true)
|
|
||||||
}
|
|
||||||
for (index, value) in values.enumerated() {
|
|
||||||
guard let value, value.isFinite else { continue }
|
|
||||||
let x = size.width * CGFloat(index + MetricHistory.capacity - values.count) / CGFloat(MetricHistory.capacity - 1)
|
|
||||||
run.append(CGPoint(x: x, y: 2 + (size.height - 4) * (1 - min(1, max(0, value)))))
|
|
||||||
}
|
|
||||||
appendRun()
|
|
||||||
context.stroke(path, with: .color(color.opacity(0.85)), style: StrokeStyle(lineWidth: 1.8, lineCap: .round, lineJoin: .round))
|
|
||||||
}
|
|
||||||
.accessibilityHidden(true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
import Foundation
|
|
||||||
import CoreGraphics
|
|
||||||
|
|
||||||
|
|
||||||
/// Screen coordinates: prefer the parent's right side, otherwise use its left.
|
|
||||||
nonisolated enum DetailPlacement {
|
|
||||||
static func frame(anchor: CGRect, parent: CGRect, content: CGSize, visible: CGRect) -> CGRect {
|
|
||||||
let gap: CGFloat = 4
|
|
||||||
let width = min(content.width, visible.width)
|
|
||||||
let height = min(content.height, visible.height)
|
|
||||||
let right = parent.maxX + gap
|
|
||||||
let left = parent.minX - gap - width
|
|
||||||
let candidate = right + width <= visible.maxX ? right : left
|
|
||||||
let x = max(visible.minX, min(candidate, visible.maxX - width))
|
|
||||||
let y = max(visible.minY, min(anchor.maxY - height, visible.maxY - height))
|
|
||||||
return CGRect(x: x, y: y, width: width, height: height)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,113 +0,0 @@
|
|||||||
import SwiftUI
|
|
||||||
import AppKit
|
|
||||||
|
|
||||||
/// A non-activating child window: outside the parent layout, below no other app.
|
|
||||||
struct HoverDetailPresenter<Detail: View>: NSViewRepresentable {
|
|
||||||
@Environment(\.locale) private var locale
|
|
||||||
let isPresented: Bool
|
|
||||||
let detail: Detail
|
|
||||||
let onHover: (Bool) -> Void
|
|
||||||
let onDismiss: () -> Void
|
|
||||||
|
|
||||||
func makeNSView(context: Context) -> AnchorView { AnchorView() }
|
|
||||||
func updateNSView(_ view: AnchorView, context: Context) {
|
|
||||||
view.configure(presented: isPresented, detail: AnyView(detail.environment(\.locale, locale)), onHover: onHover, onDismiss: onDismiss)
|
|
||||||
}
|
|
||||||
static func dismantleNSView(_ view: AnchorView, coordinator: ()) { view.detach() }
|
|
||||||
|
|
||||||
final class AnchorView: NSView {
|
|
||||||
override func hitTest(_ point: NSPoint) -> NSView? { nil }
|
|
||||||
private var panel: DetailPanel?
|
|
||||||
private var host: NSHostingView<AnyView>?
|
|
||||||
private var tokens: [NSObjectProtocol] = []
|
|
||||||
private var presented = false
|
|
||||||
private var detail = AnyView(EmptyView())
|
|
||||||
private var onHover: (Bool) -> Void = { _ in }
|
|
||||||
private var onDismiss: () -> Void = {}
|
|
||||||
|
|
||||||
func configure(presented: Bool, detail: AnyView,
|
|
||||||
onHover: @escaping (Bool) -> Void, onDismiss: @escaping () -> Void) {
|
|
||||||
self.presented = presented
|
|
||||||
self.detail = detail
|
|
||||||
self.onHover = onHover
|
|
||||||
self.onDismiss = onDismiss
|
|
||||||
refresh()
|
|
||||||
}
|
|
||||||
|
|
||||||
override func viewDidMoveToWindow() {
|
|
||||||
super.viewDidMoveToWindow()
|
|
||||||
detach()
|
|
||||||
guard let window else { return }
|
|
||||||
for name in [NSWindow.willCloseNotification, NSWindow.didChangeOcclusionStateNotification] {
|
|
||||||
tokens.append(NotificationCenter.default.addObserver(forName: name, object: window, queue: .main) { [weak self, weak window] notification in
|
|
||||||
MainActor.assumeIsolated {
|
|
||||||
guard notification.name == NSWindow.willCloseNotification || window?.occlusionState.contains(.visible) != true else { return }
|
|
||||||
self?.hide()
|
|
||||||
let dismiss = self?.onDismiss
|
|
||||||
DispatchQueue.main.async { dismiss?() }
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
refresh()
|
|
||||||
}
|
|
||||||
|
|
||||||
func detach() {
|
|
||||||
hide()
|
|
||||||
for token in tokens { NotificationCenter.default.removeObserver(token) }
|
|
||||||
tokens.removeAll()
|
|
||||||
}
|
|
||||||
|
|
||||||
private func refresh() {
|
|
||||||
guard presented, let parent = window, parent.isVisible, let screen = parent.screen else { hide(); return }
|
|
||||||
let content = AnyView(detail
|
|
||||||
.font(.caption)
|
|
||||||
.padding(12)
|
|
||||||
.frame(width: 280)
|
|
||||||
.fixedSize(horizontal: false, vertical: true)
|
|
||||||
.background(Color("PanelCard"), in: .rect(cornerRadius: 12))
|
|
||||||
.overlay(RoundedRectangle(cornerRadius: 12).strokeBorder(.primary.opacity(0.14)))
|
|
||||||
.onHover { [weak self] inside in self?.onHover(inside) })
|
|
||||||
if panel == nil {
|
|
||||||
let panel = DetailPanel(contentRect: .zero, styleMask: [.borderless, .nonactivatingPanel], backing: .buffered, defer: false)
|
|
||||||
panel.isReleasedWhenClosed = false
|
|
||||||
panel.isOpaque = false
|
|
||||||
panel.backgroundColor = .clear
|
|
||||||
panel.hasShadow = false
|
|
||||||
panel.animationBehavior = .none
|
|
||||||
panel.hidesOnDeactivate = false
|
|
||||||
panel.level = parent.level
|
|
||||||
let host = NSHostingView(rootView: content)
|
|
||||||
panel.contentView = host
|
|
||||||
self.panel = panel
|
|
||||||
self.host = host
|
|
||||||
parent.addChildWindow(panel, ordered: .above)
|
|
||||||
}
|
|
||||||
guard let panel, let host else { return }
|
|
||||||
host.rootView = content
|
|
||||||
panel.appearance = parent.appearance
|
|
||||||
let row = parent.convertToScreen(convert(bounds, to: nil))
|
|
||||||
let size = host.fittingSize
|
|
||||||
panel.setFrame(DetailPlacement.frame(anchor: row, parent: parent.frame,
|
|
||||||
content: CGSize(width: 280, height: max(40, size.height)),
|
|
||||||
visible: screen.visibleFrame), display: true)
|
|
||||||
panel.orderFront(nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
private func hide() {
|
|
||||||
guard let panel else { return }
|
|
||||||
panel.parent?.removeChildWindow(panel)
|
|
||||||
panel.orderOut(nil)
|
|
||||||
panel.contentView = nil
|
|
||||||
panel.close()
|
|
||||||
host = nil
|
|
||||||
self.panel = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
deinit { for token in tokens { NotificationCenter.default.removeObserver(token) } }
|
|
||||||
}
|
|
||||||
|
|
||||||
final class DetailPanel: NSPanel {
|
|
||||||
override var canBecomeKey: Bool { false }
|
|
||||||
override var canBecomeMain: Bool { false }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
import SwiftUI
|
|
||||||
|
|
||||||
/// A bounded percentage gauge; missing data keeps an empty track and an explicit -- label.
|
|
||||||
struct MetricRingGauge: View {
|
|
||||||
let title: LocalizedStringKey
|
|
||||||
let value: Double?
|
|
||||||
let color: Color
|
|
||||||
|
|
||||||
private var fraction: Double { value.flatMap { $0.isFinite ? min(1, max(0, $0)) : nil } ?? 0 }
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
VStack(spacing: 3) {
|
|
||||||
ZStack {
|
|
||||||
NativeMetricRing(value: fraction, color: color, lineWidth: 3, trackOpacity: 0.17, inset: 2)
|
|
||||||
MetricText(value: MetricFormat.percent(value)).font(.system(size: 8, weight: .semibold))
|
|
||||||
.lineLimit(1).minimumScaleFactor(0.6).frame(width: 18, height: 12)
|
|
||||||
}.frame(width: 28, height: 28).accessibilityHidden(true)
|
|
||||||
Text(title).font(.system(size: 8)).foregroundStyle(.secondary)
|
|
||||||
.lineLimit(1).minimumScaleFactor(0.7)
|
|
||||||
}
|
|
||||||
.frame(maxWidth: .infinity)
|
|
||||||
.accessibilityElement(children: .ignore)
|
|
||||||
.accessibilityLabel(Text(title))
|
|
||||||
.accessibilityValue(Text(verbatim: MetricFormat.percent(value)))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
import SwiftUI
|
|
||||||
|
|
||||||
struct MetricRow<Detail: View>: View {
|
|
||||||
let title: LocalizedStringKey
|
|
||||||
let symbol: String
|
|
||||||
let value: String
|
|
||||||
let usage: Double?
|
|
||||||
let history: [Double?]
|
|
||||||
let accent: Color
|
|
||||||
@ViewBuilder let detail: () -> Detail
|
|
||||||
@State private var visible = false
|
|
||||||
@State private var rowHovered = false
|
|
||||||
@State private var detailHovered = false
|
|
||||||
@State private var expanded = false
|
|
||||||
private var inside: Bool { rowHovered || detailHovered }
|
|
||||||
|
|
||||||
private var color: Color {
|
|
||||||
guard let usage else { return .secondary }
|
|
||||||
return usage > 0.95 ? .red : usage >= 0.8 ? .orange : accent
|
|
||||||
}
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
Button { expanded.toggle() } label: {
|
|
||||||
HStack(spacing: 10) {
|
|
||||||
Image(systemName: symbol)
|
|
||||||
.font(.system(size: 13, weight: .medium))
|
|
||||||
.foregroundStyle(color)
|
|
||||||
.frame(width: 20)
|
|
||||||
Text(title).font(.system(size: 13, weight: .medium))
|
|
||||||
.frame(width: 52, alignment: .leading)
|
|
||||||
MiniTrendChart(values: history, color: color).frame(height: 24)
|
|
||||||
Text(verbatim: value)
|
|
||||||
.font(.system(size: 13, weight: .semibold, design: .rounded))
|
|
||||||
.monospacedDigit()
|
|
||||||
.frame(width: 46, alignment: .trailing)
|
|
||||||
}
|
|
||||||
.contentShape(Rectangle())
|
|
||||||
}
|
|
||||||
.buttonStyle(.plain)
|
|
||||||
.accessibilityLabel(Text(title))
|
|
||||||
.accessibilityValue(Text(verbatim: value))
|
|
||||||
.accessibilityHint(expanded ? Text("detail.expanded") : Text("detail.collapsed"))
|
|
||||||
.padding(10)
|
|
||||||
.background(expanded ? Color.primary.opacity(0.035) : .clear, in: .rect(cornerRadius: 14))
|
|
||||||
.background(HoverDetailPresenter(isPresented: expanded && visible, detail: detail(),
|
|
||||||
onHover: { detailHovered = $0 },
|
|
||||||
onDismiss: { expanded = false; detailHovered = false }))
|
|
||||||
.onHover { rowHovered = $0 }
|
|
||||||
.task(id: inside) {
|
|
||||||
do { try await Task.sleep(for: .milliseconds(inside ? 150 : 120)) }
|
|
||||||
catch { return }
|
|
||||||
guard !Task.isCancelled else { return }
|
|
||||||
expanded = inside
|
|
||||||
}
|
|
||||||
.onAppear { visible = true }
|
|
||||||
.onDisappear { visible = false; rowHovered = false; detailHovered = false; expanded = false }
|
|
||||||
.transaction { $0.animation = nil; $0.disablesAnimations = true }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,91 +0,0 @@
|
|||||||
import AppKit
|
|
||||||
import SwiftUI
|
|
||||||
|
|
||||||
/// Static arc geometry; sampling publishes the final value directly.
|
|
||||||
struct NativeMetricRing: NSViewRepresentable {
|
|
||||||
let value: Double
|
|
||||||
let color: Color
|
|
||||||
let lineWidth: CGFloat
|
|
||||||
let trackOpacity: Double
|
|
||||||
let inset: CGFloat
|
|
||||||
|
|
||||||
func sizeThatFits(_ proposal: ProposedViewSize, nsView: RingView, context: Context) -> CGSize? {
|
|
||||||
CGSize(width: proposal.width.flatMap { $0.isFinite ? $0 : nil } ?? 10,
|
|
||||||
height: proposal.height.flatMap { $0.isFinite ? $0 : nil } ?? 10)
|
|
||||||
}
|
|
||||||
func makeNSView(context: Context) -> RingView { RingView() }
|
|
||||||
func updateNSView(_ view: RingView, context: Context) {
|
|
||||||
view.configure(Input(value: value.isFinite ? min(1, max(0, value)) : 0, color: color,
|
|
||||||
lineWidth: lineWidth, trackOpacity: trackOpacity, inset: inset))
|
|
||||||
}
|
|
||||||
struct Input: Equatable {
|
|
||||||
let value: Double
|
|
||||||
let color: Color
|
|
||||||
let lineWidth: CGFloat
|
|
||||||
let trackOpacity: Double
|
|
||||||
let inset: CGFloat
|
|
||||||
}
|
|
||||||
final class RingView: NSView {
|
|
||||||
private(set) var input: Input?
|
|
||||||
let track = CAShapeLayer()
|
|
||||||
let arc = CAShapeLayer()
|
|
||||||
override var isFlipped: Bool { true }
|
|
||||||
override func hitTest(_ point: NSPoint) -> NSView? { nil }
|
|
||||||
init() {
|
|
||||||
super.init(frame: .zero)
|
|
||||||
wantsLayer = true
|
|
||||||
for shape in [track, arc] {
|
|
||||||
shape.fillColor = nil; shape.lineCap = .round
|
|
||||||
layer?.addSublayer(shape)
|
|
||||||
}
|
|
||||||
setAccessibilityElement(false)
|
|
||||||
}
|
|
||||||
required init?(coder: NSCoder) { nil }
|
|
||||||
func configure(_ value: Input) {
|
|
||||||
guard value != input else { return }
|
|
||||||
let old = input
|
|
||||||
input = value
|
|
||||||
CATransaction.begin(); CATransaction.setDisableActions(true)
|
|
||||||
if old?.color != value.color || old?.trackOpacity != value.trackOpacity { updateColors() }
|
|
||||||
if old?.inset != value.inset || old?.lineWidth != value.lineWidth { updateGeometry() }
|
|
||||||
arc.strokeEnd = value.value
|
|
||||||
CATransaction.commit()
|
|
||||||
}
|
|
||||||
private func updateColors() {
|
|
||||||
guard let input else { return }
|
|
||||||
effectiveAppearance.performAsCurrentDrawingAppearance {
|
|
||||||
let color = NSColor(input.color)
|
|
||||||
track.strokeColor = color.withAlphaComponent(input.trackOpacity).cgColor
|
|
||||||
arc.strokeColor = color.cgColor
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private func updateGeometry() {
|
|
||||||
guard let input else { return }
|
|
||||||
let radius = max(0, min(bounds.width, bounds.height) / 2 - input.inset)
|
|
||||||
let path = CGMutablePath()
|
|
||||||
path.addArc(center: CGPoint(x: bounds.midX, y: bounds.midY), radius: radius,
|
|
||||||
startAngle: -.pi / 2, endAngle: 3 * .pi / 2, clockwise: false)
|
|
||||||
for shape in [track, arc] {
|
|
||||||
shape.frame = bounds; shape.path = path; shape.lineWidth = input.lineWidth
|
|
||||||
}
|
|
||||||
}
|
|
||||||
override func setFrameSize(_ size: NSSize) {
|
|
||||||
let changed = frame.size != size
|
|
||||||
super.setFrameSize(size)
|
|
||||||
if changed {
|
|
||||||
CATransaction.begin(); CATransaction.setDisableActions(true)
|
|
||||||
updateGeometry(); CATransaction.commit()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
override func viewDidMoveToWindow() {
|
|
||||||
super.viewDidMoveToWindow()
|
|
||||||
CATransaction.begin(); CATransaction.setDisableActions(true)
|
|
||||||
updateColors(); CATransaction.commit()
|
|
||||||
}
|
|
||||||
override func viewDidChangeEffectiveAppearance() {
|
|
||||||
super.viewDidChangeEffectiveAppearance()
|
|
||||||
CATransaction.begin(); CATransaction.setDisableActions(true)
|
|
||||||
updateColors(); CATransaction.commit()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,7 +3,6 @@ import SwiftUI
|
|||||||
/// Shared roles for the compact monitoring panel. Micro charts keep their own 8pt role.
|
/// Shared roles for the compact monitoring panel. Micro charts keep their own 8pt role.
|
||||||
enum PanelStyle {
|
enum PanelStyle {
|
||||||
static let title = Font.system(size: 13, weight: .semibold)
|
static let title = Font.system(size: 13, weight: .semibold)
|
||||||
static let section = Font.system(size: 11, weight: .semibold)
|
|
||||||
static let label = Font.system(size: 10)
|
static let label = Font.system(size: 10)
|
||||||
static let value = Font.system(size: 10, weight: .medium)
|
static let value = Font.system(size: 10, weight: .medium)
|
||||||
static let legend = Font.system(size: 9)
|
static let legend = Font.system(size: 9)
|
||||||
@@ -88,19 +87,3 @@ struct CapacityField: View {
|
|||||||
.lineLimit(1)
|
.lineLimit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct CardSectionHeader: View {
|
|
||||||
let title: LocalizedStringKey
|
|
||||||
let valueLabel: LocalizedStringKey
|
|
||||||
let value: String
|
|
||||||
let color: Color
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
HStack {
|
|
||||||
Text(title).font(PanelStyle.section)
|
|
||||||
Spacer(minLength: 4)
|
|
||||||
Text(valueLabel).font(PanelStyle.label).foregroundStyle(.secondary)
|
|
||||||
MetricText(value: value).font(PanelStyle.value).foregroundStyle(color)
|
|
||||||
}.frame(height: 16)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
# 可复用界面
|
|
||||||
|
|
||||||
模块职责统一见[架构](../../docs/architecture.md)。
|
|
||||||
@@ -9,7 +9,7 @@ import Foundation
|
|||||||
preferences.panelMilliseconds = 2_000
|
preferences.panelMilliseconds = 2_000
|
||||||
preferences.backgroundMilliseconds = 30_000
|
preferences.backgroundMilliseconds = 30_000
|
||||||
preferences.backgroundEnabled = true
|
preferences.backgroundEnabled = true
|
||||||
let store = MetricsStore(sampling: preferences, energyEnabled: false)
|
let store = MetricsStore(sampling: preferences)
|
||||||
store.setPanelVisible(true)
|
store.setPanelVisible(true)
|
||||||
try await until { store.history.samples.count >= 2 }
|
try await until { store.history.samples.count >= 2 }
|
||||||
store.setPanelVisible(false)
|
store.setPanelVisible(false)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import Foundation
|
|||||||
preferences.panelMilliseconds = 500
|
preferences.panelMilliseconds = 500
|
||||||
preferences.backgroundEnabled = false
|
preferences.backgroundEnabled = false
|
||||||
let probe = ProcessProbe()
|
let probe = ProcessProbe()
|
||||||
let store = MetricsStore(sampling: preferences, sampler: SystemSampler(processRead: { probe.read(&$0) }), energyEnabled: false)
|
let store = MetricsStore(sampling: preferences, sampler: SystemSampler(processRead: { probe.read(&$0) }))
|
||||||
store.setPanelVisible(true)
|
store.setPanelVisible(true)
|
||||||
try await until { store.history.samples.count >= 2 }
|
try await until { store.history.samples.count >= 2 }
|
||||||
precondition(probe.count == 0 && store.processSnapshot == nil && store.energy == nil,
|
precondition(probe.count == 0 && store.processSnapshot == nil && store.energy == nil,
|
||||||
|
|||||||
@@ -2,28 +2,13 @@ import Foundation
|
|||||||
|
|
||||||
@main struct GPUStatisticsChecks {
|
@main struct GPUStatisticsChecks {
|
||||||
static func main() {
|
static func main() {
|
||||||
func sample(_ time: Double, _ value: Double?, interval: Double = 2, boundary: Bool = false) -> TrendSample {
|
for value in [-1, 101, Double.nan, .infinity] { precondition(GPUMonitor.normalized(value) == nil) }
|
||||||
TrendSample(date: Date(timeIntervalSince1970: time), cpu: nil, gpu: value, memory: nil,
|
precondition(GPUMonitor.normalized(nil) == nil)
|
||||||
breakBefore: boundary, expectedInterval: interval)
|
precondition(GPUMonitor.normalized(0) == 0 && GPUMonitor.normalized(100) == 1)
|
||||||
}
|
|
||||||
let variable = GPUUtilizationSummary(samples: [sample(0, 0), sample(2, 1, interval: 8), sample(10, 1)])
|
|
||||||
precondition(abs(variable.average! - 0.9) < 0.00001 && variable.peak == 1)
|
|
||||||
let clipped = GPUUtilizationSummary(samples: [sample(0, 0, interval: 120), sample(120, 1, interval: 120)])
|
|
||||||
precondition(abs(clipped.average! - 0.75) < 0.00001 && clipped.coverage == 60)
|
|
||||||
precondition(GPUUtilizationSummary(samples: []).average == nil)
|
|
||||||
precondition(GPUUtilizationSummary(samples: [sample(0, 1)]).average == nil)
|
|
||||||
precondition(GPUUtilizationSummary(samples: [sample(0, 1), sample(2, nil), sample(4, 0)]).average == nil)
|
|
||||||
precondition(GPUUtilizationSummary(samples: [sample(0, 1), sample(2, 0, boundary: true)]).average == nil)
|
|
||||||
precondition(GPUUtilizationSummary(samples: [sample(0, 1), sample(60, 0)]).average == nil)
|
|
||||||
precondition(GPUUtilizationSummary(samples: [sample(0, 1), sample(8, 0, interval: 30)]).average == nil,
|
|
||||||
"A later slow cadence must not reconnect an earlier missed interval")
|
|
||||||
precondition(GPUMonitor.memoryBytes(NSNumber(value: -1)) == nil)
|
|
||||||
precondition(GPUMonitor.memoryBytes(NSNumber(value: Double.nan)) == nil)
|
|
||||||
precondition(GPUMonitor.memoryBytes(NSNumber(value: 0)) == 0)
|
|
||||||
precondition(GPUMonitor.normalized(101) == nil)
|
|
||||||
var snapshot = MetricsSnapshot()
|
var snapshot = MetricsSnapshot()
|
||||||
|
precondition(snapshot.gpuUsage == nil)
|
||||||
snapshot.gpu = GPUMetrics(usage: 0.4, coreCount: 20, renderer: 0.3, tiler: 0.1)
|
snapshot.gpu = GPUMetrics(usage: 0.4, coreCount: 20, renderer: 0.3, tiler: 0.1)
|
||||||
snapshot.gpuUsage = snapshot.gpu?.usage
|
precondition(snapshot.gpuUsage == 0.4)
|
||||||
var history = MetricHistory()
|
var history = MetricHistory()
|
||||||
history.append(snapshot)
|
history.append(snapshot)
|
||||||
precondition(history.samples.last?.gpuRenderer == 0.3 && history.samples.last?.gpuTiler == 0.1)
|
precondition(history.samples.last?.gpuRenderer == 0.3 && history.samples.last?.gpuTiler == 0.1)
|
||||||
|
|||||||
@@ -36,8 +36,7 @@ import Foundation
|
|||||||
let expected = ["en": "Fan", "zh-Hans": "风扇", "zh-Hant": "風扇"][language]!
|
let expected = ["en": "Fan", "zh-Hans": "风扇", "zh-Hant": "風扇"][language]!
|
||||||
precondition(title == "\(expected) \(number)", "Numbered fan must use the selected app locale")
|
precondition(title == "\(expected) \(number)", "Numbered fan must use the selected app locale")
|
||||||
}
|
}
|
||||||
let average = AppLocalization.string("gpu.recentAverage", locale: locale, bundle: bundle)
|
|
||||||
precondition(average == ["en": "Last-minute average", "zh-Hans": "近 1 分钟平均", "zh-Hant": "近 1 分鐘平均"][language])
|
|
||||||
}
|
}
|
||||||
print("PASS: system matching, explicit override, fallback, preference roundtrip, built three-language resources")
|
print("PASS: system matching, explicit override, fallback, preference roundtrip, built three-language resources")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ import QuartzCore
|
|||||||
window.contentView = root
|
window.contentView = root
|
||||||
let plot = NativePanelCurve.PlotView(); plot.frame = NSRect(x: 0, y: 0, width: 280, height: 60)
|
let plot = NativePanelCurve.PlotView(); plot.frame = NSRect(x: 0, y: 0, width: 280, height: 60)
|
||||||
root.addSubview(plot)
|
root.addSubview(plot)
|
||||||
let ring = NativeMetricRing.RingView(); ring.frame = NSRect(x: 0, y: 70, width: 28, height: 28)
|
|
||||||
root.addSubview(ring)
|
|
||||||
window.orderFrontRegardless()
|
window.orderFrontRegardless()
|
||||||
try? await Task.sleep(for: .milliseconds(100))
|
try? await Task.sleep(for: .milliseconds(100))
|
||||||
let dates = (0..<4).map { Date(timeIntervalSinceReferenceDate: Double($0 * 2)) }
|
let dates = (0..<4).map { Date(timeIntervalSinceReferenceDate: Double($0 * 2)) }
|
||||||
@@ -55,13 +53,6 @@ import QuartzCore
|
|||||||
precondition(redPixels(bitmap(plot)) > 0)
|
precondition(redPixels(bitmap(plot)) > 0)
|
||||||
plot.appearance = NSAppearance(named: .darkAqua)
|
plot.appearance = NSAppearance(named: .darkAqua)
|
||||||
precondition(redPixels(bitmap(plot)) > 0)
|
precondition(redPixels(bitmap(plot)) > 0)
|
||||||
ring.configure(NativeMetricRing.Input(value: 0, color: .red, lineWidth: 3, trackOpacity: 0.17, inset: 2))
|
|
||||||
precondition(redPixels(bitmap(ring), opaque: true) == 0, "Zero ring must not draw a colored arc")
|
|
||||||
ring.configure(NativeMetricRing.Input(value: 0.25, color: .red, lineWidth: 3, trackOpacity: 0.17, inset: 2))
|
|
||||||
let quarter = redPixels(bitmap(ring), opaque: true)
|
|
||||||
ring.configure(NativeMetricRing.Input(value: 1, color: .red, lineWidth: 3, trackOpacity: 0.17, inset: 2))
|
|
||||||
let full = redPixels(bitmap(ring), opaque: true)
|
|
||||||
precondition(quarter > 0 && full > quarter * 2, "Ring fraction must change the rendered arc")
|
|
||||||
// Sampling updates are final immediately, and hover keeps cached curve geometry.
|
// Sampling updates are final immediately, and hover keeps cached curve geometry.
|
||||||
let nextDates = dates + [Date(timeIntervalSinceReferenceDate: 8)]
|
let nextDates = dates + [Date(timeIntervalSinceReferenceDate: 8)]
|
||||||
let next = NativePanelCurve.Input(frame: PanelCurveFrame(dates: nextDates,
|
let next = NativePanelCurve.Input(frame: PanelCurveFrame(dates: nextDates,
|
||||||
@@ -86,20 +77,14 @@ import QuartzCore
|
|||||||
series: [Array(repeating: 0.8, count: 59) + [0.5]], intervals: fullFrame.intervals, boundaryDates: [])
|
series: [Array(repeating: 0.8, count: 59) + [0.5]], intervals: fullFrame.intervals, boundaryDates: [])
|
||||||
plot.configure(.init(frame: appended, colors: [.red], scales: [1], maximumGap: 5))
|
plot.configure(.init(frame: appended, colors: [.red], scales: [1], maximumGap: 5))
|
||||||
precondition(plot.input?.frame.dates.count == 60, "Static history must not retain an outgoing animation point")
|
precondition(plot.input?.frame.dates.count == 60, "Static history must not retain an outgoing animation point")
|
||||||
ring.configure(.init(value: 0.25, color: .red, lineWidth: 3, trackOpacity: 0.17, inset: 2))
|
|
||||||
precondition(ring.arc.strokeEnd == 0.25, "The arc must immediately show the new value")
|
|
||||||
let updated = bitmap(ring)
|
|
||||||
try? await Task.sleep(for: .milliseconds(180))
|
|
||||||
precondition(pixels(updated) == pixels(bitmap(ring)), "A sampled ring must not interpolate later")
|
|
||||||
// Adding a series with an unchanged palette must color the new layer too.
|
// Adding a series with an unchanged palette must color the new layer too.
|
||||||
plot.configure(.init(frame: PanelCurveFrame(dates: dates, series: [[nil,nil,nil,nil], [0.5,0.5,0.5,0.5]],
|
plot.configure(.init(frame: PanelCurveFrame(dates: dates, series: [[nil,nil,nil,nil], [0.5,0.5,0.5,0.5]],
|
||||||
intervals: [2,2,2,2], boundaryDates: []), colors: [.red], scales: [1], maximumGap: 5))
|
intervals: [2,2,2,2], boundaryDates: []), colors: [.red], scales: [1], maximumGap: 5))
|
||||||
precondition(redPixels(bitmap(plot), from: 0.4, to: 0.6) > 10)
|
precondition(redPixels(bitmap(plot), from: 0.4, to: 0.6) > 10)
|
||||||
assertStatic(plot.layer!)
|
assertStatic(plot.layer!)
|
||||||
assertStatic(ring.layer!)
|
plot.removeFromSuperview()
|
||||||
plot.removeFromSuperview(); ring.removeFromSuperview()
|
|
||||||
window.orderOut(nil); window.close()
|
window.orderOut(nil); window.close()
|
||||||
print("PASS: static curve/ring pixels, immediate stable updates, no animation/material/gradient layers, real gaps, hover cache, palette growth, appearance, full history and unmount")
|
print("PASS: static curve pixels, immediate stable updates, no animation/material/gradient layers, real gaps, hover cache, palette growth, appearance, full history and unmount")
|
||||||
fflush(stdout); NSApp.terminate(nil)
|
fflush(stdout); NSApp.terminate(nil)
|
||||||
}
|
}
|
||||||
NSApp.run()
|
NSApp.run()
|
||||||
@@ -125,12 +110,12 @@ import QuartzCore
|
|||||||
view.layer!.render(in: context)
|
view.layer!.render(in: context)
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
private static func redPixels(_ image: NSBitmapImageRep, from: Double = 0, to: Double = 1, opaque: Bool = false) -> Int {
|
private static func redPixels(_ image: NSBitmapImageRep, from: Double = 0, to: Double = 1) -> Int {
|
||||||
var count = 0
|
var count = 0
|
||||||
for x in Int(Double(image.pixelsWide) * from)..<Int(Double(image.pixelsWide) * to) {
|
for x in Int(Double(image.pixelsWide) * from)..<Int(Double(image.pixelsWide) * to) {
|
||||||
for y in 0..<image.pixelsHigh {
|
for y in 0..<image.pixelsHigh {
|
||||||
guard let color = image.colorAt(x: x, y: y)?.usingColorSpace(.deviceRGB) else { continue }
|
guard let color = image.colorAt(x: x, y: y)?.usingColorSpace(.deviceRGB) else { continue }
|
||||||
if color.redComponent > color.greenComponent + 0.15 && color.redComponent > color.blueComponent + 0.15 && color.alphaComponent > (opaque ? 0.8 : 0.01) { count += 1 }
|
if color.redComponent > color.greenComponent + 0.15 && color.redComponent > color.blueComponent + 0.15 && color.alphaComponent > 0.01 { count += 1 }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return count
|
return count
|
||||||
|
|||||||
@@ -4,23 +4,6 @@ import CoreGraphics
|
|||||||
|
|
||||||
@main struct PresentationChecks {
|
@main struct PresentationChecks {
|
||||||
@MainActor static func main() {
|
@MainActor static func main() {
|
||||||
let screen = CGRect(x: 0, y: 0, width: 1440, height: 900)
|
|
||||||
let parent = CGRect(x: 400, y: 400, width: 320, height: 240)
|
|
||||||
let anchor = CGRect(x: 410, y: 600, width: 300, height: 40)
|
|
||||||
let size = CGSize(width: 280, height: 180)
|
|
||||||
let right = DetailPlacement.frame(anchor: anchor, parent: parent, content: size, visible: screen)
|
|
||||||
precondition(right.minX == parent.maxX + 4 && right.maxY == anchor.maxY)
|
|
||||||
let edgeParent = CGRect(x: 1100, y: 400, width: 320, height: 240)
|
|
||||||
let left = DetailPlacement.frame(anchor: anchor, parent: edgeParent, content: size, visible: screen)
|
|
||||||
precondition(left.maxX == edgeParent.minX - 4)
|
|
||||||
for visible in [screen, CGRect(x: -1440, y: -200, width: 1440, height: 900), CGRect(x: 0, y: 0, width: 200, height: 100)] {
|
|
||||||
let result = DetailPlacement.frame(anchor: anchor, parent: parent, content: size, visible: visible)
|
|
||||||
precondition(visible.contains(result))
|
|
||||||
}
|
|
||||||
let highAnchor = CGRect(x: 400, y: 1100, width: 300, height: 40)
|
|
||||||
precondition(DetailPlacement.frame(anchor: highAnchor, parent: parent, content: size, visible: screen).maxY == screen.maxY)
|
|
||||||
let lowAnchor = CGRect(x: 400, y: -200, width: 300, height: 40)
|
|
||||||
precondition(DetailPlacement.frame(anchor: lowAnchor, parent: parent, content: size, visible: screen).minY == screen.minY)
|
|
||||||
precondition(AppAppearance.system.resolved(systemIsDark: true) == .dark)
|
precondition(AppAppearance.system.resolved(systemIsDark: true) == .dark)
|
||||||
precondition(AppAppearance.system.resolved(systemIsDark: false) == .light)
|
precondition(AppAppearance.system.resolved(systemIsDark: false) == .light)
|
||||||
precondition(AppAppearance.light.resolved(systemIsDark: true) == .light)
|
precondition(AppAppearance.light.resolved(systemIsDark: true) == .light)
|
||||||
@@ -42,6 +25,6 @@ import CoreGraphics
|
|||||||
precondition(NSApp.appearance === global)
|
precondition(NSApp.appearance === global)
|
||||||
}
|
}
|
||||||
window.close()
|
window.close()
|
||||||
print("PASS: outward placement, edge fallback, negative screen origins, vertical limits, explicit/system window appearance reset, independent system resolution")
|
print("PASS: explicit/system window appearance reset, independent system resolution")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,8 +30,10 @@ import Foundation
|
|||||||
let first = monitor.update(processes: processes, readings: [reading(0, at: 10), reading(0, at: 10, id: id2)], capability: .verifiedCPU)
|
let first = monitor.update(processes: processes, readings: [reading(0, at: 10), reading(0, at: 10, id: id2)], capability: .verifiedCPU)
|
||||||
precondition(first.state == .waiting && first.rows.isEmpty)
|
precondition(first.state == .waiting && first.rows.isEmpty)
|
||||||
let measured = monitor.update(processes: processes, readings: [reading(1_000_000_000, at: 15), reading(5_000_000_000, at: 15, id: id2)], capability: .verifiedCPU)
|
let measured = monitor.update(processes: processes, readings: [reading(1_000_000_000, at: 15), reading(5_000_000_000, at: 15, id: id2)], capability: .verifiedCPU)
|
||||||
precondition(measured.state == .partial && measured.rows.first?.id == id2 && measured.measured == 2)
|
precondition(measured.state == .partial && measured.measured == 2)
|
||||||
precondition(measured.rows.first?.watts == 1)
|
let powered = processes.withEnergy(measured)
|
||||||
|
precondition(powered.rows.first { $0.id == id2 }?.cpuPower == 1)
|
||||||
|
precondition(powered.rows.first { $0.id == id }?.cpuPower == 0.2)
|
||||||
_ = monitor.update(processes: processes, readings: [], capability: .unavailable)
|
_ = monitor.update(processes: processes, readings: [], capability: .unavailable)
|
||||||
let recovered = monitor.update(processes: processes, readings: [reading(6_000_000_000, at: 20, id: id2)], capability: .verifiedCPU)
|
let recovered = monitor.update(processes: processes, readings: [reading(6_000_000_000, at: 20, id: id2)], capability: .verifiedCPU)
|
||||||
precondition(recovered.rows.isEmpty, "Failure must not bridge a missing interval")
|
precondition(recovered.rows.isEmpty, "Failure must not bridge a missing interval")
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
# 独立检查程序
|
|
||||||
|
|
||||||
本目录包含独立 Swift 检查入口和本地化检查脚本,当前没有对应 Xcode 测试 Target。
|
|
||||||
|
|
||||||
执行命令、覆盖范围与验收边界统一见[测试与验证](../docs/testing.md)。
|
|
||||||
@@ -29,12 +29,10 @@ import Foundation
|
|||||||
precondition(MetricFormat.watts(12.34) == "12.3 W")
|
precondition(MetricFormat.watts(12.34) == "12.3 W")
|
||||||
var extended = MetricsSnapshot()
|
var extended = MetricsSnapshot()
|
||||||
extended.network = [NetworkInterfaceMetrics(name: "en0", received: 100, sent: 50, download: 20, upload: 10)]
|
extended.network = [NetworkInterfaceMetrics(name: "en0", received: 100, sent: 50, download: 20, upload: 10)]
|
||||||
extended.disk = DiskMetrics(total: 100, available: 40)
|
|
||||||
extended.battery = BatteryMetrics(charge: 0.8, charging: false, externalPower: true, power: 0)
|
extended.battery = BatteryMetrics(charge: 0.8, charging: false, externalPower: true, power: 0)
|
||||||
var extendedHistory = MetricHistory()
|
var extendedHistory = MetricHistory()
|
||||||
extendedHistory.append(extended)
|
extendedHistory.append(extended)
|
||||||
precondition(extendedHistory.samples.last?.download == 20)
|
precondition(extendedHistory.samples.last?.download == 20)
|
||||||
precondition(extendedHistory.samples.last?.disk == 0.6)
|
|
||||||
precondition(extendedHistory.samples.last?.battery == 0.8)
|
precondition(extendedHistory.samples.last?.battery == 0.8)
|
||||||
precondition(extendedHistory.samples.last?.batteryPower == 0)
|
precondition(extendedHistory.samples.last?.batteryPower == 0)
|
||||||
extended.battery?.power = 12.5
|
extended.battery?.power = 12.5
|
||||||
@@ -105,7 +103,6 @@ import Foundation
|
|||||||
precondition(cpu.cores.count == ProcessInfo.processInfo.processorCount)
|
precondition(cpu.cores.count == ProcessInfo.processInfo.processorCount)
|
||||||
precondition(memory.total == ProcessInfo.processInfo.physicalMemory)
|
precondition(memory.total == ProcessInfo.processInfo.physicalMemory)
|
||||||
precondition(memory.used <= memory.total)
|
precondition(memory.used <= memory.total)
|
||||||
precondition(sampled.load.count == 3)
|
|
||||||
await sampler.reset()
|
await sampler.reset()
|
||||||
let reset = await sampler.sample()
|
let reset = await sampler.sample()
|
||||||
precondition(reset.cpu == nil)
|
precondition(reset.cpu == nil)
|
||||||
@@ -130,7 +127,7 @@ import Foundation
|
|||||||
precondition(store.snapshot.cpu != nil)
|
precondition(store.snapshot.cpu != nil)
|
||||||
store.togglePause()
|
store.togglePause()
|
||||||
print("PASS: store publishes, pause freezes snapshot, resume resets baseline")
|
print("PASS: store publishes, pause freezes snapshot, resume resets baseline")
|
||||||
print("PASS: CPU deltas, wraparound, invalid data, first sample, reset, live CPU/memory/load")
|
print("PASS: CPU deltas, wraparound, invalid data, first sample, reset, live CPU/memory")
|
||||||
print("Live CPU: \(cpu.usage), memory: \(memory.used)/\(memory.total), swap: \(String(describing: memory.swapUsed)), pressure: \(String(describing: memory.pressure))")
|
print("Live CPU: \(cpu.usage), memory: \(memory.used)/\(memory.total), swap: \(String(describing: memory.swapUsed)), pressure: \(String(describing: memory.pressure))")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
enum PanelResourceAudit { static let omitted = "" }
|
|
||||||
+4
-5
@@ -25,12 +25,12 @@ CHECKS.update({
|
|||||||
"BoundedProcessChecks": ["kymo/Core/Services/BoundedProcess.swift"],
|
"BoundedProcessChecks": ["kymo/Core/Services/BoundedProcess.swift"],
|
||||||
"SensorScheduleChecks": ["kymo/Core/Services/SensorSchedule.swift"],
|
"SensorScheduleChecks": ["kymo/Core/Services/SensorSchedule.swift"],
|
||||||
"CPUCoreGridChecks": ["kymo/Features/MenuBar/CPUCoreGrid.swift", "kymo/Core/Services/CPUCoreTopology.swift",
|
"CPUCoreGridChecks": ["kymo/Features/MenuBar/CPUCoreGrid.swift", "kymo/Core/Services/CPUCoreTopology.swift",
|
||||||
"kymo/Core/Extensions/MetricFormat.swift", "kymo/UI/Components/MetricProgressBar.swift", "kymo/UI/Components/NativeMetricRing.swift"],
|
"kymo/Core/Extensions/MetricFormat.swift", "kymo/UI/Components/MetricProgressBar.swift"],
|
||||||
"CPUTemperatureChecks": ["kymo/Core/Monitors/CPUTemperatureMonitor.swift"],
|
"CPUTemperatureChecks": ["kymo/Core/Monitors/CPUTemperatureMonitor.swift"],
|
||||||
"DiskHealthChecks": ["kymo/Core/Models/DiskHealthMetrics.swift", "kymo/Core/Monitors/DiskHealthReport.swift"],
|
"DiskHealthChecks": ["kymo/Core/Models/DiskHealthMetrics.swift", "kymo/Core/Monitors/DiskHealthReport.swift"],
|
||||||
"PublicIPAddressChecks": ["kymo/Core/Services/PublicIPAddressService.swift"],
|
"PublicIPAddressChecks": ["kymo/Core/Services/PublicIPAddressService.swift"],
|
||||||
"NativeMetricDrawingChecks": ["kymo/UI/Charts/NativePanelCurve.swift", "kymo/UI/Charts/PanelCurveFrame.swift",
|
"NativeMetricDrawingChecks": ["kymo/UI/Charts/NativePanelCurve.swift", "kymo/UI/Charts/PanelCurveFrame.swift",
|
||||||
"kymo/UI/Charts/PanelCurveGeometry.swift", "kymo/UI/Components/NativeMetricRing.swift"],
|
"kymo/UI/Charts/PanelCurveGeometry.swift"],
|
||||||
"NativeContentHostChecks": ["kymo/UI/Components/NativeContentHost.swift", "kymo/UI/Components/MetricText.swift"],
|
"NativeContentHostChecks": ["kymo/UI/Components/NativeContentHost.swift", "kymo/UI/Components/MetricText.swift"],
|
||||||
"ProcessCPULiveChecks": ["kymo/Core/Models/ProcessMetrics.swift", "kymo/Core/Monitors/ProcessMonitor.swift"],
|
"ProcessCPULiveChecks": ["kymo/Core/Models/ProcessMetrics.swift", "kymo/Core/Monitors/ProcessMonitor.swift"],
|
||||||
"AppearancePreferencesChecks": ["kymo/Core/Services/AppearancePreferences.swift", "kymo/Core/Services/SamplingPreferences.swift"],
|
"AppearancePreferencesChecks": ["kymo/Core/Services/AppearancePreferences.swift", "kymo/Core/Services/SamplingPreferences.swift"],
|
||||||
@@ -41,8 +41,7 @@ CHECKS.update({
|
|||||||
"MemoryHeaderChecks": CORE + ["kymo/Features/MenuBar/MemoryHeaderInfo.swift", "kymo/UI/Components/AppLocalization.swift"],
|
"MemoryHeaderChecks": CORE + ["kymo/Features/MenuBar/MemoryHeaderInfo.swift", "kymo/UI/Components/AppLocalization.swift"],
|
||||||
"NativeProcessTableChecks": ["kymo/Core/Models/ProcessMetrics.swift", "kymo/Features/MenuBar/ProcessTableProjection.swift",
|
"NativeProcessTableChecks": ["kymo/Core/Models/ProcessMetrics.swift", "kymo/Features/MenuBar/ProcessTableProjection.swift",
|
||||||
"kymo/Features/MenuBar/NativeProcessTable.swift", "kymo/Features/MenuBar/ProcessIconCache.swift",
|
"kymo/Features/MenuBar/NativeProcessTable.swift", "kymo/Features/MenuBar/ProcessIconCache.swift",
|
||||||
"kymo/Core/Services/LanguagePreferences.swift", "kymo/UI/Components/AppLocalization.swift",
|
"kymo/Core/Services/LanguagePreferences.swift", "kymo/UI/Components/AppLocalization.swift"],
|
||||||
"kymoTests/Support/ProcessTableAuditStub.swift"],
|
|
||||||
"ProcessSelectionChecks": ["kymo/Core/Models/ProcessMetrics.swift", "kymo/Features/MenuBar/ProcessTableProjection.swift"],
|
"ProcessSelectionChecks": ["kymo/Core/Models/ProcessMetrics.swift", "kymo/Features/MenuBar/ProcessTableProjection.swift"],
|
||||||
"PanelLayoutChecks": ["kymo/Core/Models/ProcessMetrics.swift", "kymo/Features/MenuBar/PanelLayout.swift",
|
"PanelLayoutChecks": ["kymo/Core/Models/ProcessMetrics.swift", "kymo/Features/MenuBar/PanelLayout.swift",
|
||||||
"kymo/Features/MenuBar/ProcessTableProjection.swift"],
|
"kymo/Features/MenuBar/ProcessTableProjection.swift"],
|
||||||
@@ -54,7 +53,7 @@ CHECKS.update({
|
|||||||
"CodeIdentityChecks": ["kymo/Core/Services/CodeIdentity.swift"],
|
"CodeIdentityChecks": ["kymo/Core/Services/CodeIdentity.swift"],
|
||||||
"PanelAssetChecks": [],
|
"PanelAssetChecks": [],
|
||||||
"PresentationChecks": ["kymo/Core/Services/AppearancePreferences.swift", "kymo/Core/Services/LanguagePreferences.swift",
|
"PresentationChecks": ["kymo/Core/Services/AppearancePreferences.swift", "kymo/Core/Services/LanguagePreferences.swift",
|
||||||
"kymo/UI/Components/AppearanceStyle.swift", "kymo/UI/Components/DetailPlacement.swift",
|
"kymo/UI/Components/AppearanceStyle.swift",
|
||||||
"kymo/UI/Components/AppLocalization.swift"],
|
"kymo/UI/Components/AppLocalization.swift"],
|
||||||
"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"],
|
||||||
|
|||||||
Reference in New Issue
Block a user