Profiling Android Applications with Nanoscope

    Abstract

    User-level tooling support for profiling Java applications executing on modern JVMs for desktop and server is quite mature – from Open JDK’s Java Flight Recorder enabling low-overhead CPU and heap profiling, through third-party async profilers (e.g. async-profiler, honest-profiler), to Open JDK’s support for low-overhead tracking of allocation call sites.

    On the other hand, despite architectural similarities between language execution environments, tooling support for analyzing performance of Java code on Android lags significantly behind. Arguably the most popular, but also virtually the only, tool in this category is Android Profiler which provides process-level information about CPU, Java heap and network activities. It also provides support for method tracing and sampling. However, the former exhibits high overhead and the latter, while providing better performance, but sacrifices precision. Information provided by Android Profiler can be augmented with data collected by other tools, particularly systrace which collects data at the operating system level. Unsurprisingly, third-party tools have also started emerging recently, such as Facebook’s Profilo framework. However, using these additional tools requires working with multiple tool-chains, may require a certain amount of manual effort (e.g., building application in a special way, inserting profiling framework API calls into the application), and it is often non-trivial to infer interesting information from the data being collected (e.g. because only part of the tooling framework is publicly available).

    In this paper we describe our work on Nanoscope, an open source extensible tool for Android that not only works on unmodified applications and provides precise method traces with low overhead, but also aims to present programmers with selected relevant information within the same framework to help them develop an intuition behind a concrete non-performant application behavior. The tradeoff here is that Nanoscope requires a custom Android build as it relies on additional support from ART. In the paper, we will describe Nanoscope’s design and implementation, present examples of performance-related information that can be obtained from the tool, and discuss Nanoscope-related overheads.

    Authors

    Lun Liu, Leland Takamine, Adam Welc

    Link

    Splash 2018

    Full Paper

    ‘Profiling Android Applications with Nanoscope’ (PDF)

    Programming Systems Team

    Comments
    Previous articleJoint Mapping and Calibration via Differentiable Sensor Fusion
    Next articleFaster Neural Networks Straight from JPEG
    Leland Takamine
    Leland is a senior software engineer on Uber's Android Development team.
    Adam Welc
    Adam Welc is a Senior Engineer at Uber's Programming Systems Team, where he currently works on application analysis and performance tuning as well as on developing tools to improve developers' experience. More generally, his professional interests are in the area of programming language design, implementation, and tooling with specific focus on run-time system and compiler optimizations. Adam has over ten years of experience working with with different types of virtual machines (ART, HotSpot JVM, AVM, ORP JVM, Jikes RVM, J9 JVM), compilers (GreenMarl, ASC, StarJIT), and other large and complicated frameworks and systems (ProGuard, D8, ReDex, Truffle framework, STM runtime for Intel's C/C++ compiler). He holds a PhD in Computer Science from Purdue University.