Instruments

RSS for tag

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

Instruments Documentation

Post

Replies

Boosts

Views

Activity

Instruments - No PMI Record Found
Instruments CPU Profiler failed to start the profilable app (get-task-allow is set to true) with error "No PMI Record Found". Device is iPhone 13 Pro currently running iOS 17.0.3. Tried to profile in instruments shipped with Xcode 14.3.1, Xcode 15.0.1 and Xcode 15.1 Beta, same issue across. If it helps, I was able to successfully profile on iPhone X running iOS f16.7 using Xcode 14.2 instruments.
3
1
1.5k
Oct ’23
Leaks Instrument Does Not Find Leaks on Sonoma
The Leaks Instrument in Sonoma never reports any leaks. This is happening on Sonoma only. Instruments on Ventura reports the leaks appropriately. This feels like a bug in Instruments on Sonoma, but I wanted to check in here to see if maybe I'm doing something wrong. Steps to dupe: On a Sonoma machine, create a Mac OS Application Project in Xcode, using xibs and Objective-C. In the app delegate create a method: - (IBAction)leak:(id)sender { NSLog(@"LEAK!"); int* ptr = ( int* )malloc( 5 * sizeof(int) ); } In the MainMenu.xib, create a button in the window and connect it to the leak action. Build and Run. Launch Instruments and choose the Leaks tool. Attach Instruments to your running application and start recording. Click the Leak button in your app any number of times. Stop recording in Instruments. RESULT: Instruments reports no leaks found. WORKAROUND: To see leaks on Sonoma I can do so in the Terminal using leaks with these steps: Launch Terminal export MallocStackLogging=1 leaks -atExit -- /Users/zack/Library/Developer/Xcode/DerivedData/Leaker-fkhkydpehobufngumikoydtpyxsc/Build/Products/Debug/Leaker.app/Contents/MacOS/Leaker NOTE: this leaks command takes the path to the actual built binary. The app will launch. Click the Leak button any number of times. Quit the app. For example, clicking the Leak button 7 times, the leaks tool reports: STACK OF 7 INSTANCES OF 'ROOT LEAK: <malloc in -[AppDelegate leak:]>': 19 dyld 0x183e39058 start + 2224 18 ZJ.Leaker 0x10207d12c main + 60 main.m:14 17 com.apple.AppKit 0x187a33708 NSApplicationMain + 880 16 com.apple.AppKit 0x187a5c460 -[NSApplication run] + 512 15 com.apple.AppKit 0x187e8f1bc -[NSApplication _handleEvent:] + 60 14 com.apple.AppKit 0x18823bc08 -[NSApplication(NSEventRouting) sendEvent:] + 1556 13 com.apple.AppKit 0x187b9482c -[NSWindow(NSEventRouting) sendEvent:] + 284 12 com.apple.AppKit 0x187b94b6c -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 364 11 com.apple.AppKit 0x187c093b4 -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] + 3472 10 com.apple.AppKit 0x187c0a5e8 -[NSControl mouseDown:] + 448 9 com.apple.AppKit 0x187c0b114 -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 488 8 com.apple.AppKit 0x187c0b25c -[NSCell trackMouse:inRect:ofView:untilMouseUp:] + 144 7 com.apple.AppKit 0x187c0b850 NSControlTrackMouse + 1480 6 com.apple.AppKit 0x187c0e220 -[NSButtonCell _sendActionFrom:] + 88 5 com.apple.AppKit 0x187c0e2fc -[NSCell _sendActionFrom:] + 204 4 com.apple.AppKit 0x187c0e3d4 __26-[NSCell _sendActionFrom:]_block_invoke + 100 3 com.apple.AppKit 0x187c0e490 -[NSControl sendAction:to:] + 72 2 com.apple.AppKit 0x187c0e68c -[NSApplication(NSResponder) sendAction:to:from:] + 460 1 ZJ.Leaker 0x10207d2b8 -[AppDelegate leak:] + 88 AppDelegate.m:34 0 libsystem_malloc.dylib 0x183ff4ad0 _malloc_zone_malloc_instrumented_or_legacy + 276 ==== 7 (224 bytes) << TOTAL >> 1 (32 bytes) ROOT LEAK: <malloc in -[AppDelegate leak:] 0x600000ca5bc0> [32] 1 (32 bytes) ROOT LEAK: <malloc in -[AppDelegate leak:] 0x600000ca6e80> [32] 1 (32 bytes) ROOT LEAK: <malloc in -[AppDelegate leak:] 0x600000ca74a0> [32] 1 (32 bytes) ROOT LEAK: <malloc in -[AppDelegate leak:] 0x600000cb8520> [32] 1 (32 bytes) ROOT LEAK: <malloc in -[AppDelegate leak:] 0x600000cc0840> [32] 1 (32 bytes) ROOT LEAK: <malloc in -[AppDelegate leak:] 0x600000cc09a0> [32] 1 (32 bytes) ROOT LEAK: <malloc in -[AppDelegate leak:] 0x600000cc7a00> [32]
2
0
687
Oct ’23
Background Asset. Failed because the app and extension do not share any application groups.
Hi everyone. We try to implement background assets to our project. And and encountered this problem. When try to send background event from terminal xcrun backgroundassets-debug --simulate --app-periodic-check -d [DEVICE_ID] -b [APP_BUNDLE_IDENTIFIER] In console.app in device log we saw this type of logs Text version :) Resetting extension runtime for: [APP_BUNDLE_IDENTIFIER] Application info for ([APP_BUNDLE_IDENTIFIER]) is being updated based on URL:(N/A) Failed to find represented extension point. (ID:[APP_BUNDLE_IDENTIFIER] Event (7) dropped for client ([APP_BUNDLE_IDENTIFIER]) failed because the app and extension do not share any application groups. Tried on Xcode 15, iOS 17.0.2, MacOS 14 App Info.plist (in yml style) ---- part <key>app-group</key> <string>group.com.*******.MobileFWDemo</string> <key>app-group-asset</key> <string>group.com.*******.BackgroundAsset.Container</string> <key>BAInitialDownloadRestrictions</key> <dict> <key>BADownloadAllowance</key> <integer>1610612736</integer> <key>BADownloadDomainAllowList</key> <array> <string>devstreaming-cdn.apple.com</string> <string>developer.apple.com</string> <string>http://example.com/</string> <string>https://www.learningcontainer.com/</string> <string>https://file-examples.com</string> </array> <key>BAEssentialDownloadAllowance</key> <integer>1073741824</integer> </dict> <key>BAManifestURL</key> <string>https://developer.apple.com/sample-code/background-assets/SessionsManifest.plist</string> <key>BAMaxInstallSize</key> <string>1610612736</string> ----- part In BAExtension info.plist <dict> <key>app-group</key> <string>group.com.*******.MobileFWDemo</string> <key>app-group-asset</key> <string>group.com.*******.BackgroundAsset.Container</string> <key>EXAppExtensionAttributes</key> <dict> <key>EXExtensionPointIdentifier</key> <string>com.apple.background-asset-downloader-extension</string> <key>EXPrincipalClass</key> <string>BackgroundDownloadHandler</string> </dict> </dict> App Entitlement <dict> <key>aps-environment</key> <string>development</string> <key>com.apple.developer.applesignin</key> <array> <string>Default</string> </array> <key>com.apple.developer.associated-domains</key> <array> <string>applinks:******.onelink.me</string> </array> <key>com.apple.developer.game-center</key> <true/> <key>com.apple.security.application-groups</key> <array> <string>group.com.******.BackgroundAsset.Container</string> <string>group.com.******.MobileFWDemo</string> </array> </dict> Extension Entitlement <dict> <key>com.apple.security.application-groups</key> <array> <string>group.com.*******.MobileFWDemo</string> <string>group.com.*******.BackgroundAsset.Container</string> </array> </dict> Method - not called - (NSSet<BADownload *> *)downloadsForRequest:(BAContentRequest)contentRequest manifestURL:(NSURL *)manifestURL extensionInfo:(BAAppExtensionInfo *)extensionInfo After add Background Asset Extension a new warning appeared in the logs: Execution of the command buffer was aborted due to an error during execution. Insufficient Permission (to submit GPU work from background) (00000006:kIOGPUCommandBufferCallbackErrorBackgroundExecutionNotPermitted) Maybe it wiil be connected to my problem. Could someone help ?)
1
1
679
Sep ’23
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
6
7.2k
Sep ’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
531
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
990
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
470
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
1.9k
Jun ’22