Safe stream-based programming with refinement types


    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.


    Benno Stein, Lazaro Clapp, Manu Sridharan, Bor-Yuh Evan Chang


    ACM DL

    Full Paper

    ‘Safe stream-based programming with refinement types’ (PDF)

    Programming Systems Team

    Previous articleLabor Market Equilibration: Evidence from Uber
    Next articleEnd-to-End Deep Structured Models for Drawing Crosswalks
    Lazaro Clapp
    Lazaro Clapp is a senior engineer on Uber's Programming Systems team. His current focus is to improve application reliability by preventing broad categories of bugs using fast type-system based tools that run on every local compilation, while minimizing developer annotation burden. His research interests more broadly include static and dynamic analysis, modeling of third-party code behavior, as well as automated test generation and UI exploration for mobile applications. He holds a Ph.D. in Computer Science from Stanford University.