1# Copyright (C) 2021 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
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      # These parameters affect only the kernel trace buffer size and how
48      # frequently it gets moved into the userspace buffer defined above.
49      buffer_size_kb: 16384
50      drain_period_ms: 250
51
52      # Store certain high-volume "sched" ftrace events in a denser format
53      # (falling back to the default format if not supported by the tracer).
54      compact_sched {
55        enabled: true
56      }
57
58      # Enables symbol name resolution against /proc/kallsyms
59      symbolize_ksyms: true
60
61      # We need to do process tracking to ensure kernel ftrace events targeted at short-lived
62      # threads are associated correctly
63      ftrace_events: "task/task_newtask"
64      ftrace_events: "task/task_rename"
65      ftrace_events: "sched/sched_process_exit"
66      ftrace_events: "sched/sched_process_free"
67
68      # Memory events
69      ftrace_events: "rss_stat"
70      ftrace_events: "ion_heap_shrink"
71      ftrace_events: "ion_heap_grow"
72      ftrace_events: "ion/ion_stat"
73      ftrace_events: "dmabuf_heap/dma_heap_stat"
74      ftrace_events: "oom_score_adj_update"
75      ftrace_events: "gpu_mem/gpu_mem_total"
76
77      # Old (kernel) LMK
78      ftrace_events: "lowmemorykiller/lowmemory_kill"
79
80      atrace_apps: "*"
81
82      atrace_categories: "am"
83      atrace_categories: "binder_driver"
84      atrace_categories: "bionic"
85      atrace_categories: "dalvik"
86      atrace_categories: "input"
87      atrace_categories: "pm"
88      atrace_categories: "res"
89      atrace_categories: "rro"
90      atrace_categories: "ss"
91      atrace_categories: "view"
92      atrace_categories: "wm"
93
94      atrace_categories: "freq"
95      atrace_categories: "sched"
96      atrace_categories: "sync"
97      atrace_categories: "workq"
98
99    }
100  }
101}
102
103data_sources: {
104  config {
105    name: "android.gpu.memory"
106    target_buffer: 0
107  }
108}
109
110data_sources {
111  config {
112    name: "linux.process_stats"
113    target_buffer: 1
114    process_stats_config {
115      proc_stats_poll_ms: 10000
116    }
117  }
118}
119
120data_sources {
121  config {
122    name: "linux.sys_stats"
123    target_buffer: 1
124    sys_stats_config {
125      meminfo_period_ms: 1000
126      meminfo_counters: MEMINFO_MEM_TOTAL
127      meminfo_counters: MEMINFO_MEM_FREE
128      meminfo_counters: MEMINFO_MEM_AVAILABLE
129      meminfo_counters: MEMINFO_BUFFERS
130      meminfo_counters: MEMINFO_CACHED
131      meminfo_counters: MEMINFO_SWAP_CACHED
132      meminfo_counters: MEMINFO_ACTIVE
133      meminfo_counters: MEMINFO_INACTIVE
134      meminfo_counters: MEMINFO_ACTIVE_ANON
135      meminfo_counters: MEMINFO_INACTIVE_ANON
136      meminfo_counters: MEMINFO_ACTIVE_FILE
137      meminfo_counters: MEMINFO_INACTIVE_FILE
138      meminfo_counters: MEMINFO_UNEVICTABLE
139      meminfo_counters: MEMINFO_SWAP_TOTAL
140      meminfo_counters: MEMINFO_SWAP_FREE
141      meminfo_counters: MEMINFO_DIRTY
142      meminfo_counters: MEMINFO_WRITEBACK
143      meminfo_counters: MEMINFO_ANON_PAGES
144      meminfo_counters: MEMINFO_MAPPED
145      meminfo_counters: MEMINFO_SHMEM
146    }
147  }
148}
149
150data_sources: {
151  config: {
152    name: "android.surfaceflinger.frametimeline"
153  }
154}
155