xref: /aosp_15_r20/prebuilts/tools/linux-x86_64/perfetto/configs/long_trace_binder_config.textproto (revision 6774467a9462441f7cd7fbc651979727f762377a)
1# Copyright (C) 2022 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 2.5 seconds.
21file_write_period_ms: 2500
22
23# See b/126487238 - we need to guarantee ordering of events.
24flush_period_ms: 30000
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: 16384
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
42data_sources {
43  config {
44    name: "linux.ftrace"
45    target_buffer: 0
46    ftrace_config {
47      throttle_rss_stat: true
48      # These parameters affect only the kernel trace buffer size and how
49      # frequently it gets moved into the userspace buffer defined above.
50      buffer_size_kb: 16384
51      drain_period_ms: 250
52
53      # We need to do process tracking to ensure kernel ftrace events targeted at short-lived
54      # threads are associated correctly
55      ftrace_events: "task/task_newtask"
56      ftrace_events: "task/task_rename"
57      ftrace_events: "sched/sched_process_exit"
58      ftrace_events: "sched/sched_process_free"
59
60      # Memory events
61      ftrace_events: "rss_stat"
62      ftrace_events: "ion_heap_shrink"
63      ftrace_events: "ion_heap_grow"
64      ftrace_events: "ion/ion_stat"
65      ftrace_events: "dmabuf_heap/dma_heap_stat"
66      ftrace_events: "oom_score_adj_update"
67      ftrace_events: "gpu_mem/gpu_mem_total"
68      ftrace_events: "fastrpc/fastrpc_dma_stat"
69
70      # Old (kernel) LMK
71      ftrace_events: "lowmemorykiller/lowmemory_kill"
72
73      # New (userspace) LMK
74      atrace_apps: "lmkd"
75      # Added for userspace annotation in the platform scenario test app
76      atrace_apps: "android.platform.test.scenario"
77
78      atrace_categories: "am"
79      atrace_categories: "binder_driver"
80    }
81  }
82}
83
84data_sources: {
85  config {
86    name: "android.gpu.memory"
87    target_buffer: 0
88  }
89}
90
91data_sources {
92  config {
93    name: "linux.process_stats"
94    target_buffer: 1
95    process_stats_config {
96      proc_stats_poll_ms: 10000
97      proc_stats_cache_ttl_ms: 60000
98    }
99  }
100}
101
102data_sources {
103  config {
104    name: "linux.system_info"
105    target_buffer: 1
106  }
107}
108
109data_sources {
110  config {
111    name: "linux.sys_stats"
112    target_buffer: 1
113    sys_stats_config {
114      meminfo_period_ms: 1000
115      meminfo_counters: MEMINFO_MEM_TOTAL
116      meminfo_counters: MEMINFO_MEM_FREE
117      meminfo_counters: MEMINFO_MEM_AVAILABLE
118      meminfo_counters: MEMINFO_BUFFERS
119      meminfo_counters: MEMINFO_CACHED
120      meminfo_counters: MEMINFO_SWAP_CACHED
121      meminfo_counters: MEMINFO_ACTIVE
122      meminfo_counters: MEMINFO_INACTIVE
123      meminfo_counters: MEMINFO_ACTIVE_ANON
124      meminfo_counters: MEMINFO_INACTIVE_ANON
125      meminfo_counters: MEMINFO_ACTIVE_FILE
126      meminfo_counters: MEMINFO_INACTIVE_FILE
127      meminfo_counters: MEMINFO_UNEVICTABLE
128      meminfo_counters: MEMINFO_SWAP_TOTAL
129      meminfo_counters: MEMINFO_SWAP_FREE
130      meminfo_counters: MEMINFO_DIRTY
131      meminfo_counters: MEMINFO_WRITEBACK
132      meminfo_counters: MEMINFO_ANON_PAGES
133      meminfo_counters: MEMINFO_MAPPED
134      meminfo_counters: MEMINFO_SHMEM
135    }
136  }
137}
138
139data_sources {
140  config {
141    name: "android.power"
142    target_buffer: 1
143    android_power_config {
144      battery_poll_ms: 5000
145      collect_power_rails: true
146      battery_counters: BATTERY_COUNTER_CAPACITY_PERCENT
147      battery_counters: BATTERY_COUNTER_CHARGE
148      battery_counters: BATTERY_COUNTER_CURRENT
149    }
150  }
151}
152