Instruments

RSS for tag

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

Instruments Documentation

Posts under Instruments tag

89 Posts
Sort by:
Post not yet marked as solved
0 Replies
365 Views
Hey, I'm learning Instruments (Xcode 15.1), and I've encountered a situation for which I haven't found an answer yet. I have an application that loads 12 large images, with the last one taking the most space at 147MB. Instruments on the iOS 15 simulator correctly shows 21 allocations, as in the example from the book, because the last image is split into smaller parts due to poor optimization. But if I run the same example on the iOS 17 simulator, I have even fewer allocations than loaded images. And my question is whether memory allocation for large images is handled differently in iOS 17, or where can I read more about it?
Posted
by miltenkot.
Last updated
.
Post not yet marked as solved
7 Replies
721 Views
Hi! I have a macOS app and it uses around 2x more CPU when it's not launched by the Xcode debugger. This is not about build optimization or anything. I can use the exact same executable, and when I launch it directly by double clicking it in Finder it's uses 2x as much CPU as when I launch the executable through the Debug > Debug Executable... option in Xcode. I did some CPU profiling in Instruments, and there is only one difference I could find so far when the app is launched by the Xcode debugger: There is an entry in the trace named CA::Context::commit_transaction(CA::Transaction*, double, double) | Quartz Core. This entry always appears. But - If, and only if the app is not launched by the Xcode debugger, this entry has a child entry _dispatch_async_f_slow which itself has children that seem to be related to dispatch queue "introspection". It looks kind of like this: v CA::Context::commit_transaction(CA::Transaction*, double, double) v _dispatch_async_f_slow > _dispatch_introspection_queue_item_enqueue_hook _dispatch_trace_item_push_internal dispatch_introspection_queue_item_get_info > _dispatch_introspection_queue_item_enqueue Now this alone doesn't account for the huge difference in CPU usage, but my best theory is that this dispatch queue introspection stuff is done all over the app, and cumulatively leads to the 2x slowdown. I'm running Xcode Version 15.1 (15C65) macOS 14.1.2 (23B92) M1 MacBook Air If you have any clue how to prevent this slowdown when the Xcode debugger is not attached please let me know. Thank you so much!
Posted Last updated
.
Post not yet marked as solved
2 Replies
560 Views
Hi, I am trying to debug an issue when running Profile within Xcode, the binary builds and is signed for release. When I inspect the entitlements file, get-task-allow is always false. I have the following settings that I have seen in the forums work for others but to no avail for our setup. CODE_SIGN_INJECT_BASE_ENTITLEMENTS = YES DEPLOYMENT_POSTPROCESSING = NO Using manual signing setup, provisioning profile and certs are working fine and the binary launches fine on device. However when it comes to pressing record in instruments, I get the following: Permission to debug {app bundle ID} was denied. Recovery Suggestion: The app must be debuggable and signed with 'get-task-allow'. I don't have any other ideas on how to debug/troubleshoot this further. Any help would be great, it's an old project so
Posted
by alancooke.
Last updated
.
Post not yet marked as solved
1 Replies
323 Views
I'm tracing a process, specifically focusing on the Metal device track, which records frames from other processes like Terminal, WindowServer, and sometimes processes that utilize the GPU. I attempted tracing with all apps closed and only Instruments running. However, it also records traces for Instruments. This behavior wasn't present in previous versions of Instruments. Was there a recent change in Instruments/Xcode 15.0.1? I cannot find any relevant information about this in the release notes either. Is there a way to configure Instruments to record only the running process?
Posted
by nullspace.
Last updated
.
Post not yet marked as solved
0 Replies
319 Views
To run UI tests on actual devices, I use the following command to list devices possibly connected to my MAC: xcrun xctrace list devices As you know it shows a list of simulators and actual devices. BUT it also shows actual devices NOT currently connected to my MAC. If they are not currently connected, I do not wish to see them. Once a device is connected, it seems to always show up in the [== Devices ==] list. Even after I disconnect the device it will still show up there. And my software thinks it can run tests on these devices. Does anyone know how to get a correct list of devices which are currently connected to the MAC??
Posted
by dunamase.
Last updated
.
Post not yet marked as solved
1 Replies
313 Views
Hi, I have a few traces where I have samples for kernel (and other processes), yet kernel is always 0 for any CPU Counter selected. There are other processes with an equivalent number of samples where the counter values appear. Perhaps there is a bit of 'art' to get the kernel counters to populate? I am trying to understand the workload from the system perspective (not simply the narrower process perspective), and it would be helpful to have the counter values. I've tried running for extended durations, yet that doesn't seem to adjust the counted events. I've adjusted to include "High Frequency Sampling" to resolve issues with VMware counter collection. Yet.. I need help to enable counter values to appear for kernel. Sam
Posted
by srwarner.
Last updated
.
Post not yet marked as solved
0 Replies
281 Views
➜ ~ xctrace version xctrace version 15.0.1 (15A507) in my project, i use xctrace record command to attach exist app process, it high probability lead app hang, but attach is ok; how can i solve this problem?
Posted
by runhwguo.
Last updated
.
Post not yet marked as solved
1 Replies
513 Views
Hi, I'm using Instrument to profile my metal app, found a metric called display ( average frame time ) shows much longer than what expected. Is this truly the frame time ? Or did I misunderstand something ?
Posted Last updated
.
Post not yet marked as solved
3 Replies
1.2k Views
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.
Posted
by sudhyk.
Last updated
.
Post not yet marked as solved
8 Replies
628 Views
I'm using some CoreML models from C++. I've been trying to profile them using the CoreML Instrument in Instruments. It seems that that only works when I sign my binaries with the get-task-allow entitlement. Is there an easier way? Ideally I'd like to be able to profile a Python program that calls my C++ code and I would rather not re-sign Python.
Posted
by smpanaro.
Last updated
.
Post marked as solved
7 Replies
7.2k Views
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”
Posted
by adrianm.
Last updated
.
Post not yet marked as solved
1 Replies
393 Views
Error info is below. Time Awake Since Boot: 1500 seconds System Integrity Protection: disabled Crashed Thread: 13 Dispatch queue: com.apple.dt.frame.activity Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000009 Exception Codes: 0x0000000000000001, 0x0000000000000009
Posted
by baozhixue.
Last updated
.
Post marked as solved
2 Replies
551 Views
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]
Posted Last updated
.