Capturing Performance Data for Native iOS Apps

April 07, 2026 · 10 min read · Mobile Testing

HeadSpin Platform
Automated & amp; manual examination make easy through data science insights.
Differentiating capabilities:
  • Extensive end-to-end automation of QA process
  • Comparative analysis of app performance against peers
  • Continuous monitoring of app execution using synthetic data for high availability of apps
  • Easy-to-use developer friendly program
cloudtest go
Affordable Real Device Testing for Emerging Teams
cloudtest go
Affordable Real Device Testing for Digital Enterprises
cloudtest go
The Ultimate Solution for a Powerful Blend of Functional & amp; Performance Testing!
cyol
TEM
New
Centralized roving test execution in cloud
cyol
Enhance Your Accessibility Testing With HeadSpin
cyol
Automate camera-based examination

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

retail

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

Capturing Performance Data for Native iOS AppsCapturing Performance Data for Native iOS Apps

Capturing Performance Data for Native iOS Apps

Published on
April 11, 2018
Updated on
Published on
June 12, 2022
Updated on
 by 
 Jonathan LippsJonathan Lipps
Jonathan Lipps

As mobile app testing becomes more and more ubiquitous, the lines between different kinds of machine-controlled testing can become blurred. For example, performance testing is go an integral part of the ontogeny cycle. And for full reason -- -users of mobile apps have very low tolerance for poorly performing apps. We & # x27; ve already exhibit how it & # x27; s possible to, and we can do something very alike for iOS.

Performance essay for iOS apps involves theInstrumentsusefulness distributed by Apple alongside Xcode. Instruments comes with a number of built-in analyses and measurements. If you open it up, you & # x27; re greeted with a list of these:

instruments

Essentially, these are the various execution measurements it will be possible to initiate expend Appium, so keep an eye on this listing for ideas about what you might want to measure for your app, and make sure to check out Apple & # x27; s docs if you want to cognise more about what each of these do. For our purposes in this newssheet, we & # x27; re travel to choose the & quot; Time Profiler & quot; instrument. But since we & # x27; re using Appium, we don & # x27; t need to tick on anything in the Instruments app itself. Instead, we & # x27; ll head to our codification editor!

Optimize digital experience with the mobile app performance testing capableness of the HeadSpin.!

The way iOS profiling works with Appium is with two commands: one to start the profiling and one to stop it and dump the data out to us for viewing. These dictation are useable as of Appium 1.8, via themobile:command interface. Essentially, it & # x27; s as simple as:

Pro tip: Tools like SUSA can handle this autonomously — upload your app and get results without writing a single test script.

driver.executeScript (`` mobile: startPerfRecord '', args); // here: do some stuff in the app that you want to profile String b64Zip = (String) driver.executeScript (`` mobile: stopPerfRecord '', args); // hither: convert the base64-encoded zip file to existent file data on your scheme

We use themobile: startPerfRecord and mobile: stopPerfRecordcommands to signal to Appium when during our script we & # x27; d like the profiling to occur. There is one wrinkle, yet: for any of this to act, we necessitate to have depart the Appium server with the-- relaxed-securityflag. This is because Instruments can gather data from the scheme as a whole, not just the AUT. (It & # x27; s so a security endangerment to expose potentially sensitive system information to Appium sessions running from a distant client, for instance in the circumstance of a cloud Appium host).

Check out:

There & # x27; s besides another facet of the snip above that I haven & # x27; t yet touched on: what about theargs parameter to these methods? The & quot; start & quot; method conduct an argument object with three fields, for example:


HashMapargs = new HashMap < > (); args.put (`` pid '', `` current ''); args.put (`` profileName '', `` Time Profiler ''); args.put (`` timeout '', 60000);

