Configure Perfetto Locally on Windows via ADB

15 views
Skip to first unread message

Richard Ayala

unread,
Dec 11, 2025, 2:10:28 PM (9 days ago) Dec 11
to Perfetto Development - www.perfetto.dev
Hey all, I'm trying to capture a trace via ADB on Windows via the Quickstart guide: https://android.googlesource.com/platform/external/perfetto/+/e74213b02b99a05d2703a41d5543dffa45996d87/docs/quickstart/android-tracing.md

I have successfully pushed the config file towards the bottom of the page: 

adb push config.txt /data/local/tmp/trace_config.txt

However when I attempt to run the next command

abb shell 'perfetto --txt -c - -o /data/misc/perfetto-traces/trace < /data/local/tmp/trace_config.txt'

I'm getting an error: The TraceConfig is empty 

I know perfetto requires tracebox to utilize the webapp - but that is unavailable on Windows. 

I am just looking to configure so I can capture locally and upload the tracefiles to the webapp. 

S Ashwin Balaji

unread,
Dec 11, 2025, 2:29:32 PM (9 days ago) Dec 11
to Perfetto Development - www.perfetto.dev
So most likely there is a selinux issue, if you run logcat at the same time you will find a log like:

12-11 19:20:58.908 20757 20757 W perfetto: type=1400 audit(0.0:16): avc:  denied  { read } for  path="/data/local/tmp/trace_config.txt" dev="dm-51" ino=19127 scontext=u:r:perfetto:s0 tcontext=u:object_r:shell_data_file:s0 tclass=file permissive=0


Try pushing the config to /data/misc/perfetto-configs/ and then run the command

adb push config.txt /data/misc/perfetto-configs/
adb shell 'perfetto --txt -c - -o /data/misc/perfetto-traces/trace < /data/misc/perfetto-configs/config.txt'

S Ashwin Balaji

unread,
Dec 11, 2025, 2:35:32 PM (9 days ago) Dec 11
to Perfetto Development - www.perfetto.dev

Sorry forgot sharing, for more details please refer to our documentation at: https://perfetto.dev/docs/learning-more/android

Richard Ayala

unread,
Dec 11, 2025, 3:04:42 PM (9 days ago) Dec 11
to Perfetto Development - www.perfetto.dev
Thank you I appear unblocked now appreciate it 🤝

Richard Ayala

unread,
Dec 12, 2025, 11:11:32 AM (8 days ago) Dec 12
to Perfetto Development - www.perfetto.dev
After you unblocked me yesterday I had no problem using perfetto without the config file - I am now trying to utilize with the config file attached in the quickstart guide: https://android.googlesource.com/platform/external/perfetto/+/e74213b02b99a05d2703a41d5543dffa45996d87/docs/quickstart/android-tracing.md

adb shell perfetto \
  -c - --txt \
  -o /data/misc/perfetto-traces/trace \
<<EOF
duration_ms: 10000

buffers: {
    size_kb: 8960
    fill_policy: DISCARD
}
buffers: {
    size_kb: 1280
    fill_policy: DISCARD
}
data_sources: {
    config {
        name: "linux.ftrace"
        ftrace_config {
            ftrace_events: "sched/sched_switch"
            ftrace_events: "power/suspend_resume"
            ftrace_events: "sched/sched_process_exit"
            ftrace_events: "sched/sched_process_free"
            ftrace_events: "task/task_newtask"
            ftrace_events: "task/task_rename"
            ftrace_events: "ftrace/print"
            atrace_categories: "gfx"
            atrace_categories: "view"
            atrace_categories: "webview"
            atrace_categories: "dalvik"
            atrace_categories: "power"
        }
    }
}
data_sources: {
    config {
        name: "linux.process_stats"
        target_buffer: 1
        process_stats_config {
            scan_all_processes_on_start: true
        }
    }
}

EOF

It is pushed correctly but when I try to use it: adb shell perfetto -c /data/misc/perfetto-configs/trace_config.txt --txt -o /data/misc/perfetto-traces/trace

The console returns the following error: 

/data/misc/perfetto-configs/trace_config.txt:1:0 error: No field named "adb" in proto TraceConfig
adb shell perfetto \
~~
[182.190] pbtxt_to_pb.cc:670      Unexpected char \ (errno: 0, Success)

S Ashwin Balaji

unread,
Dec 12, 2025, 11:27:40 AM (8 days ago) Dec 12
to Perfetto Development - www.perfetto.dev
Hi

the adb line there is running the command, not part of config, you can find more details in https://perfetto.dev/docs/concepts/config.

Plese remove:

adb shell perfetto \
  -c - --txt \
  -o /data/misc/perfetto-traces/trace \
<<EOF

config.txt content start:
config.txt content end
Reply all
Reply to author
Forward
0 new messages