1# Copyright (C) 2023 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# Based on trace_config_detailed.textproto 16# proto-message: TraceConfig 17 18# Enable periodic flushing of the trace buffer into the output file. 19write_into_file: true 20 21# Writes the userspace buffer into the file every 1s. 22file_write_period_ms: 1000 23 24# See b/126487238 - we need to guarantee ordering of events. 25flush_period_ms: 10000 26 27# The trace buffers needs to be big enough to hold |file_write_period_ms| of 28# trace data. The trace buffer sizing depends on the number of trace categories 29# enabled and the device activity. 30 31# RSS events 32buffers { 33 size_kb: 32768 34 fill_policy: RING_BUFFER 35} 36 37# procfs polling 38buffers { 39 size_kb: 8192 40 fill_policy: RING_BUFFER 41} 42 43# perf memory 44buffers { 45 size_kb: 65536 46 fill_policy: RING_BUFFER 47} 48 49data_sources { 50 config { 51 name: "linux.ftrace" 52 target_buffer: 0 53 ftrace_config { 54 throttle_rss_stat: true 55 # These parameters affect only the kernel trace buffer size and how 56 # frequently it gets moved into the userspace buffer defined above. 57 buffer_size_kb: 16384 58 drain_period_ms: 250 59 60 # Store certain high-volume "sched" ftrace events in a denser format 61 # (falling back to the default format if not supported by the tracer). 62 compact_sched { 63 enabled: true 64 } 65 66 # Enables symbol name resolution against /proc/kallsyms 67 symbolize_ksyms: true 68 # Parse kallsyms before acknowledging that the ftrace data source has been started. In 69 # combination with "perfetto --background-wait" as the consumer, it lets us defer the 70 # test we're tracing until after the cpu has quieted down from the cpu-bound kallsyms parsing. 71 initialize_ksyms_synchronously_for_testing: true 72 # Avoid re-parsing kallsyms on every test run, as it takes 200-500ms per run. See b/239951079 73 ksyms_mem_policy: KSYMS_RETAIN 74 75 # We need to do process tracking to ensure kernel ftrace events targeted at short-lived 76 # threads are associated correctly 77 ftrace_events: "task/task_newtask" 78 ftrace_events: "task/task_rename" 79 ftrace_events: "sched/sched_process_exit" 80 ftrace_events: "sched/sched_process_free" 81 82 # Memory events 83 ftrace_events: "rss_stat" 84 ftrace_events: "ion_heap_shrink" 85 ftrace_events: "ion_heap_grow" 86 ftrace_events: "ion/ion_stat" 87 ftrace_events: "dmabuf_heap/dma_heap_stat" 88 ftrace_events: "oom_score_adj_update" 89 ftrace_events: "gpu_mem/gpu_mem_total" 90 ftrace_events: "fastrpc/fastrpc_dma_stat" 91 92 # Power events 93 ftrace_events: "power/suspend_resume" 94 ftrace_events: "power/cpu_frequency" 95 ftrace_events: "power/cpu_idle" 96 ftrace_events: "power/gpu_frequency" 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: "view" 113 atrace_categories: "webview" 114 atrace_categories: "input" 115 atrace_categories: "hal" 116 atrace_categories: "binder_driver" 117 atrace_categories: "sync" 118 atrace_categories: "workq" 119 atrace_categories: "res" 120 atrace_categories: "power" 121 122 } 123 } 124} 125 126data_sources { 127 config { 128 name: "linux.process_stats" 129 target_buffer: 1 130 process_stats_config { 131 proc_stats_poll_ms: 10000 132 } 133 } 134} 135 136data_sources { 137 config { 138 name: "linux.perf" 139 target_buffer: 2 140 perf_event_config { 141 timebase { 142 frequency: 80 143 } 144 callstack_sampling { 145 scope { 146 target_cmdline: "android.tests.enforcepermission.tests" 147 target_cmdline: "android.tests.enforcepermission.service" 148 target_cmdline: "system_server" 149 } 150 kernel_frames: true 151 } 152 } 153 } 154} 155