I’ve been following AppiumPro’s tutorial for mobile performance testing (found here : Appium Pro: Capturing Performance Data for Native iOS Apps) and while the “Time Profiler” argument worked great I also need to get the “Leaks” from instruments in my runs.
While running the code with “Leaks” I either get a timeout error or an ENOENT error pointing to some kind of .trace file that obviously does not exist.
Is it even possible to use “Leaks” with in startPerfRecord and stopPerfRecord? Is there some extra step I need to make in order to be able to run it like this?
How could anyone answer this question when you don’t provide even basic information about your problem. By that I mean you don’t give the version of Appium, iOS, Xcode. You don’t provide a log with the error, you don’t provide the code that you are using. If you just want to vent, I get it, but if you want your problem solved you need to help us to help you.
Here is an excellent resource on how to ask a good question:
Again, I get your frustration. This is an advanced topic. People here would like to help you, can you help them to help you?
Possibly file is too large?
1 Try instead upload it to some server instead as mentioned in document for stopPerfRecord command.
2 try to reduce timeout with startPerfRecord to get smaller file
PS And your Appium component versions are also important. Better use latest XCUItest driver with latest xCode…
I’m using the following setup:
Appium version: v2.10.3
Ios version of the mobile device: 17.2.1
Xcode version: 16.2
xcuitest version: 7.26.4
The error I’ve found after posting the question is the following:
[f0d5e1cd][Leaks@00008110] [xctrace] Run issues were detected (trace is still ready to be viewed):
[f0d5e1cd][Leaks@00008110] [xctrace] * [Error] Failed to attach to target process
[f0d5e1cd][Leaks@00008110] [xctrace]
[f0d5e1cd][Leaks@00008110] [xctrace] * [Error] Instruments could not acquire the necessary privileges to profile the target application.
[f0d5e1cd][Leaks@00008110] [xctrace]
[f0d5e1cd][Leaks@00008110] [xctrace] * [Error] An error occurred trying to capture Leaks data.
[f0d5e1cd][Leaks@00008110] [xctrace]
[f0d5e1cd][Leaks@00008110] [xctrace] * [Error] Unable to acquire required task port (5413:0)
[f0d5e1cd][Leaks@00008110] [xctrace]
Based on this error I started running xctrace command as following:
xctrace record --template ‘Leaks’ --attach 20176 where the attached pid is the current java one that I get every time from Activity monitor.
This command has an interesting behaviour because when it is running with the “Time Profiller” template is works out of the box. Running it with “Leaks” demands a user and a password.
From here on I tried to make the xctrace command to not request password but nothing worked since everything I’ve found on this topic seems to be outdated and it does not longer work in Sonoma.
Sorry for the ambiguity, I was(and still am) confused by the topic. Hope this clarifies what setup I’m using and the context of my issue.
I tried different timeout settings (30000, 60000 and 100000) but it is the same everytime. I did not try uploading it to a remote location but I gave it user and password as stated in the documentation hoping that it would treat my local machine as that but it really did nothing different.
so mykola-mokhnach stated that : “instruments might require root privileges in some cases, for example if you are trying to collect perf data from a particular process on Simulator. This is not supported by Appium, since its process is executed from non-privileged user account.”
but my user has admin privileges and I specified this as a rule in /etc/sudoers:
%admin ALL = (root) NOPASSWD: /Applications/Xcode.app/Contents/Developer/usr/bin/xctrace
I went with this since xctrace is what returns the errors.
Thank you for posting the error. I’m wondering if you can check if the app is signed with “debugging entitlement”. There is some information here about checking that: