feat(datasource): 将文本 ftrace 规范化为 Proto Source tables - #218
Conversation
🤖 AI[1%] 🔧 Human Fixed[0%] 🧑 Human[99%] 👌 AI Adopted[100%]
🤖 AI[82%] 🔧 Human Fixed[0%] 🧑 Human[18%] 👌 AI Adopted[100%] Co-authored-by: codex (gpt-5.6-sol) <ai@local>
🤖 AI[100%] 🔧 Human Fixed[0%] 🧑 Human[0%] 👌 AI Adopted[100%] Co-authored-by: codex (gpt-5.6-sol) <ai@local>
🤖 AI[59%] 🔧 Human Fixed[0%] 🧑 Human[41%] 👌 AI Adopted[100%]
0d8c280 to
b8449f4
Compare
b8449f4 to
fae80f2
Compare
|
e069df1 to
958e69b
Compare
Closes #217
交付内容
FtraceEvent,首批覆盖 25 类事件,不再维护私有事件 Arrow Schema。TracePluginResult;每个 CPU 一个 detail;CPU 内事件保持来源顺序,每条事件只选择一个 oneof payload。架构图与调用链路
flowchart TB subgraph H[HTrace Datasource] direction TB H0[CLI import hitrace] H1[materializer::import_hitrace] H2[hitrace::decode_file_with_report] H3[LongTermHitraceSink] H4[PluginEnvelope claimant] H5[NativeHookSourceCapture] H6[ProfilerPayloadCapture] H7[full-root generated emitter] H8[PreparedImport] H0 --> H1 --> H2 H2 --> H3 --> H8 H2 --> H4 --> H5 --> H6 --> H7 end subgraph T[Text ftrace Datasource] direction TB T0[CLI import ftrace] T1[import_text_ftrace] T2[ftrace_text::decode_reader] T3[generated FtraceEvent] T4[TextFtraceSourceCapture] T5[incremental root/subtree emitters] T6[clock_domain] T0 --> T1 --> T2 --> T3 --> T4 --> T5 T1 --> T6 end subgraph S[Shared descriptor-derived Proto Source mechanism] direction TB S0[descriptor relation plan / codegen] S1[generated SourceTableLayout] S2[SourceTableCapture<br/>one instance per import] S3[8192-row bounded relation spool] S4[PreparedSourceTables preflight] S0 --> S1 S1 -. constructs .-> S2 S2 --> S3 --> S4 end subgraph P[Dataset publication] direction TB P0[dataset_writer::DatasetWriter] P1[Parquet Dataset] P0 --> P1 end S0 -. generates .-> H7 S0 -. generates .-> T5 H7 --> S2 T5 --> S2 S4 --> H8 H8 --> P0 S4 --> P0 T6 --> P0LongTermHitraceSink与PluginEnvelopeclaimant;前者保留 clock、规范化sched_switch和完整性校验,后者写入 descriptor-derived Source tables。TextFtraceSourceCapture只管理文本 root、CPU detail 和 repeated index。SourceTableLayout是每个 capture 实例的构造输入,不是逐事件运行时节点。PreparedImport合并 legacy normalized tables 与PreparedSourceTables;文本把clock_domain与PreparedSourceTables直接交给同一 Dataset writer。最终候选复验
最终候选 SHA:
fae80f2cargo +stable test -p kat-datasource --features protobuf-source-contract-fixture incremental_relation --quietcargo +stable test -p kat-datasource --test text_ftrace_import_contract --quietcargo +stable test -p kat-datasource same_source --quietcargo +stable test --workspace --quietcargo +stable clippy --workspace --all-targets -- -D warningscargo +stable fmt --all -- --checkgit diff --check origin/codex/issue-213-ftrace-source-capture...HEADworkspace 中依赖真实设备、隔离 Windows profile 或
KAT_TEST_PYTHON的既有测试按其声明条件忽略。PR Guard 已通过。已复验的数据合同
trace/kat_hitrace_text.ftrace.gz(测试时解压):4 类、9,043 条事件全部落表:sched_switch: 6,005sched_wakeup: 3,032sched_wakeup_new: 4print: 2event/field/line/reason,成功结果返回空compatibility_issues。历史真实设备验证材料
以下结果来自 2026-08-19 的同一 tracefs ring buffer 重叠采集,已记录在兼容矩阵;原始设备 capture 当前不在仓库,因此本次不能重新执行,只作为历史设备证据:
tgid=0;另有 43 条非零 PID 事件显式空 comm。本 PR 保留各来源事实,不增加启发式回填;待与 HTrace/ftrace-plugin 负责人确认后另行处理。
Draft 原因与剩余验收
仓库当前没有 Issue #217 所述真实 25 类、44,344 条 fixture,因此尚不能提供:
补齐经 review 的真实 fixture 或可重复设备采集产物后转 Ready for review。
依赖
这是堆叠 PR,base 为开放 PR #215 的 head 分支
codex/issue-213-ftrace-source-capture。#215 合并后应把本 PR base 更新为main。