Here we have:

  1. Specified which process we need to attach to (& quot; current & quot; is a handy shortcut to refer to the AUT, which is plausibly what we & # x27; re concerned in. By nonpaymentallprocesses will be profile if we don & # x27; t stipulate anything).
  2. Specified which form of instrument we want to run (the Time Profiler).
  3. Specified a timeout (in milliseconds) after which the performance trace will quit on its own. These trace file can get pretty Brobdingnagian so this is an crucial parameter to remember.
Also check:

For stopPerfRecord, the alone disceptation we care about isprofileName, which should feature the same value as what we passed in tostartPerfRecord, so Appium know which of potentially multiple traces to stop. The other wrinkle here is the return value ofstopPerfRecord; what & # x27; sb64Zip theorise to imply? Well, what Appium is afford back to you when you kibosh performance recording is actually anInstruments Trace Document, which happens to be a directory under the toughie. Since directory are impossible to direct in draw format, Appium zips up this .tracedirectory and hand it backwards to the client script in base64 encryption. To make use of this data, we have to decrypt it and underprice it into a zipfile on our system, with codification like the chase:

File traceZip = new File (`` /path/to/trace.zip ''); String b64Zip = (String) driver.executeScript (`` mobile: stopPerfRecord '', args); byte [] bytesZip = Base64.getMimeDecoder () .decode (b64Zip); FileOutputStream current = new FileOutputStream (traceZip); stream.write (bytesZip);

At this point, we & # x27; ll have a decent littletrace.zipsitting at the specified emplacement on disc. We can now simply unzip it and double-click it to open the trace file up in the Instruments viewer:

instruments-trace

In this Instruments UI, we can dig through the diverse threads that were active during the profiled portion of our Appium test, and see which routines that thread spent most of its clip in (via the stacktrace snapshots guide by the profiler). This can help us to find CPU-hungry areas of our app, which we might settle to offload to a worker thread to, for instance. There are all variety of condition, and likely avenues of improvement based on the data gleaned from these trace file, but that is outside the scope of this brief tutorial. What & # x27; s important today is that you & # x27; ve figured out how to becharm the data!

Since a common use case might be to profile your app over time, you might consider attaching the zipped suggestion files to your test report in your CI system, so that if a exam fails, you also receive some juicy profile datum that could help in remediating the test. (There & # x27; s really an easy way to post the zip file straight to an asset manager that endorse HTTP uploads; check out theAppium XCUITest performance docsfor more info).

For the interest of showing a full model, the following is a simple examination which lifts the literal app behavior from a different edition of Appium Pro, and simply runs those step a number of times while bracketed by execution recording. The zip file is then written to disk, merely as above, where I can jubilantly open up the story in Instruments.

import io.appium.java_client.MobileBy; import io.appium.java_client.ios.IOSDriver; import java.io.File; meaning java.io.FileOutputStream; import java.net.URL; signification java.util.Base64; significance java.util.HashMap; import org.junit.Assert; significance org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; public stratum Edition012_iOS_Performance {private String APP = `` https: //github.com/cloudgrey-io/the-app/releases/download/v1.3.0/TheApp-v1.3.0.app.zip ''; private File traceZip; private By msgInput = By.xpath (`` //XCUIElementTypeTextField [@ name=\ '' messageInput\ ''] ''); individual By savedMsg = MobileBy.AccessibilityId (`` savedMessage ''); private By saveMsgBtn = MobileBy.AccessibilityId (`` messageSaveBtn ''); private By echoBox = MobileBy.AccessibilityId (`` Echo Box ''); private String TEST_MESSAGE = `` Hello World ''; @ Test public void testAppActivity () throws Exception {// Note: Appium server must have be started with -- relaxed-security DesiredCapabilities capabilities = new DesiredCapabilities (); capabilities.setCapability (`` platformName '', `` iOS ''); capabilities.setCapability (`` platformVersion '', `` 11.3 ''); capabilities.setCapability (`` deviceName '', `` iPhone X ''); capabilities.setCapability (`` app '', APP); IOSDriver driver = new IOSDriver < > (new URL (`` http: //localhost:4723/wd/hub ''), capabilities); traceZip = new File (`` /path/to/trace.zip ''); try {HashMapargs = new HashMap < > (); args.put (`` timeout '', 60000); args.put (`` pid '', `` current ''); args.put (`` profileName '', `` Time Profiler ''); driver.executeScript (`` mobile: startPerfRecord '', args); performActions (driver); performActions (driver); performActions (driver); args = new HashMap < > (); args.put (`` profileName '', `` Time Profiler ''); String b64Zip = (String) driver.executeScript (`` mobile: stopPerfRecord '', args); byte [] bytesZip = Base64.getMimeDecoder () .decode (b64Zip); FileOutputStream stream = new FileOutputStream (traceZip); stream.write (bytesZip);} eventually {driver.quit ();}} public null performActions (IOSDriver driver) {WebDriverWait wait = new WebDriverWait (driver, 10); wait.until (ExpectedConditions.presenceOfElementLocated (echoBox)) .click (); wait.until (ExpectedConditions.presenceOfElementLocated (msgInput)) .sendKeys (TEST_MESSAGE); wait.until (ExpectedConditions.presenceOfElementLocated (saveMsgBtn)) .click (); String savedText = wait.until (ExpectedConditions.presenceOfElementLocated (savedMsg)) .getText (); Assert.assertEquals (savedText, TEST_MESSAGE); driver.navigate () .back ();}}
Author & # x27; s Profile

Jonathan Lipps

LinkedIn
Author & # x27; s Profile

Piali Mazumdar

Lead, Content Marketing, HeadSpin Inc.

Piali is a dynamical and results-driven Content Marketing Specialist with 8+ years of experience in crafting engaging narratives and marketing collateral across diverse industries. She excels in collaborating with cross-functional teams to acquire innovative content strategies and deliver compelling, reliable, and impactful content that resonates with target audiences and enhances brand authenticity.

LinkedIn

Capturing Performance Data for Native iOS Apps

4 Parts

regression intelligence blog
-

Regression Intelligence practical guide for advanced users (Part 3)

Coming Soon
Regression Intelligence practical guide for advanced users
-

Regression Intelligence practical guide for advanced users (Part 4)

Coming Soon

Discover how HeadSpin can empower your business with superior testing capabilities

Our Platform enables you to:
accelerate time-to-market
Accelerate time-to-market, gaining a competitive edge
faster development cycles
Boost developer/QA productivity with faster development cycles
automated buil-over-build regression testing
Automate build-over-build regression testing for reproducible issue
gain better visibility into functional & performance issues
Gain best visibility into functional and performance issues
reduce mean time
Reduce mean clip to identify/resolve during examination, QA, and product
evaluate audio, video & qoe
Evaluate audio, video, and content quality of experience (QoE) effortlessly
The trusted choice for global enterprises
Adobe
Hargreaves Lansdown
Truecaller
Crazylabs
Nedbank
Numeracle
Veryon
Close

Discover how HeadSpin can empower your concern with superior testing capabilities

Our Platform enables you to:
accelerate time-to-market
Accelerate time-to-market, win a private-enterprise edge
faster development cycles
Boost developer/QA productiveness with faster development round
automated buil-over-build regression testing
Automate build-over-build regression prove for logical results
gain better visibility into functional & performance issues
Gain best visibleness into functional and performance topic
reduce mean time
Reduce base clip to identify/resolve during test, QA, and product
evaluate audio, video & qoe
Evaluate sound, video, and content quality of experience (QoE) effortlessly
The trusted choice for global go-ahead
Close

Discover how HeadSpin can empower your business with superior testing capabilities

Our Platform enables you to:
accelerate time-to-market
Accelerate time-to-market, gaining a competitive edge
faster development cycles
Boost developer/QA productiveness with faster ontogeny cycles
automated buil-over-build regression testing
Automate build-over-build regression testing for coherent answer
gain better visibility into functional & performance issues
Gain better visibleness into functional and performance issue
reduce mean time
Reduce meanspirited time to identify/resolve during trial, QA, and production
evaluate audio, video & qoe
Evaluate audio, picture, and content lineament of experience (QoE) effortlessly
The sure choice for planetary enterprises
Close

Connet Now

Wipro LogoVMLYR Logo
Close
Book a Meeting
Products
footer down arrow
Solutions
footer down arrow
Industries
footer down arrow
Features
footer down arrow
Support
footer down arrow
Resource Center
footer down arrow
Why Choose HeadSpin?
footer down arrow
Copyright © 2026 HeadSpin, Inc. All Rights Reserved.

Automate This With SUSA

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed.

Try SUSA Free

Test Your App Autonomously

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.

Try SUSA Free