A cli tool to inspect .fxt files
Usage:
# e.g. to locate invalid records in a trace
fx fxtdump dump trace.fxt --strict
...
...
0x0d9ffb40: Event(EventRecord { provider: Some(Provider { id: 61, name: "starnix_kernel.cm" }), timestamp: 935523250156, process: ProcessKoid(46458), thread: ThreadKoid(46460), category: "kmem_stats_a", name: "starnix:pager", args: [Arg { name: "name", value: String("write") }], payload: DurationEnd })
ERROR couldn't parse string as utf-8
Will get you the offset into the trace directly before where which we encountered a corrupted record.
fxtdump check walks the raw FXT records and reports data that was lost, including losses that trace_processor drops without recording: provider buffer-full events, malformed or dropped Perfetto blobs, a corrupt or cut-off joined Perfetto stream, record size errors and large records that trace_processor misreads.
fx fxtdump check <trace.fxt | -> [--format text|json] [--expect-providers a,b]
pathlib, so not a file named just .gz) is .zst or .gz is always decoded as such; other paths and - (stdin) are sniffed by their magic bytes. A zstd stream may start with a skippable frame.--expect-providers lists provider names that must appear in the trace.$ fx fxtdump check empty_activity_trace.fxt ### FXT Check: TRUNCATED - File: `empty_activity_trace.fxt` (109546048 bytes, 2147374 records) - last Perfetto packet cut off (9045 bytes missing) | perfetto status | blobs | malformed | payload bytes | packets | | --- | --- | --- | --- | --- | | TRAILING | 4027 | 0 | 15666680 | 380 | | provider | id | records | bytes | buffer full events | | --- | --- | --- | --- | --- | | ktrace_provider | 52 | 1416280 | 69023840 | 0 | | starnix_kernel.cm | 60 | 498627 | 33060888 | 0 | ... | detail | value | | --- | --- | | parsed bytes | 109546048 | ... | perfetto trailing missing bytes | 9045 |
--format json prints the same report for tools:
$ fx fxtdump check --format json calendar_cold.traced_trace.fxt.zst
{
"path": "calendar_cold.traced_trace.fxt.zst",
"schema_version": 1,
"verdict": "CLEAN",
"reasons": [],
"file_bytes": 341552800,
"parsed_bytes": 341552800,
"records": 5985003,
...
"providers": [
{
"provider_id": 36,
"name": "ktrace_provider",
"records": 4047715,
"bytes": 197298736,
"buffer_full_events": 0
},
...
],
"perfetto": {
"blobs": 48843,
...
"packets": 33050,
...
"status": "OK"
}
}
Checker behavior:
--format json (not --format=json) and may be given only once; either mistake is a usage error (exit 2).$ fx fxtdump category_stats trace.fxt +-------------------+------------+---------+ | Category | Size | Count | +-------------------+------------+---------+ | kernel:vm | 127451 KiB | 1812649 | +-------------------+------------+---------+ | kernel_sched | 49889 KiB | 1069634 | +-------------------+------------+---------+ | kernel:contention | 33571 KiB | 715898 | +-------------------+------------+---------+ | kernel:power | 28322 KiB | 517899 | +-------------------+------------+---------+ | gfx | 7009 KiB | 241187 | +-------------------+------------+---------+ | magma | 2089 KiB | 74046 | +-------------------+------------+---------+ | input | 948 KiB | 38862 | +-------------------+------------+---------+ | kernel:meta | 188 KiB | 3441 | +-------------------+------------+---------+ | memory:kernel | 49 KiB | 307 | +-------------------+------------+---------+ | system_metrics | 14 KiB | 420 | +-------------------+------------+---------+