Skip to content

Build 57 Startup+FrameTime 单 CoreProfile 连续采集架构 ​

背景与问题陈述 ​

在真机测试中,针对 StartupTiming 与 FrameTime 指标采集表现如下:

  • 纯启动模式 (Startup-only):正常获取启动时间。
  • 纯帧率模式 (FrameTime-only):Build 56 修复后正常获取 FrameTime,首值延迟约 2 秒。
  • 联合采集模式 (Startup + FrameTime):Startup 可以正常获取,FrameTime 最终可以获取,但首值延迟长达 10+ 秒。

延迟根因剖析 ​

此前 Startup + FrameTime 的采集流程为串行两阶段轮转:

  1. 以 LAUNCH_KDEBUG_FILTERS 启动 CoreProfile;
  2. 等待启动语义阶段闭环;
  3. 停止 CoreProfile Tap 并执行 drain(超时时间达 4 秒);
  4. 重启 CoreProfile Tap(约 0.7 秒),切换为呈现帧 filter(0x31800000);
  5. 等待新 Tap 的首个 chunk 到达(约 1 秒+)。

因此 FrameTime 首值延迟明显晚于 FrameTime-only。并且由于 Startup CoreProfile 原先仅过滤启动事件(frame_time=False),启动过程中的呈现帧完全丢失。

统一单 CoreProfile 连续采集架构设计 ​

彻底废弃“停止、drain、重启、切换 filter”的双阶段轮转机制,实施统一单 CoreProfile 连续采集架构:

1. 初始联合订阅与单 Tap 保持 ​

  • 在 StartupTiming = ON, FrameTime = ON 时,判定采集模式为 startup-and-frame;
  • CoreProfile Session 启动时直接配置联合 filters:LAUNCH_KDEBUG_FILTERS 并集 PRESENTED_FRAME_FILTER 0x31800000;
  • 启动语义完成时,仅发布启动耗时报告并标记 startup_semantic_complete,不停止、不排空、不重启 CoreProfile;
  • 彻底规避 4 秒 drain 超时与 0.7 秒 restart 延迟,sourceEpoch 全程保持为 1。

2. 单 Decoder 连续消费与平滑交接 ​

  • 启动期间:由单一 LaunchTraceDecoder 统一消费 CoreProfile chunk,同时提取启动 trace 与呈现帧,并将呈现帧实时写入 frame-events-live.jsonl;
  • 启动闭环后:消费模式原地平滑切换为 frame-continuation,单一 Decoder 继续提取呈现帧,彻底杜绝双 Decoder 重复消费 0x31800318;
  • 跨越启动完成边界,呈现帧时间戳单调递增连续,无数据丢失与重复。

验证与测试 ​

  • 9 项专项单元测试(MacApp/Sidecar/tests/test_unified_core_profile.py):全量 9/9 PASS(2.39s)。
  • Python Sidecar 套件:全量 399/399 PASS(7.31s)。
  • Swift 客户端套件:全量 145/145 PASS(3项显式跳过,0 失败)。
  • 静态探针与契约检查:ready=true,63 项 Metric Contracts,9 个 Source Families。
  • 打包与签名:生成 Build 57 Perfowl.app、ZIP 与 DMG,通过 Developer ID 严格验签、hdiutil verify 与解包挂载校验。

交付产物与哈希 ​

  • ZIP 归档:MacApp/dist/Perfowl-internal-test-Build57-x86_64.zip(109,221,474 bytes,SHA-256 bde7d83458762cddbb12557f852a4ab3c38876e6065c48e0f9f248cb32106e9f)
  • DMG 镜像:MacApp/dist/Perfowl-internal-test-Build57-x86_64.dmg(140,346,421 bytes,SHA-256 899b8d8eea2c6f2cd855050c264738be8c475d5b8eac83c4982ad02c950b2e14)
  • 主可执行文件:MacApp/dist/Perfowl.app/Contents/MacOS/Perfowl(6,593,088 bytes,SHA-256 7d6da7f2a0a44ea76d359f565e16b3747511d95b2b038e7efdbfea3056aa6744)

证据边界与未关闭门禁 ​

本机未配置 Apple Notary Service Keychain Profile,公证与 ticket stapling 门禁仍开放;GPL-3.0 法务评估门禁仍开放;当前测试包仅供内部联调与真机复测,交付状态标记为 partial。

Perfowl · Performance Observer