diff options
author | Vinod Benure <vinodbenure@google.com> | 2024-03-20 12:00:31 -0700 |
---|---|---|
committer | Vinod Benure <vinodbenure@google.com> | 2024-03-21 11:31:06 -0700 |
commit | cdf63f17ad665a2e7d0fb8da53fa2f1c36e9f1a1 (patch) | |
tree | e8af371cf427bef961f001915f5070b991bd34cd | |
parent | bb22315c66bde2fcf36ce431ee577d753f53ab19 (diff) | |
download | tools-cdf63f17ad665a2e7d0fb8da53fa2f1c36e9f1a1.tar.gz |
Add power trace config
Bug: 330554564
Test: Local
Change-Id: I5dc29cfec2c9d59ebe50b8d75effbbb59474b74c
-rw-r--r-- | linux-x86_64/perfetto/Android.bp | 27 | ||||
-rw-r--r-- | linux-x86_64/perfetto/configs/trace_config_power.textproto | 155 |
2 files changed, 170 insertions, 12 deletions
diff --git a/linux-x86_64/perfetto/Android.bp b/linux-x86_64/perfetto/Android.bp index ef42303a6..702ad65cc 100644 --- a/linux-x86_64/perfetto/Android.bp +++ b/linux-x86_64/perfetto/Android.bp @@ -11,20 +11,23 @@ package { } cc_prebuilt_binary { - name: "perfetto_trace_processor_shell_prebuilt", - srcs: ["trace_processor_shell"], - host_supported: true, - device_supported: false, + name: "perfetto_trace_processor_shell_prebuilt", + srcs: ["trace_processor_shell"], + host_supported: true, + device_supported: false, } filegroup { name: "perfetto_artifacts", - srcs: ["trace_processor_shell", - "configs/trace_config_detailed.textproto", - "configs/trace_config_detailed_heapdump.textproto", - "configs/trace_config_post_boot.textproto", - "configs/trace_config_boot_time.textproto", - "configs/trace_config_boot_time_stop.textproto", - "configs/long_trace_config.textproto", - "configs/long_trace_binder_config.textproto"], + srcs: [ + "trace_processor_shell", + "configs/trace_config_detailed.textproto", + "configs/trace_config_detailed_heapdump.textproto", + "configs/trace_config_post_boot.textproto", + "configs/trace_config_power.textproto", + "configs/trace_config_boot_time.textproto", + "configs/trace_config_boot_time_stop.textproto", + "configs/long_trace_config.textproto", + "configs/long_trace_binder_config.textproto", + ], } diff --git a/linux-x86_64/perfetto/configs/trace_config_power.textproto b/linux-x86_64/perfetto/configs/trace_config_power.textproto new file mode 100644 index 000000000..186c53e76 --- /dev/null +++ b/linux-x86_64/perfetto/configs/trace_config_power.textproto @@ -0,0 +1,155 @@ +# Copyright (C) 2024 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# proto-message: TraceConfig +incremental_state_config { + clear_period_ms: 10000 +} + +# Enable periodic flushing of the trace buffer into the output file. +write_into_file: true + +# Writes the userspace buffer into the file every 1s. +file_write_period_ms: 1000 + +# See b/126487238 - we need to guarantee ordering of events. +flush_period_ms: 10000 + +# The trace buffers needs to be big enough to hold |file_write_period_ms| of +# trace data. The trace buffer sizing depends on the number of trace categories +# enabled and the device activity. + +# RSS events +buffers { + size_kb: 32768 + fill_policy: RING_BUFFER +} + +# process stats +buffers { + size_kb: 4096 + fill_policy: RING_BUFFER +} + +# package list +buffers { + size_kb: 512 + fill_policy: RING_BUFFER +} + +data_sources { + config { + name: "android.power" + target_buffer: 0 + android_power_config { + battery_poll_ms: 500 + + battery_counters: BATTERY_COUNTER_CHARGE + battery_counters: BATTERY_COUNTER_CAPACITY_PERCENT + battery_counters: BATTERY_COUNTER_CURRENT + battery_counters: BATTERY_COUNTER_CURRENT_AVG + + collect_power_rails: true + } + } +} + +data_sources { + config { + name: "linux.ftrace" + target_buffer: 0 + ftrace_config { + # These parameters affect only the kernel trace buffer size and how + # frequently it gets moved into the userspace buffer defined above. + buffer_size_kb: 16384 + drain_period_ms: 250 + + # Store certain high-volume "sched" ftrace events in a denser format + # (falling back to the default format if not supported by the tracer). + compact_sched { + enabled: true + } + + symbolize_ksyms: true + + # We need to do process tracking to ensure kernel ftrace events targeted at short-lived + # threads are associated correctly + ftrace_events: "sched/sched_process_exit" + ftrace_events: "sched/sched_process_free" + + ftrace_events: "power/suspend_resume" + ftrace_events: "power/cpu_frequency" + ftrace_events: "power/cpu_idle" + + ftrace_events: "power/wakeup_source_activate" + ftrace_events: "power/wakeup_source_deactivate" + + # Old (kernel) LMK + ftrace_events: "lowmemorykiller/lowmemory_kill" + + # New (userspace) LMK + atrace_apps: "*" + atrace_categories: "am" + atrace_categories: "wm" + atrace_categories: "ss" + atrace_categories: "sched" + atrace_categories: "freq" + atrace_categories: "idle" + atrace_categories: "gfx" + atrace_categories: "view" + atrace_categories: "hal" + atrace_categories: "aidl" + atrace_categories: "binder_driver" + atrace_categories: "sync" + atrace_categories: "irq" + atrace_categories: "workq" + atrace_categories: "power" + atrace_categories: "network" + } + } +} + +data_sources: { + config { + name: "android.system_property" + target_buffer: 0 + android_system_property_config { + property_name: "debug.tracing.battery_stats.data_conn" + property_name: "debug.tracing.battery_stats.mobile_radio" + property_name: "debug.tracing.battery_stats.phone_scanning" + property_name: "debug.tracing.battery_stats.phone_signal_strength" + property_name: "debug.tracing.battery_stats.wifi" + property_name: "debug.tracing.battery_stats.wifi_radio" + property_name: "debug.tracing.battery_stats.wifi_scan" + property_name: "debug.tracing.battery_stats.wifi_signal_strength" + } + } +} + +data_sources { + config { + name: "linux.process_stats" + target_buffer: 1 + process_stats_config { + scan_all_processes_on_start: true + } + } +} + +data_sources { + config { + name: "android.packages_list" + target_buffer: 2 + } +} |