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

How to debug or ensure single resume calls for continuations at compile time or with tools like Instruments?
When using the continuation API, we're required to call resume exactly once. While withCheckedContinuation helps catch runtime issues during debugging, I'm looking for ways to catch such errors at compile time or through tools like Instruments. Is there any tool or technique that can help enforce or detect this requirement more strictly than runtime checks? Or would creating custom abstractions around Continuation be the only option to ensure safety? Any suggestions or best practices are appreciated.
0
0
48
19h
How to symbolicate kernel callstacks (or what is kernel.release.t6020)?
Hi everyone, (I am running on an M2 MacBook Pro 14 inch with 96 GB of memory) I've been profiling with Instruments to find out why program suddenly goes from full CPU usage (all of my threads active and all cores working) to about 33% CPU usage. An Instruments system trace is showing me a massive performance cliff where I suddenly get taken off the performance cores and only run on efficiency cores. The performance cores are then occupied by "kernel.release.t6020". What is this thing? I have kernel callstacks enabled but I only get the instruction pointer and have no symbols for any of those callstacks. I'm accustomed to Windows development where kernel symbols are available so you can see deeply into the kernel to know why you're spending time there (for example, semaphore wait or thread scheduling). Is there a way for me to get a similar level of information or kernel symbols so I can see what the kernel is doing? Around the time I observe the performance cliff, I also noticed in the narrative view some of the preemptions are done "because thread was balanced off CPU i (P Core) to optimize the system's CPU performance". What does this mean? Have I begun to hit some sort of thermal limit? Here are some example screenshots of what I am seeing in Instruments:
2
0
120
1w
PacketLogger doesn't capture logs for iOS devices.
I'm unable to capture Bluetooth logs via PacketLogger from my iPhone 11 (iOS 18.2) and iPad Pro (iPadOS 17.5.1) with Mac mini M2 macOS 15.2 (24C101). I've installed Bluetooth profile on both devices, restarted multiple times connected to the computer, it shows device as online, however PacketLogger captures nothing at all. For test I've installed profile on macOS and PacketLogger captures everything as it should. I saw some posts here from earlier this year, that people were having similar problems with PacketLogger. Please suggest a solution or confirm that it is a known bug.
3
0
196
3w
How to collect macOS traces on customer machines with symbols for OS libs?
Our customers are large enterprises and we need to be able to collect traces on our customers' endpoints in support cases. Especially critical are performance problems. So far we've instructed our customers to use ktrace: sudo ktrace artrace -p appname --type=profile We would then open this trace in Instruments with the CPU profile and load our own symbols. The problem is, that symbols for system libraries are missing. In one instance we see that all of the high load is coming from a syscall made by libpcap. But all symbols other than our own are missing. How can we collect traces which include those symbols? I tried to use ktrace symbolicate in tests where I recorded a trace and then used ktrace symbolicate to collect system lib symbols, but it fails for most libraries, including libpcap and the syscalls. This is somewhat surprising, because dyld_info -exports /usr/lib/libpcap.A.dylib is able to print the symbols including offsets. So what is the recommended workflow for this scenario? Installing Xcode is of course not an option on a customer machine, especially not in an enterprise scenario.
2
1
205
4w
Identifying memory leaks
I'm having an issue with my swiftui macOS application where it is continually consuming more memory over time and after a couple of hours will grind to a halt. I've watched a few videos now on how to use Xcode Memory Graph and Instruments to identify the source of a leak (I assume it is a leak). These videos all provide very obvious issues as examples but mine seems more elusive and I don't know how to identify which part of my code is the cause of the issue. After running instruments I see the following but the leaked objects are not always consistent: Xcode Memory Graph shows NSSet as the culprit which is shown under CoreFoundation (not my App). I really am a beginner here and because it's not showing me somewhere in my app that I can go and investigate I'm really stuck.
4
0
426
Dec ’24
Not seeing signposts when profiling a unit test (Xcode 16.1)
While I was recently profiling some code from a Swift library, I noticed that XCTest added in signposts for the measurement tests, which I found really helpful to "home in" on the code I wanted to profile digging around in the stack trace. I tried to add my own signposts to provide just a bit of my own markers in there, but while it compiles and profiles equivalently, the signposts just aren't showing up. This is with Xcode 16.1, macOS Sequoia (15.1) and a swift library, using XCTest and profiling within one of the unit tests. Is there something in this sequence that doesn't allow the library to set up signposts and have instruments collect them? The flow I'm using: import os let subsystem = "MyLibrary" class MyClass { let logger: Logger = .init(subsystem: subsystem, category: "fastloop") let signposter: OSSignposter init() { signposter = OSSignposter(logger: logger) } func goFast() { let signpostId = signposter.makeSignpostID() let state = signposter.beginInterval("tick", id: signpostId) // ... do a bunch of work here - all synchronous signposter.endInterval("tick", state) } } Is there something I'm doing incorrectly in using this API, or not enabling to allow those signposts to be collected by the profiler? I do see the signposts that XCTests injects into the system, just not any of the ones I'm creating.
1
0
304
Nov ’24
Cannot run Animation Hitches Instrument
I'm trying to run the Instrument "Animation Hitches", but it fails immediately after starting on the iPhone. This happens on multiple projects, including a brand new project. I get the following errors: Timestamp | Message (Before Run Started) | Unexpected failure: Couriers have returned unexpectedly. (Before Run Started) | Failed to start the recording: Failed starting ktrace session. The issue also happens with the instruments App Launch, but not with any other that I tested. Is this a bug? Using Xcode Version 16.1, Mac Mini M1 Sequoia 15.1. Running project on iPhone 14 Pro iOS 18.1.
2
1
374
Nov ’24
Memory leak issue. Is this a bug or am I doing something wrong?
I've been developing an app for macOS for some time. As I've been approaching the app's final development stages, I decided to try Instruments as I've suspected a memory leak was occurring, since my app's memory usage slowly grows over time. Instruments has found one leak, and I've spent considerable time trying to find the cause. Long story short, I've ended up with just an EmptyView() and Instruments were still showing a leak. I've tried creating a new project with a placeholder "Hello, world!" text, and Instruments were still detecting a leak. Am I doing something wrong here? Maybe I'm not using Instruments correctly? Or is this a bug? My Instruments version is 16.0, macOS Sequoia 15.1.
1
0
256
Nov ’24
Discrepancy between Xcode Memory Report and Xcode Instruments Memory Profiler
Hi Apple Engineers, I am encountering an issue where the memory usage reported by the Xcode memory report and the Xcode Instruments memory profiler are not aligned. Specifically: Xcode Memory Report: After implementing autoreleasepool, URLSession reading a zip file, and moving the task inside DispatchQueue.global().async, the memory usage goes down from 900MB to 450MB, indicating a potential memory leak. Xcode Instruments Memory Profiler: The memory usage goes down from 900MB to 100MB, suggesting that the memory has been properly released and there is no significant memory leak. Could you please help me understand the discrepancy between these two tools and provide guidance on the appropriate way to interpret the memory usage in my application? Which result I should rely on it? I would greatly appreciate your insights and expertise on this matter. Thank you in advance for your assistance.
2
0
300
Nov ’24
Help me to understand sending push to Wallet card
Good afternoon) I am doing one of the test projects to create a PKPASS and a server to update this file on the device, as well as sending PUSH-a. APN service is used with JWT Bearer token. The server is written in Java Springboot. We try to send push notification, pkpass update happens, response from APN 200 OK. But there is no notification, can you please tell me why this is happening? I am also sending you a sample request: curl -v -X POST -H "apns-push-type: alert" -H "apns-id: 5af474c5-a212-42f3-9f99-70a9e587e1e2" -H "apns-topic: pas.example225" -H "apns-expiration: 0" -H "authorization: bearer eyJraWQiOiJGQ0pQVFFMV1ZNIiwiYWxnIjoiRVMyNTYifQ.eyJpc3MiOiI2N0ZGUTY1TEQzIiwiaWF0IjoxNzMwMzY3NzQ4fQ.FGXSLCR6mxkQyi7bNliZKZbVdN3m0xQzFSMUDRFU4aAYIgsgflk5MDEkS9k5riMHp10wpr80b20uq9cuPnoQqw" --data '{"aps":{"alert":{"title":"title","subtitle":"subtitle","body":"body"}}}' \ P.S. I checked JWT on the page: https://icloud.developer.apple.com JWT was built correctly. Thank you for your reply) Translated with DeepL.com (free version)
1
0
312
Nov ’24
Problem with PODS in React Native app
Hello, I develop app using pure React Native which uses pods under the hood uses pods to install dependencies. With some of dependencies I have such error only on a real device(on a simulator everything is ok): "dyld[53510]: Symbol not found: __ZN5swift39swift51override_conformsToSwiftProtocolEPKNS_14TargetMetadataINS_9InProcessEEEPKNS_24TargetProtocolDescriptorIS1_EEN7__swift9__runtime4llvm9StringRefEPFPKNS_35TargetProtocolConformanceDescriptorIS1_EES4_S8_SC_E Referenced from: <4A3492BF-0479-3124-BE58-05BAED71BB20> /private/var/containers/Bundle/Application/0D9FDF5C-BBC9-4060-972B-B2D6FD91E321/appName/Frameworks/pathToPod Expected in: <0549B906-CB15-3735-AA15-FAEB5F687C8B> /private/var/containers/Bundle/Application/0D9FDF5C-BBC9-4060-972B-B2D6FD91E321/appName/Frameworks/pathToPod" Anyone else having the same problem or have any ideas on how to fix this?
0
0
249
Oct ’24
Hi. This “Nearby Devices” control is very limited. I’ll tell you why:
First of all, you cant unlock the device, even if you know the password. Thats one thing. Then, you cant use your main device to navigate trough the device you are controling. You basically can’t do shit to be honest. And Siri is on a bad mood this days. That’s what I have to say to you my friends. Eu amo vocês. beijos. Consertem essa porra. E o “Eye Tracking” está bugado também. Não funciona direito.
0
0
293
Oct ’24
RealityKit Metrics - 3D Render vertex and triangle measurement attributes clarification needed
What exactly is included/calculated in the following metrics within RealityKit Trace - RealityKit Metrics - 3D render attributes: 3D Mesh Triangles Total Triangles Submitted 3D Mesh Vertices Total Vertices Submitted As the second part of the question, what differentiates between: 3D Mesh Triangles vs Total Triangles Submitted 3D Mesh Vertices vs Total Vertices Submitted
0
0
302
Oct ’24
Xcode Instruments: Mismatch Time Profiler results vs. CPU Cycles
Recently, we reworked a crucial part of our app and managed to half the amount of CPU cycles our app requires (according to Xcode Instruments). Nonetheless, when using the Time Profiler component in instruments, it shows that the CPU time spent was either higher or the same (depending on execution). The main time-consuming factor here: libsystem_pthread.dylib - the amount of CPU time spent by this library has doubled from original implementation to reworked implementation. Therefore, I'm having a few questions: How should I interpret this result? How is this even possible if the CPU clock cycles halved? What is the better metric here, the CPU cycles or the time profiler? How can I reduce the impact of that said library? What does that library do and how can I influence its performance? Thanks in advance.
2
0
477
Oct ’24
Official documentation for Instruments?
Can somebody help me find the official documentation for instruments? Google brings you to this forum, then the link at the top of this forum for Instruments documentation brings you to the Xcode page, which links to these Apple developer docs, wherein a search returns nothing for "Instruments". Searching these Xcode docs for "Instruments" returns only this specific use case on analyzing HTTP traffic.
1
0
362
Sep ’24
[Xcode Instruments][Allocations] Chart not showing any data
Hi there, In a project that I am working on, whenever I try running instruments for allocations to see the memory allocations that are happening under the hood, I see the statistics, and the traces updating, however the chart never updates. I have made new projects on the machine, and I have tried different Xcode versions, and they all show the chart just fine. I have tried running the project on other machines with no success. I have double checked the arguments and options on the active schema I am trying to profile with the schema of a new project and they are identical. Here is a picture of how it looks: My questions are as follows: What properties and settings can disable the chart from showing up? What diagnostic steps recommended that I should take? I can not share a reproducible as this is the only project I have with this problem and it is not mine, but please tell me if there is anything else I can provide in order to debug this. All the best Parsa
1
0
386
Sep ’24