xref: /aosp_15_r20/prebuilts/tools/linux-x86_64/perfetto/configs/trace_config_detailed.textproto (revision 6774467a9462441f7cd7fbc651979727f762377a)
1# Copyright (C) 2019 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15# proto-message: TraceConfig
16
17# Enable periodic flushing of the trace buffer into the output file.
18write_into_file: true
19
20# Writes the userspace buffer into the file every 1s.
21file_write_period_ms: 1000
22
23# See b/126487238 - we need to guarantee ordering of events.
24flush_period_ms: 10000
25
26# The trace buffers needs to be big enough to hold |file_write_period_ms| of
27# trace data. The trace buffer sizing depends on the number of trace categories
28# enabled and the device activity.
29
30# RSS events
31buffers {
32  size_kb: 32768
33  fill_policy: RING_BUFFER
34}
35
36# procfs polling and linux system info from sysfs
37buffers {
38  size_kb: 8192
39  fill_policy: RING_BUFFER
40}
41
42# for perf samples on binder transactions
43buffers {
44  size_kb: 40960
45  fill_policy: RING_BUFFER
46}
47
48data_sources {
49  config {
50    name: "track_event"
51    track_event_config {
52      disabled_categories:"*"
53      enabled_categories: "servicemanager"
54    }
55  }
56  producer_name_regex_filter: "/system/bin/servicemanager"
57}
58
59data_sources {
60  config {
61    name: "linux.ftrace"
62    target_buffer: 0
63    ftrace_config {
64      throttle_rss_stat: true
65      # These parameters affect only the kernel trace buffer size and how
66      # frequently it gets moved into the userspace buffer defined above.
67      buffer_size_kb: 16384
68      drain_period_ms: 250
69
70      # Store certain high-volume "sched" ftrace events in a denser format
71      # (falling back to the default format if not supported by the tracer).
72      compact_sched {
73        enabled: true
74      }
75
76      # Enables symbol name resolution against /proc/kallsyms
77      symbolize_ksyms: true
78      # Parse kallsyms before acknowledging that the ftrace data source has been started. In
79      # combination with "perfetto --background-wait" as the consumer, it lets us defer the
80      # test we're tracing until after the cpu has quieted down from the cpu-bound kallsyms parsing.
81      initialize_ksyms_synchronously_for_testing: true
82      # Avoid re-parsing kallsyms on every test run, as it takes 200-500ms per run. See b/239951079
83      ksyms_mem_policy: KSYMS_RETAIN
84
85      # We need to do process tracking to ensure kernel ftrace events targeted at short-lived
86      # threads are associated correctly
87      ftrace_events: "task/task_newtask"
88      ftrace_events: "task/task_rename"
89      ftrace_events: "sched/sched_process_exit"
90      ftrace_events: "sched/sched_process_free"
91
92      # Memory events
93      ftrace_events: "rss_stat"
94      ftrace_events: "ion_heap_shrink"
95      ftrace_events: "ion_heap_grow"
96      ftrace_events: "ion/ion_stat"
97      ftrace_events: "dmabuf_heap/dma_heap_stat"
98      ftrace_events: "oom_score_adj_update"
99      ftrace_events: "gpu_mem/gpu_mem_total"
100      ftrace_events: "fastrpc/fastrpc_dma_stat"
101
102      # Power events
103      ftrace_events: "power/suspend_resume"
104      ftrace_events: "power/cpu_frequency"
105      ftrace_events: "power/cpu_idle"
106      ftrace_events: "power/gpu_frequency"
107
108      # Old (kernel) LMK
109      ftrace_events: "lowmemorykiller/lowmemory_kill"
110
111      atrace_apps: "*"
112
113      atrace_categories: "am"
114      atrace_categories: "aidl"
115      atrace_categories: "bionic"
116      atrace_categories: "camera"
117      atrace_categories: "wm"
118      atrace_categories: "dalvik"
119      atrace_categories: "sched"
120      atrace_categories: "freq"
121      atrace_categories: "gfx"
122      atrace_categories: "video"
123      atrace_categories: "view"
124      atrace_categories: "webview"
125      atrace_categories: "input"
126      atrace_categories: "hal"
127      atrace_categories: "binder_driver"
128      atrace_categories: "sync"
129      atrace_categories: "workq"
130      atrace_categories: "res"
131      atrace_categories: "power"
132      atrace_categories: "network"
133
134    }
135  }
136}
137
138data_sources: {
139  config {
140    name: "android.gpu.memory"
141    target_buffer: 0
142  }
143}
144
145data_sources {
146  config {
147    name: "linux.process_stats"
148    target_buffer: 1
149    process_stats_config {
150      proc_stats_poll_ms: 10000
151    }
152  }
153}
154
155data_sources {
156  config {
157    name: "linux.system_info"
158    target_buffer: 1
159  }
160}
161
162data_sources {
163  config {
164    name: "linux.sys_stats"
165    target_buffer: 1
166    sys_stats_config {
167      meminfo_period_ms: 1000
168      meminfo_counters: MEMINFO_MEM_TOTAL
169      meminfo_counters: MEMINFO_MEM_FREE
170      meminfo_counters: MEMINFO_MEM_AVAILABLE
171      meminfo_counters: MEMINFO_BUFFERS
172      meminfo_counters: MEMINFO_CACHED
173      meminfo_counters: MEMINFO_SWAP_CACHED
174      meminfo_counters: MEMINFO_ACTIVE
175      meminfo_counters: MEMINFO_INACTIVE
176      meminfo_counters: MEMINFO_ACTIVE_ANON
177      meminfo_counters: MEMINFO_INACTIVE_ANON
178      meminfo_counters: MEMINFO_ACTIVE_FILE
179      meminfo_counters: MEMINFO_INACTIVE_FILE
180      meminfo_counters: MEMINFO_UNEVICTABLE
181      meminfo_counters: MEMINFO_SWAP_TOTAL
182      meminfo_counters: MEMINFO_SWAP_FREE
183      meminfo_counters: MEMINFO_DIRTY
184      meminfo_counters: MEMINFO_WRITEBACK
185      meminfo_counters: MEMINFO_ANON_PAGES
186      meminfo_counters: MEMINFO_MAPPED
187      meminfo_counters: MEMINFO_SHMEM
188    }
189  }
190}
191
192data_sources: {
193  config: {
194    name: "android.surfaceflinger.frametimeline"
195  }
196}
197
198data_sources: {
199  config {
200    name: "android.power"
201    target_buffer: 1
202    android_power_config {
203      battery_poll_ms: 1000
204      collect_power_rails: true
205      battery_counters: BATTERY_COUNTER_CAPACITY_PERCENT
206      battery_counters: BATTERY_COUNTER_CHARGE
207      battery_counters: BATTERY_COUNTER_CURRENT
208    }
209  }
210}
211data_sources: {
212        config {
213          name: "linux.perf"
214          target_buffer: 2
215          perf_event_config {
216            timebase {
217              tracepoint {
218                name: "binder:binder_transaction"
219              }
220              period: 1
221              # Don't use PERF_CLOCK_BOOTTIME, tracepoints are not compatible.
222            }
223            callstack_sampling {
224              kernel_frames: false
225            }
226            max_daemon_memory_kb: 524288
227    }
228  }
229}
230