0

Just like in case of Android we can use Appium APIs to capture performance data like CPU, Memory and network utilization and visualise with any tool. Is there a way to capture similar perfromance data in iOS devices and visualise it with some tool

P.S - I have used Xcode instruments for iOS devices but it is not easy to interpret the data and moreover the .trace data format is incompatible with other visualisation tools.

Ryan M
  • 18,333
  • 31
  • 67
  • 74

1 Answers1

0

As you mentioned, Performance testing for iOS apps is possible with the Instruments, distributed by Apple alongside Xcode. As always with Apple, you have to use it.

This is the exact approach Appium uses: since version 1.8 extends mobile: command interface with iOS app profiling and gets you back Instruments .trace file:

HashMap<String, Object> args = new HashMap<>();
args.put("timeout", 60000);
args.put("pid", "current");
args.put("profileName", "Time Profiler");
driver.executeScript("mobile: startPerfRecord", args);

// perform any actions with Appium in your App

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);

You can read more in details here

To understand better trace log interpreting, you may check the following open source projects like Traced or TraceUtility. This answer is really helpful

dmle
  • 3,498
  • 1
  • 14
  • 22
  • Thanks for the help, I have tried with those Traced/TracedUtility Project but they seem to contain lots of issue which could not be resolved. Any other way you see to parse/read the trace file maybe through Java? – user12838762 May 02 '20 at 11:35
  • I don't know any trace utility in JAVA probably because it is not part of iOS stack. I think those projects are more like Prove of Concept and you have to implement your own parser + ingestion to the reporting tool – dmle May 03 '20 at 14:03