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

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.5k
Mar ’22
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.7k
May ’22
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
Run my program on my device IOS16.3 via VScode
I am quite new developer , I am trying to run my project on my Iphone rather than simulator for debug and also for development. I had no issues to run the project via Xcode but when I am trying to run the project via VScode to be able to alter the code in src files I get this error I updated homebrew on my macbook and ran brew install libimobiledevice in VSCode terminal, after that I was successfull of identifying my device UDID, by running idevice_id -l. Of course my device which is iPhone 13Pro was connected to my local drive. However , when I run react-native run-ios --device "name of my phone" I get this error: error Command failed: xcrun instruments -s xcrun: error: sh -c '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -find instruments 2> /dev/null' failed with exit code 17664: (null) (errno=Invalid argument) Here are things that I tried to resolve this error but without success : checked the xcode path, reseted both xcode as well as VScode but nothing seems to work any suggestions ? Thank you for help
1
0
880
Jul ’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
454
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
955
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
518
Aug ’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.0k
Sep ’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
650
Sep ’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
658
Oct ’23
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