一句话:BTrace 将全局缓冲区划分为可动态分配给最繁忙核心的块,兼顾低开销与长连续追踪,提升移动端追踪能力。
随着智能手机系统日益复杂,高效追踪对提升系统稳定性和用户体验至关重要。然而现有追踪工具在手机场景下表现不佳:其分布式设计(每核或每线程缓冲区)虽优先考虑性能,却以较高概率丢失关键线索,这在此前的服务器等场景中尚可容忍,但在手机上严重削弱了追踪的实用性。为此,作者提出 BTrace:它将一个全局缓冲区划分为多个块,并动态分配给需求最大的核心,从而兼得每核缓冲区的性能优势与保持更长时间连续追踪的能力,同时妥善处理核心超订(core oversubscription)与缓冲区调整等智能手机特有需求。BTrace 已在生产环境中部署,相比当前表现最好的追踪器 Linux ftrace,平均可获得 2 倍长的连续追踪,性能提升 20%;借助 BTrace,作者成功定位了多个依赖长时段追踪、现有追踪器难以发现的缺陷。
With the growing complexity of smartphone systems, effective tracing becomes vital for enhancing their stability and optimizing the user experience. Unfortunately, existing tracing tools are inefficient in smartphone scenarios. Their distributed designs (with either per-core or per-thread buffers) prioritize performance but lead to missing crucial clues with high probability. While these problems can be overlooked in previous scenarios (e.g., servers), they drastically limit the usefulness of tracing on smartphones. To enable efficient tracing on smartphones, we propose BTrace: a tracing tool that combines the performance benefits of per-core buffers with the capability of retaining longer continuous traces by partitioning a global buffer into multiple blocks, which are dynamically assigned to the most demanding cores. BTrace further gracefully handles unique requirements of modern smartphones, e.g., core oversubscription and resizing. BTrace has been deployed in production, recording an average of 2x continuous traces compared to the current best-performing tracer (Linux ftrace) and improving performance by 20%. Using BTrace, we successfully identified numerous bugs that require traces of long duration and are challenging to locate with existing tracers.
@inproceedings{WangLCLBFJH025,
title = {Enabling Efficient Mobile Tracing with BTrace},
author = {Jiawei Wang and Nian Liu and Arnau Casadevall-Saiz and Yutao Liu and Diogo Behrens and Ming Fu and Ning Jia and Hermann Härtig and Haibo Chen},
booktitle = {ASPLOS},
year = {2025},
doi = {10.1145/3676641.3715994}
}