Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News ETTrace is an Open-Source Profiler for iOS Aiming to Simplify Performance Optimization

ETTrace is an Open-Source Profiler for iOS Aiming to Simplify Performance Optimization

Recently open-sourced by Emerge Tools, maker of several analysis tools for iOS apps, ETTrace aims to simplify iOS performance profiling by providing intuitive visualizations and straightforward operation.

ETTrace faces the strong competition of Xcode integrated tile profiler, which is the de facto standard solution for performance optimization of iOS apps. Yet, says Emerge Tools engineer Noah Martin, there is a lot to improve in Xcode Time Profiler:

At Emerge I've talked to many engineers working on large apps and the feedback is all the same: Time Profiler can be flaky and slow. Even getting the screenshots for this article I encountered multiple freezes and needed to force-quit. Symbolication is frequently a problem, with traces being generated and only showing addresses but not function names.

On the contrary, he maintains, ETTrace uses a flame graph to make performance bottlenecks easy to identify and provides an easy-to-use command-line tool that will profile the app running locally. Integrating ETTrace into an iOS app is as easy as linking an Objective-C framework and running ettrace at the command line to start and stop profiling when desired. ETTrace also supports the possibility of starting tracing right after the app has launched by setting the Info.plist ETTraceRunAtStartup key to YES.

The framework is able to record the app stack at fixed intervals in a trace file, which is then used to create a visualization. ETTrace only samples the main thread, which is the most time-sensitive part of an iOS app since it has the responsibility to render the UI and should never block. The traces can then uploaded to a public page on Emerge Tools website to create a Flame Graph. You can also diff two traces to compare two different runs of you app and inspect, for example, how a function has improved or regressed.

Another advantage of ETTrace, says Martin, is it can be integrated in a CI pipeline using Emerge Tools Performance Analysis, which provides performance testing features. As a case study, he mentions the work done as Doordash to reduce their iOS app launch time by 60% identifying and removing the bottlenecks associated to Swift protocol conformance testing.

A Flame graph is a way to visualize hierarchical data which makes it easy to identify the most frequently used code paths. Each node, i.e. function, is represented by a frame whose width represent a relative measure of that function's used CPU time.

ETTrace can be downloaded from GitHub.

About the Author

Rate this Article