xref: /aosp_15_r20/prebuilts/tools/linux-x86_64/perfetto/configs/trace_config_experimental.textproto (revision 6774467a9462441f7cd7fbc651979727f762377a)
1# Copyright (C) 2020 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
36data_sources {
37  config {
38    name: "track_event"
39    target_buffer: 0
40    track_event_config {
41      disabled_categories:"*"
42      enabled_categories: "servicemanager"
43    }
44  }
45  producer_name_regex_filter: "/system/bin/servicemanager"
46}
47
48data_sources {
49  config {
50    name: "linux.ftrace"
51    target_buffer: 0
52    ftrace_config {
53      throttle_rss_stat: true
54      # These parameters affect only the kernel trace buffer size and how
55      # frequently it gets moved into the userspace buffer defined above.
56      buffer_size_kb: 16384
57      drain_period_ms: 250
58
59      # Store certain high-volume "sched" ftrace events in a denser format
60      # (falling back to the default format if not supported by the tracer).
61      compact_sched {
62        enabled: true
63      }
64
65      # Enables symbol name resolution against /proc/kallsyms
66      symbolize_ksyms: true
67      # Parse kallsyms before acknowledging that the ftrace data source has been started. In
68      # combination with "perfetto --background-wait" as the consumer, it lets us defer the
69      # test we're tracing until after the cpu has quieted down from the cpu-bound kallsyms parsing.
70      initialize_ksyms_synchronously_for_testing: true
71      # Avoid re-parsing kallsyms on every test run, as it takes 200-500ms per run. See b/239951079
72      ksyms_mem_policy: KSYMS_RETAIN
73
74      # We need to do process tracking to ensure kernel ftrace events targeted at short-lived
75      # threads are associated correctly
76      ftrace_events: "task/task_newtask"
77      ftrace_events: "task/task_rename"
78      ftrace_events: "sched/sched_process_exit"
79      ftrace_events: "sched/sched_process_free"
80
81      # Memory events
82      ftrace_events: "rss_stat"
83      ftrace_events: "ion_heap_shrink"
84      ftrace_events: "ion_heap_grow"
85      ftrace_events: "ion/ion_stat"
86      ftrace_events: "dmabuf_heap/dma_heap_stat"
87      ftrace_events: "oom_score_adj_update"
88      ftrace_events: "gpu_mem/gpu_mem_total"
89      ftrace_events: "fastrpc/fastrpc_dma_stat"
90
91      # Power events
92      ftrace_events: "power/suspend_resume"
93      ftrace_events: "power/cpu_frequency"
94      ftrace_events: "power/cpu_idle"
95      ftrace_events: "power/wakeup_source_activate"
96      ftrace_events: "power/wakeup_source_deactivate"
97
98      # Old (kernel) LMK
99      ftrace_events: "lowmemorykiller/lowmemory_kill"
100
101      atrace_apps: "*"
102
103      atrace_categories: "am"
104      atrace_categories: "aidl"
105      atrace_categories: "bionic"
106      atrace_categories: "camera"
107      atrace_categories: "wm"
108      atrace_categories: "dalvik"
109      atrace_categories: "sched"
110      atrace_categories: "freq"
111      atrace_categories: "gfx"
112      atrace_categories: "video"
113      atrace_categories: "view"
114      atrace_categories: "webview"
115      atrace_categories: "input"
116      atrace_categories: "hal"
117      atrace_categories: "binder_driver"
118      atrace_categories: "sync"
119      atrace_categories: "workq"
120      atrace_categories: "res"
121      atrace_categories: "power"
122      atrace_categories: "network"
123
124    }
125  }
126}
127
128data_sources: {
129  config {
130    name: "android.gpu.memory"
131    target_buffer: 0
132  }
133}
134
135data_sources {
136  config {
137    name: "linux.process_stats"
138    target_buffer: 0
139    process_stats_config {
140      proc_stats_poll_ms: 10000
141    }
142  }
143}
144
145data_sources {
146  config {
147    name: "linux.system_info"
148    target_buffer: 0
149  }
150}
151
152data_sources {
153  config {
154    name: "linux.sys_stats"
155    target_buffer: 0
156    sys_stats_config {
157      meminfo_period_ms: 1000
158      meminfo_counters: MEMINFO_MEM_TOTAL
159      meminfo_counters: MEMINFO_MEM_FREE
160      meminfo_counters: MEMINFO_MEM_AVAILABLE
161      meminfo_counters: MEMINFO_BUFFERS
162      meminfo_counters: MEMINFO_CACHED
163      meminfo_counters: MEMINFO_SWAP_CACHED
164      meminfo_counters: MEMINFO_ACTIVE
165      meminfo_counters: MEMINFO_INACTIVE
166      meminfo_counters: MEMINFO_ACTIVE_ANON
167      meminfo_counters: MEMINFO_INACTIVE_ANON
168      meminfo_counters: MEMINFO_ACTIVE_FILE
169      meminfo_counters: MEMINFO_INACTIVE_FILE
170      meminfo_counters: MEMINFO_UNEVICTABLE
171      meminfo_counters: MEMINFO_SWAP_TOTAL
172      meminfo_counters: MEMINFO_SWAP_FREE
173      meminfo_counters: MEMINFO_DIRTY
174      meminfo_counters: MEMINFO_WRITEBACK
175      meminfo_counters: MEMINFO_ANON_PAGES
176      meminfo_counters: MEMINFO_MAPPED
177      meminfo_counters: MEMINFO_SHMEM
178    }
179  }
180}
181
182data_sources: {
183  config: {
184    name: "android.surfaceflinger.frametimeline"
185    target_buffer: 0
186  }
187}
188
189data_sources: {
190  config {
191    name: "android.power"
192    target_buffer: 0
193    android_power_config {
194      battery_poll_ms: 500
195      collect_power_rails: true
196    }
197  }
198}
199data_sources: {
200  config {
201    name: "linux.perf"
202    target_buffer: 0
203    perf_event_config {
204      timebase {
205        tracepoint {
206          name: "binder:binder_transaction"
207        }
208        period: 1
209        # Don't use PERF_CLOCK_BOOTTIME, tracepoints are not compatible.
210      }
211      callstack_sampling {
212        kernel_frames: false
213      }
214      max_daemon_memory_kb: 524288
215    }
216  }
217}