CORE-5 GPU Schema 与 Lifecycle 候选事件
开发方案(先于代码)
GPU schema
复用同一 pmd3 Graphics service,新增显式 GPU schema Adapter。它只识别当前已观察字段:
Device Utilization %Renderer Utilization %Tiler Utilization %CoreAnimationFramesPerSecond- memory/scene 辅助字段
字段值只接受有限数值,原始单位按字段名保留为 source-native。字段集合完全未知或已知字段类型错误时,raw payload 仍保存,但 decodeStatus=candidate-unknown、quality=unsupported-schema,不生成 GPU 指标。当前 Registry 已有三项 GPU metricID,仍保持 experimental;本阶段不修改公式。
Lifecycle
在唯一 DTX provider 上周期性读取 DeviceInfo.proclist(),根据 Bundle ID/PID 观察状态变化:
observed-runningobserved-foregroundobserved-backgroundobserved-reboundobserved-terminated
事件时间是主机收到状态变化的时间,窗口上限等于 polling interval,不是 App 内埋点真值。scope process,unit state-event;unknown/missing 不转 0。
被动与受控模式隔离
默认 passive-observation:不 launch、不 kill、不发 signal。若后续产品需要冷启动实验,必须由独立 controlled-launch coordinator 显式开启并写入 Session mode;不得复用被动事件名称冒充精确启动耗时。本阶段只实现被动观察。
指标/公式状态
Lifecycle 目前没有 Registry metricID,仅为 candidate event;Startup Duration 需要定义起点、终点、时钟域和聚合规则后另行发布。GPU 三项沿用既有 raw gauge 定义,不增加计算。
实施结果
GraphicsGPUCounterRawAdapter复用 Graphics provider 并对白名单有限数值做 schema 判定;未知字段或类型错误 fail closed。LifecycleRawAdapter只使用 DeviceInfo polling,被动生成状态变化;payload 固定写observationMode=passive-observation与 0.5 秒 polling interval。- lifecycle rebound 时递增 observed generation;termination 时 PID 缺失保持 null,不写 0。
- CLI 仅在显式
--adapters中启动这两路;默认链不变。
验收数据
| 验收 | 结果 | 等级 |
|---|---|---|
| Python 3.12 / 系统 Python | 各 53/53 | E2 |
| GPU known/invalid/unknown schema | 3 种 fixture;invalid/unknown 均 unsupported-schema | E2 |
| Lifecycle 状态机 | running→foreground→terminated→running;generation 1→2 | E2 |
| iOS 16 raw | 4 秒:GPU schema 4、Lifecycle 1;GPU 9 个已知字段,schemaKnown=true | E4 |
| 受控前后台刺激下的被动观察 | 7 秒:observed-running/foreground=true → observed-background → observed-foreground;generation 不变 | E4 candidate event |
| 冻结二进制 | 3 秒:GPU schema 3、Lifecycle 1;4 条严格回放、drop 0、generation 10 | E4 |
| Swift | 62/62(未改 Swift 产品代码) | E2 |
第一次 raw 观测时目标 App 为后台;同 Session 的 Graphics 仍出现动态值。这再次证明 Graphics scope 是 foreground-device,并非目标进程专属 GPU。文档和 Adapter 不把它冒充 App GPU。
Lifecycle 前后台三事件是在外部测试 harness 受控切换两个已安装 App 时观察到的;Adapter 自身未调用 launch/kill/signal。0.5 秒轮询时间窗意味着它只能作为候选状态事件,不能用来宣称精确 Startup Duration。
阶段结论
CORE-5 完成 GPU schema fail-closed 与被动 Lifecycle 状态流,当前 iOS 16 和冻结候选二进制达到 E4。Startup、termination、rebound 的状态机已有 fixture 覆盖,但本轮真机只验收 running/foreground/background;精确启动耗时和 CoreProfile lifecycle decoder 仍不具备。