commit | 3729b1f0d54a88f119facacfacfc506b7fd1523e | [log] [tgz] |
---|---|---|
author | Ryan Savitski <rsavitski@google.com> | Thu Feb 22 16:30:06 2024 +0000 |
committer | Ryan Savitski <rsavitski@google.com> | Thu Feb 22 16:30:06 2024 +0000 |
tree | ce6c07d62c979f2016232de239484c2509de7da4 | |
parent | de1ec22020b84fb2864e7fb59a9459c0aefb9479 [diff] |
ftrace: add drain_buffer_percent option for poll-based ftrace ring buffer reads Firstly, explaining net changes to existing configs that utilise only periodic reads: * removed per-tick-period quotas of number of pages that the reader extracts from the kernel buffers before it starts shedding load. There are situations where this is beneficial, but we're changing our approach here to instead scale with the underlying ftrace bandwidth, even if it increases the cpu% utilisation. Either way, I'm unconvinced these quotas were ever being hit in typical tracing configurations. * small: for read tick period calculations, we now consider only the active data sources (as opposed to all setup ones). * niche: for configs using non-boot ftrace clocks, moved the clock snapshotting closer to the beginning of a read pass. The poll-based reads are enabled in addition to the periodic ReadTick if the config requests them. If all concurrent configs are using poll and none set an explicit drain_period_ms, we'll relax the ReadTick period to 1 second. The tick is still beneficial as it spreads out work more evenly, helps procfs scrape freshness, and is a general fallback in case polling doesn't work as expected. The polling is scoped to individual ftrace instances (highly niche feature for now), but the tick is still global. Code-wise: * config_muxer manages the tracefs/buffer_percent file, picking the smallest value out of active configs. * ftrace_controller manages the polling and callbacks on the per-cpu ring buffer fds. For now the feature is nop'd out on kernels below v6.1 (prior to which the polls returned as soon as a buffer was non-empty), but I'm looking into relaxing it on Android GKI builds that are known to have the fix backported. (Most of the testing has been manual, the mock-based unittests are too brittle for me to want to pile on more at the moment.) Change-Id: Icba56768ded03bb4d725fbb596e965c86195c33c
Perfetto is a production-grade open-source stack for performance instrumentation and trace analysis. It offers services and libraries and for recording system-level and app-level traces, native + java heap profiling, a library for analyzing traces using SQL and a web-based UI to visualize and explore multi-GB traces.
See https://perfetto.dev/docs or the /docs/ directory for documentation.