Instruments

RSS for tag

Instruments is a performance-analysis and testing tool for iOS, iPadOS, watchOS, tvOS, and macOS apps.

Posts under Instruments tag

94 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Instruments: why? “Failed to gain authorization”
I have a swift 5.4 package manager project with an executable target I want to profile in Instruments. I Cmd+I to profile which launches instruments. I pick allocations. then push the record button. im asked to authorise and doesn’t matter whether I use fingerprint or password I always get the error: (before run started) Failed to gain authorization any ideas? instruments 12.5 xcode 11.5 swift 5.4 2020 M1 MBP 13”
10
3
7.9k
Oct ’23
CPU Profiling with instruments fails to start
When trying to profile any process with the Instruments CPU Profiler I get this message: (Before run started) No allocated PMI record. Not sure what to do here. I tried other instruments like time profile and that works fine so not sure what to do here... Didn't find any people having similar issues when googling so I'm hoping someone here can help me out. Im using a m1 max 14 inch macbook pro with macOS 12.3 and instruments 13.0 (13A1030d)
25
1
6.8k
Apr ’24
Allocations/Leaks Instrument Error: Required kernel recording resources are in use by another document.
The Leaks instrument is suddenly giving me the error "Required kernel recording resources are in use by another document." I see this has come up with Xcode 12 on iOS, but now it's happening when profiling a Mac application on Monterey 12.3.1 and Xcode 13.3. I get the same behaviour on a debug or release build. The Allocations instrument on its own also gives the same error. The Time Profiler intrument launches without issue. Regardless of the (useless) error, it's possible this is a signing issue, since Intruments is also constantly asking for a password when launching the process. Does anyone have any insight into what is causing this?
6
1
2.7k
Aug ’23
Cannot get CPU profile via xctrace
Hi, I'm a new owner of Apple laptop since I always using PC. I'm an experienced perf user but now I'm happy having my MBP2021 laptop so I need to learn new tools. I found that xctrace is the new way to capture profiles on Apple devices so I've installed one and ran on my app. Unfortunately, I didn't manage to make it work. Here is my script: ❯ xctrace record --template 'CPU Counters' --launch -- ./target/release/deps/flower-b0a05df673ad26db tests::test_run Starting recording with the CPU Counters template. Launching process: flower-b0a05df673ad26db. Ctrl-C to stop the recording Target app exited, ending recording... Recording completed. Saving output file... Output file saved as: Launch_flower-b0a05df673ad26db_2022-05-09_21.02.47_4E6DC3F7.trace. ❯ xctrace import --template 'CPU Counters' --input Launch_flower-b0a05df673ad26db_2022-05-09_21.02.47_4E6DC3F7.trace Import failed with error: Cannot find matching importer for url: Launch_flower-b0a05df673ad26db_2022-05-09_21.02.47_4E6DC3F7.trace/ -- file:///Users/pzixel/Documents/Repos/flower/ I tried to find any information about to how to make it work but failed. I hope I can find some support here.
4
0
2.8k
Aug ’23
Allocations Instrument failed to attach to target process
When trying to use the Allocations Instrument I get the following error when pressing record: Unable to issue sandbox extension for path: /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 15.2.simruntime/Contents/Resources/RuntimeRoot/Developer/Library/PrivateFrameworks/DVTInstrumentsFoundation.framework/liboainject.dylib Longer story: I can not get Xcode to launch a simulator with 15.5 so I downloaded the 15.2 runtime and created a simulator with that. Is there a step I missed downgrading to the older runtime? I'm trying to debug the 15.5 failure separately.
2
0
2.0k
Jul ’23
Tracking down a memory leak
I've discovered that my app has a memory leak, where when I close a window, it disappears from the screen but it (along with all its views, view controllers, and associated objects) actually doesn't get released. Instruments doesn't register it as a leak. It does show a few unidentified malloc leaks, but nowhere near enough to account for a window full of stuff. Xcode's memory graph doesn't show any leaks either, and I've combed through it looking for retain cycles or unwanted captures in blocks. I've fixed a few, but it hasn't been enough to actually get the window released. What other tactics are there for finding this kind of leak? The project is here for anyone feeling adventurous: https://github.com/Uncommon/Xit
3
0
6.1k
Sep ’23
Instruments cannot find binary for disassembly
Since version 14, Instruments cannot find the binary to show disassembly of executable or library. It says: Error - Binary file for selected symbol is expected to be here: /Users/<user>/Library/Developer/Xcode/DerivedData/<project>/Build/Products/Release/<project>. The thing is that the path shown by Instruments is actually the right one, and of course the binary exists in this directory. Am I missing something somewhere ?
3
1
1.7k
Apr ’24
Instruments: what is static AppName.$main() [inlined]
I have a performance issue with a Mac SwiftUI app. Using instruments I see hangs reported. When I zero in on a hang I see that the time profiler reports most of the hang -- in one example 658 out of 687 ms -- being in 'static AppName.$main() [inlined]'. I think that is saying my app is busy, but busy doing what? The "hangs" are related to SwiftUI table processing. User experience is something like this: select an item, see the view changes based upon selection show up a second or two later. The duration of the hang increases with the number of items in the table. I'm testing with 100 ~ 1200 table entries.
10
0
2.2k
Mar ’24
ITMS-90338: Non-public API usage
We are facing the below mentioned error frequently while submitting the different apps in the App Store. When we are uploading the first build, we are receiving the below mentioned error and if we increment the build version, and on re submitting we are not facing the same issue again. Could you please guide us on what caused this issue? Xcode Version: 14.2 Error : ITMS-90338: Non-public API usage - The app contains one or more corrupted binaries. Rebuild the app and resubmit.. If method names in your source code match the private Apple APIs listed above, altering your method names will help prevent this app from being flagged in future submissions. In addition, note that one or more of the above APIs may be located in a static library that was included with your app. If so, they must be removed.
2
0
939
Aug ’23
Specifying recording options in xctrace CLI
Hello, I'm curious to learn if there's a way to specify recording parameters programmatically to xctrace. The docs, (in particular, create-parameter) imply that there's a mechanism for defining parameters and then specifying their values on the command line. From https://help.apple.com/instruments/developer/mac/current/#/dev494862765 : <create-parameter> Element Creates a parameter specific to this instrument. **Parameters show up in the UI and command line as recording options.** However, I only ever see these recording options in the UI. Latest Xcode15 beta 6 xctrace doesn't seem to mention anything else about recording parameters, from what I was able to tell. This is true for both custom instruments (where I defined create-parameter myself), and for 1st-party instruments such as Time Profiler (e.g. high-frequency-sampling). As a workaround I've been able to make custom instruments that import the relevant schemas and mark them as dependencies/required-inputs (then I can set the individual options). Is this the expected workflow for recording options? Am I misreading the docs? Just to clarify -- these parameters DO in fact appear from the UI, but are absent from xctrace . Thank you!
1
0
485
Aug ’23
How to export Stack Trace using xctrace
I am trying to export .trace file data to xml using the following command xctrace export --input report.trace --xpath '/trace-toc/run[@number="1"]/tracks/track[@name="Leaks"]/details/detail[@name="Leaks"]' --output output.xml <?xml version="1.0"?> <trace-query-result> <node xpath='//trace-toc[1]/run[1]/tracks[1]/track[2]/details[1]/detail[1]'><row leaked-object="Swift.StringStorage" size="131072" responsible-frame="_swift_allocObject_" count="1" responsible-library="libswiftCore.dylib" address="0x130018000"/> <row leaked-object="Swift.StringStorage" size="131072" responsible-frame="&lt;Allocated Prior To Attach&gt;" count="1" responsible-library="" address="0x140118000"/> <row leaked-object="MemoryLeaker" size="48" responsible-frame="&lt;Allocated Prior To Attach&gt;" count="1" responsible-library="" address="0x60000152d6e0"/> <row leaked-object="MemoryLeaker" size="48" responsible-frame="_swift_allocObject_" count="1" responsible-library="libswiftCore.dylib" address="0x6000015f56e0"/> <row leaked-object="Swift.StringStorage" size="131072" responsible-frame="_swift_allocObject_" count="1" responsible-library="libswiftCore.dylib" address="0x120028000"/> <row leaked-object="Swift.StringStorage" size="131072" responsible-frame="_swift_allocObject_" count="1" responsible-library="libswiftCore.dylib" address="0x120048000"/> <row leaked-object="Swift.StringStorage" size="131072" responsible-frame="_swift_allocObject_" count="1" responsible-library="libswiftCore.dylib" address="0x130038000"/> <row leaked-object="Swift.StringStorage" size="131072" responsible-frame="_swift_allocObject_" count="1" responsible-library="libswiftCore.dylib" address="0x130058000"/> <row leaked-object="MemoryLeaker" size="48" responsible-frame="_swift_allocObject_" count="1" responsible-library="libswiftCore.dylib" address="0x6000015038d0"/> <row leaked-object="MemoryLeaker" size="48" responsible-frame="_swift_allocObject_" count="1" responsible-library="libswiftCore.dylib" address="0x600001508ea0"/> <row leaked-object="MemoryLeaker" size="48" responsible-frame="_swift_allocObject_" count="1" responsible-library="libswiftCore.dylib" address="0x60000150a4c0"/> <row leaked-object="MemoryLeaker" size="48" responsible-frame="_swift_allocObject_" count="1" responsible-library="libswiftCore.dylib" address="0x60000150cfc0"/> </node></trace-query-result> Data is being converted to xml but without any details of the Stack Trace Is there any documentation that shows how I can include the Stack Trace as well? Does xctrace support any other export format besides XML? Thanks
1
0
1k
Aug ’23
Instruments: could not locate ReferenceCycles event
I've been using Instruments from Xcode 14.3 (MacOS 13.5) on my Intel-based MacBook Pro for a while and starting recently "CPU Profiling" instrument no longer could be configure to trigger sampling on PMI events. I've checked "CPU Counters" instruments, and it could not use ReferenceCycles event neither as a trigger, nor for sampling: I can start recording with such configuration, but it stops immediately with an error related to unavailable event, after that Instruments app hangs. Is it a known issue? Maybe something could be tweaked using, for instance, sysctl to enable ReferenceCycles counter back? I tried rebooting the laptop, but it didn't help.
1
0
546
Aug ’23
Instruments - Swift Concurrency not working
Hello, I am trying to debug Swift Concurrency codes by using Swift Concurrency Instruments. But in our project which has been maintained for a long time, Swift Concurrency Instruments seems not working. Task { print("async code") await someAsyncFunction() } When I run Swift Concurrency Instruments with the above codes in our project, I could check that the print works well by checking stdout/stderr Instruments, but there are no records on Swift Concurrency Instruments. But in the small simple sample project, I checked that Swift Concurrency Instruments works well. Are there any settings that I need to do for the legacy project to debug Swift Concurrency?
10
0
1.3k
Mar ’24
Unable to Run Profile Instruments
I just downloaded Xcode 15 RC and iOS 17 RC on an iPhone Xr. When running the app it seems to run fine however when trying to run in profile mode I get the error: Failed to install embedded profile for com...* : 0xe800801f (Attempted to install a Beta profile without the proper entitlement.) Verify that the Developer App certificate for your account is trusted on your device. Open Settings on the device and navigate to General -> VPN & Device Management, then select your Developer App certificate to trust it. Does anyone have any insight into what the issue may be? There is nothing to select within VPN & Device Management when I navigate there
15
7
7.4k
Jan ’24