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 subtopic

Post

Replies

Boosts

Views

Activity

NSURLSession caused huge memory retain in libnetwork
I am using this code. I have huge number of urlSessions but this caused huge memory retain in libnetwork NSURLSessionConfiguration* _configuration = [NSURLSessionConfiguration defaultSessionConfiguration]; NSURLSession* urlSession = [NSURLSession sessionWithConfiguration:_configuration delegate:_delegate delegateQueue:NSOperationQueue.mainQueue]; NSURLSessionDataTask* dataTask = [urlSession dataTaskWithRequest:request]; [dataTask resume]; how can i avoid this memory retain. I have tried all possible fixes by not using urlCache and all. below is xcode memory retain snippet - please suggest how I can avoid this memory retain?
3
1
1k
Jun ’23
ASAuthorizationAppleIDProvider() hang in async method
I have a bit of a tricky severe hang in my app launch processing code path. Here is the detail: I have a .task modifier from the main ContentView that calls into the signInWithAppleManager.checkUserAuth method, which is marked async. I've tried wrapping the offending line in a Task block to get it off of the main thread, but it still hangs, and is still running on the main thread. Ironically, I found the hang after watching "Analyze Hangs With Instruments" from WWDC 23. However, at the point in the video towards the end where he discusses shared singletons, he mentions resolving a similar issue by making the shared singleton async, and then skips over how he would do it, kind of seemingly presenting a gap in analysis and debugging, while also explaining idle state ... kind of more irony. Thanks in advance! Task { let appleIDProvider = ASAuthorizationAppleIDProvider() Is there anything else that I can do to resolve this? Here is the code: public class SignInWithAppleManager: ObservableObject { @Published public private(set) var userAuthenticationState: AuthState = .undefined public static let shared = SignInWithAppleManager() private init() { } func signOutUser() async { KeychainItem.deleteUserIdentifierFromKeychain() await SignInWithAppleManager.shared.updateUserAuthenticationState(authState: .signedOut) } @MainActor func userAuthenticated() async { self.userAuthenticationState = .signedIn } @MainActor func userSignedOut() async { self.userAuthenticationState = .undefined } func simulateAuthenticated() async -> Bool { return false } public var isAuthenticated: Bool { return self.userAuthenticationState == .signedIn } @MainActor func updateUserAuthenticationState(authState: AuthState) async { debugPrint("Current authstate: \(self.userAuthenticationState) New auth state: \(authState)") self.userAuthenticationState = authState } public func checkUserAuth() async -> AuthState { debugPrint(#function) //completion handler defines authstate if KeychainItem.currentUserIdentifier == "" || KeychainItem.currentUserIdentifier == "simulator" { debugPrint("User identifier is empty string") await updateUserAuthenticationState(authState: .undefined) //userid is not defined in User defaults bc empty, something went wrong } else { await updateUserAuthenticationState(authState: .signedIn) } if await !self.simulateAuthenticated() { // HERE: ‼️ hangs for 2 seconds let appleIDProvider = ASAuthorizationAppleIDProvider() // HERE: ‼️ hangs for 2 seconds do { let credentialState = try await appleIDProvider.credentialState(forUserID: KeychainItem.currentUserIdentifier) switch credentialState { case .authorized: debugPrint("checkUserAuth:authorized") // The Apple ID credential is valid. Show Home UI Here await updateUserAuthenticationState(authState: .signedIn) break case .revoked: debugPrint("checkUserAuth:revoked") // The Apple ID credential is revoked. Show SignIn UI Here. await updateUserAuthenticationState(authState: .undefined) break case .notFound: debugPrint("checkUserAuth:notFound") // No credential was found. Show SignIn UI Here. await updateUserAuthenticationState(authState: .signedOut) break default: debugPrint("checkUserAuth:undefined") await updateUserAuthenticationState(authState: .undefined) break } } catch { // Handle error debugPrint("checkUserAuth:error") debugPrint(error.localizedDescription) await updateUserAuthenticationState(authState: .undefined) } } return self.userAuthenticationState } }
1
1
1.6k
Jun ’23
Prevent CPU frequency scaling when profiling for iOS?
Hi all,I've been digging into Instruments lately to investigate some potential performance wins for my app. I'm really enjoying the level of detail in the System Trace template, and the os_signpost stuff is perfect to get a high-level view of where to focus attention - great job!I'm using the latest Xcode Version 11.4.1 (11E503a) on Catalina, and an iPod Touch 7th Gen on the latest iOS - 13.4 (17E255).I'm measuring the app in a steady state where the workload is pretty constant and low (should be no issue hitting 60FPS rendering) but Xcode's CPU meter is pretty jumpy and it drops a frame every couple of seconds, which then seems to coincide with a reduction of CPU usage shown in Xcode.My suspicion is the device thinks it can maintain the required framerate and use less energy by reducing the CPU frequency. This is not quite true for my app - the main thread is sleeping for a significant period but it is awaiting a result on the run loop before the frame rendering can be completed. I can see why the OS might think downclocking is possible here, but then kick up the frequency again when it sees a frame is dropped.I did however once seem to get the device into a state where it was running at (I assume) full speed - the CPU meter in Xcode stayed steady as a rock at 15% or so (with "other processes" at a similar number). I haven't been able to figure out exactly how I managed that - Instruments was running a windowed tracing session and I app switched away and back to the app, but that method doesn't seem to work every time.So the Instruments-related questions arising from this:1) Is there a way to record and visualize the CPU frequency scaling in Instruments? If the frequency of the CPU is changing and unknown, then the timings coming out of Instruments are not really telling the whole story.2) Is there an officially supported method to prevent CPU frequency scaling whilst Instruments is recording data?Thanks for any help!Simon
3
1
3.1k
Jun ’23
stdout/stderr in Instruments does not show output
I'm using Instruments to profile a C program that prints to stdout via printf but the program output does not appear in the Detail Area of the stdout/stderr instrument I added. The program is launched by Instruments itself when I click the Record button and it appears to run correctly – I just can't see the stdout output. I'm using Version 14.3.1 (14E300c) of Instruments on a MacBook Pro 16" (2019) running macOS 13.4 (22F66).
1
0
1.4k
Jun ’23
Cache-related CPU Counters in macOS Instruments stop increasing after a few seconds or don't show any measurements at all
I'm trying to learn about profiling by tracking the events L1D.REPLACEMENT, MEM_LOAD_RETIRED.L2_MISS, and MEM_LOAD_RETIRED.L3_MISS using the CPU Counters instrument in Instruments 14.3.1 (14E300c) on my MacBook Pro 16" (2019) with the Intel Core i9-9980HK, running macOS 13.4 (22F66). In this run, the counters do show some values but they don't change after the first few seconds of the program even though the program ran much longer. In other runs, the Detail Area for the CPU Counters instruments doesn't get populated at all. What am I doing wrong here and how can I get this to work? Thank you for any advice.
1
0
1.1k
Jun ’23
Memory-mapped files in Allocations instrument
Dear Experts, Where do memory-mapped files appear in the Allocations instrument, if at all? In the screenshot below, the green "all anonymous VM" graph is almost completely explained by the purple "IO Accelerator" graph (GPU buffers, textures etc) - but there are periods at the start of each cycle (such as at the cursor position) where there is some other contribution. I have not been able to find this in the other more-specific graphs. Any ideas anyone? I have been trying to make this app better behaved memory-wise and have made a lot of progress, in particular by removing periods when two large memory allocations co-exist, and by breaking work up into chunks. It now bothers me that there is 150 MB of "anonymous VM" that I cannot explain!
1
0
1.2k
May ’23
watch app crashes when permissions for microphone and bluetooth are changed on iPhone
My watchOS app crashes when I accept/change the microphone or Bluetooth permission from its companion iOS app. It crashes with the following message in the console. Message from debugger: Terminated due to signal 9 Please let me know a way to identify and fix the exact problem. here are my device logs: Device logs and crash report
4
1
2.8k
May ’23
FIXED_CYCLES and FIXED_INSTRUCTIONS and sampling speed
When using Instruments to capture FIXED_CYCLES and FIXED_INSTRUCTIONS on both an M1 based MacBook and also on an iPhone, the value of these counts is much higher when enabling High Frequency Sampling. Why is the count of Instructions and Cycles higher with Higher Frequency Sampling? Is it due to stack sampling overheads? Which is more accurate to capture FIXED_CYCLES and FIXED_INSTRUCTIONS counts - with High Frequency Sampling or without?
5
0
1.9k
May ’23
Using Instrument Leaks to detect memory leaks for iOS project iOS 16.1
I am facing an issue trying to detect a memory leak for iOS project with any Simulator for iOS 16.1 on Xcode 14.1 I am working on an example app https://github.com/Showmax/automated-memory-leak-testing-ios That simply creates a memory leak using a strong delegation between Two classes The expectation: when using the memory debug graph I am expecting that Xcode will mark the instance of GeneratorViewController that have a leak as a leak. Behavior: It doesn't The same behavior is happing when I am using the instrument tool with the defaults Leaks template. I only see can see tons of leaks when I use Simulator iOS 14 which I am not sure why it's different. Can you please support? Thanks
3
2
3.7k
Apr ’23
How do I persist os_signposts so they don't get lost when the in-memory buffer overflows?
I have a tool that generates thousands of signpost events a second. Unfortunately, when profiling earlier signposts appear to get lost over the course of the run because they are not persisted and the buffer for these runs out. How can I get these to persist? For reference, I've filed a feedback for this as FB12129526, and more context can be found (in meme form) here: https://federated.saagarjha.com/notice/AUm3AprLdVOnUPfiQy.
1
0
1.4k
Apr ’23
Disclosure triangle missing from "HTTP Traffic" instrument
After recording a network request using the "HTTP Traffic" instrument, I don't see the disclosure triangle documented here. I'd expect to see something similar to this screenshot: Instead, my document's top-level track is missing the disclosure triangle: I'm launching Instruments from Xcode using a debug configuration with a development certificate. I'm using an instance of URLSession directly (no third-party libraries) and am creating a URLSessionDataTask to send the request. Is this a bug in Instruments? Or am I doing something dumb? Versions Instruments Version 14.3 (14E222b) iOS Version 16.3.1 (20D67) macOS Version 13.2.1 (22D68)
1
0
755
Apr ’23
Any option to profile JIT code with Instruments?
Hi, I would like to use the Instruments Time Profiler to profile code of an emulator project. The code is generated by a JIT compiler at runtime. Unfortunately, Instruments only displays an address and it cannot even display the disassembly of that dynamically generated code region. The solution for x86_64 is to use VTune on Windows, the VTune JIT Profiling API allows to specify code regions and give them a name (and even specify source code). Is there something like that for Instruments, too? Or any other alternatives to profile JIT code on Apple Silicon? Thanks a lot in advance! Lyve
2
0
861
Apr ’23
Watch app Optimize performance & Launch time
I'm trying to ensure my watch app launches as quickly as possible. I'm using the @WKApplicationDelegateAdaptor because of needing to implement the BackgroundRefresh handlers. What I'm finding is that the time between the app calling the main init() and then the ExtensionDelegate calling applicationDidFinishLaunching is often > 2 seconds. I've tried using Instruments to profile the App launch but have never had any luck with the tool on a watch app. So I then created a blank project just with the elements needed to implement the same WKApplicationDelegateAdaptor and oslog calls, performance was the same... This is tested on WatchOS 9.5 & 9.5. This is on a Series 6 and Series 8 Apple Watch (FYI S6 == S7 == S8 for Apple Watch CPU performance) Interestingly, on the simulator, the time gap was less, more like 1 second between main init() and applicationDidFinishLaunching.... not sure why this would be this way. Anyway, for real world device usage, is this the best performance I can expect? Is there anything that can be done to improve this?
0
0
1.2k
Apr ’23
Profile Metal application on MacOS
Hi, I have an application that uses Metal compute kernels to do image processing and it is not built as an Xcode project. Is there a tool to attach or launch a process to profile the scheduling and execution of Metal kernels similar to CUDA's Nsight Systems (or visual profiler)? I want to see the information like kernel execution sequence, duration, kernel names, thread group size, etc. Is that possible to do without an Xcode project? I tried the Instruments tool, but it didn't seem to show the labeled compute kernels. Thanks!
1
2
1.1k
Mar ’23
Memory Graph - Unable to acquire required task port
I'm trying to find memory leaks in my application with either Memory Graph or Inspector. I'm getting the following errors:Memory Graph - Unable to acquire required task portInspector Prompts for passwordError: Failed to attach to target processAn error occurred trying to capture Leaks data.Unable to acquire required task port ()The odd thing is that both work on initial execution of the target, but every subsequent launch triggers the above errors. (including after restarting xcode and after reboot).If I change my target name it works one time and then the errors start again. So the target name is being cached somewhere and causing subsequent testing with that name impossible.I'm running xCode 10.2 and Mac OS 10.14.4.Some more context and ugly work around. This is a swift server app and I'm using swift package manager to generate the xcode project. The following works and avoids the above errors, but it is a hassle.swift package generate-xcodeprojopen projName.xcodeprojbuild and runclick Debug Memory Graph button. App Stopped and Memory Graph displays fine. If I stop the app and run again then I get the above errors.stop the appchange the target name in Package.swiftswift package generate-xcodeprojopen projName.xcodeprojbuild and runMemory Graph works one time againrinse and repeatI've found that using Inspector exhibits the same behavior.Any help would be appreciated.Thanks,Dana
1
2
2.8k
Mar ’23
xctrace/instruments has big delay caused by dyld notifymonitor
Hello, While using the App Launch template with xctrace, the launch time for my app is much longer than expected. While investigating, I saw 4 syscalls to mach_msg_trap from dyld that are causing a delay of 100-300ms: I would like to know if there's any way to improve the performance here, as this is adding around 1 second more to my measurements and I have been trying to find a solution. Thank you very much for your help!
0
0
739
Mar ’23
Xctrace issue in M1 processor
Hi I am getting the below error while doing memory profiling(launching instruments using xctrace command) in M1 processor. Run issues were detected (trace is still ready to be viewed): [Error] Failed to start the recording: ktrace cannot trace the system under Rosetta translation [Error] Unexpected failure: Data source agent failed to arm. [Error] Unexpected failure: Couriers have returned unexpectedly. Recording failed with errors. Saving output file... I am launching below command via jenkins: xcrun xctrace record --template 'Leaks' --launch <app_name> --output 'recording.trace'.
3
0
2.2k
Mar ’23
Instruments Time Profiler does not show time at the C source code level
MacOS 12.3.1 Xcode 13.3.1 When I run my executable under Instruments with the Time Profiler it shows the time per function but when I click on the function name to see the time per line of code it displays the source but with no time information (percentage of time for that line). I've tried a variety of compiler options for my code such as -g and -g3 but that does not seem to matter. I have not used Instruments in a few years but I am pretty sure it displayed the time at the source code level with no special compiler flags in the past. Are special compiler flags needed to see the time per line of C source code? If not, how can I debug this? Thanks
4
1
2.9k
Feb ’23
NSURLSession caused huge memory retain in libnetwork
I am using this code. I have huge number of urlSessions but this caused huge memory retain in libnetwork NSURLSessionConfiguration* _configuration = [NSURLSessionConfiguration defaultSessionConfiguration]; NSURLSession* urlSession = [NSURLSession sessionWithConfiguration:_configuration delegate:_delegate delegateQueue:NSOperationQueue.mainQueue]; NSURLSessionDataTask* dataTask = [urlSession dataTaskWithRequest:request]; [dataTask resume]; how can i avoid this memory retain. I have tried all possible fixes by not using urlCache and all. below is xcode memory retain snippet - please suggest how I can avoid this memory retain?
Replies
3
Boosts
1
Views
1k
Activity
Jun ’23
ASAuthorizationAppleIDProvider() hang in async method
I have a bit of a tricky severe hang in my app launch processing code path. Here is the detail: I have a .task modifier from the main ContentView that calls into the signInWithAppleManager.checkUserAuth method, which is marked async. I've tried wrapping the offending line in a Task block to get it off of the main thread, but it still hangs, and is still running on the main thread. Ironically, I found the hang after watching "Analyze Hangs With Instruments" from WWDC 23. However, at the point in the video towards the end where he discusses shared singletons, he mentions resolving a similar issue by making the shared singleton async, and then skips over how he would do it, kind of seemingly presenting a gap in analysis and debugging, while also explaining idle state ... kind of more irony. Thanks in advance! Task { let appleIDProvider = ASAuthorizationAppleIDProvider() Is there anything else that I can do to resolve this? Here is the code: public class SignInWithAppleManager: ObservableObject { @Published public private(set) var userAuthenticationState: AuthState = .undefined public static let shared = SignInWithAppleManager() private init() { } func signOutUser() async { KeychainItem.deleteUserIdentifierFromKeychain() await SignInWithAppleManager.shared.updateUserAuthenticationState(authState: .signedOut) } @MainActor func userAuthenticated() async { self.userAuthenticationState = .signedIn } @MainActor func userSignedOut() async { self.userAuthenticationState = .undefined } func simulateAuthenticated() async -&gt; Bool { return false } public var isAuthenticated: Bool { return self.userAuthenticationState == .signedIn } @MainActor func updateUserAuthenticationState(authState: AuthState) async { debugPrint("Current authstate: \(self.userAuthenticationState) New auth state: \(authState)") self.userAuthenticationState = authState } public func checkUserAuth() async -&gt; AuthState { debugPrint(#function) //completion handler defines authstate if KeychainItem.currentUserIdentifier == "" || KeychainItem.currentUserIdentifier == "simulator" { debugPrint("User identifier is empty string") await updateUserAuthenticationState(authState: .undefined) //userid is not defined in User defaults bc empty, something went wrong } else { await updateUserAuthenticationState(authState: .signedIn) } if await !self.simulateAuthenticated() { // HERE: ‼️ hangs for 2 seconds let appleIDProvider = ASAuthorizationAppleIDProvider() // HERE: ‼️ hangs for 2 seconds do { let credentialState = try await appleIDProvider.credentialState(forUserID: KeychainItem.currentUserIdentifier) switch credentialState { case .authorized: debugPrint("checkUserAuth:authorized") // The Apple ID credential is valid. Show Home UI Here await updateUserAuthenticationState(authState: .signedIn) break case .revoked: debugPrint("checkUserAuth:revoked") // The Apple ID credential is revoked. Show SignIn UI Here. await updateUserAuthenticationState(authState: .undefined) break case .notFound: debugPrint("checkUserAuth:notFound") // No credential was found. Show SignIn UI Here. await updateUserAuthenticationState(authState: .signedOut) break default: debugPrint("checkUserAuth:undefined") await updateUserAuthenticationState(authState: .undefined) break } } catch { // Handle error debugPrint("checkUserAuth:error") debugPrint(error.localizedDescription) await updateUserAuthenticationState(authState: .undefined) } } return self.userAuthenticationState } }
Replies
1
Boosts
1
Views
1.6k
Activity
Jun ’23
Prevent CPU frequency scaling when profiling for iOS?
Hi all,I've been digging into Instruments lately to investigate some potential performance wins for my app. I'm really enjoying the level of detail in the System Trace template, and the os_signpost stuff is perfect to get a high-level view of where to focus attention - great job!I'm using the latest Xcode Version 11.4.1 (11E503a) on Catalina, and an iPod Touch 7th Gen on the latest iOS - 13.4 (17E255).I'm measuring the app in a steady state where the workload is pretty constant and low (should be no issue hitting 60FPS rendering) but Xcode's CPU meter is pretty jumpy and it drops a frame every couple of seconds, which then seems to coincide with a reduction of CPU usage shown in Xcode.My suspicion is the device thinks it can maintain the required framerate and use less energy by reducing the CPU frequency. This is not quite true for my app - the main thread is sleeping for a significant period but it is awaiting a result on the run loop before the frame rendering can be completed. I can see why the OS might think downclocking is possible here, but then kick up the frequency again when it sees a frame is dropped.I did however once seem to get the device into a state where it was running at (I assume) full speed - the CPU meter in Xcode stayed steady as a rock at 15% or so (with "other processes" at a similar number). I haven't been able to figure out exactly how I managed that - Instruments was running a windowed tracing session and I app switched away and back to the app, but that method doesn't seem to work every time.So the Instruments-related questions arising from this:1) Is there a way to record and visualize the CPU frequency scaling in Instruments? If the frequency of the CPU is changing and unknown, then the timings coming out of Instruments are not really telling the whole story.2) Is there an officially supported method to prevent CPU frequency scaling whilst Instruments is recording data?Thanks for any help!Simon
Replies
3
Boosts
1
Views
3.1k
Activity
Jun ’23
stdout/stderr in Instruments does not show output
I'm using Instruments to profile a C program that prints to stdout via printf but the program output does not appear in the Detail Area of the stdout/stderr instrument I added. The program is launched by Instruments itself when I click the Record button and it appears to run correctly – I just can't see the stdout output. I'm using Version 14.3.1 (14E300c) of Instruments on a MacBook Pro 16" (2019) running macOS 13.4 (22F66).
Replies
1
Boosts
0
Views
1.4k
Activity
Jun ’23
Cache-related CPU Counters in macOS Instruments stop increasing after a few seconds or don't show any measurements at all
I'm trying to learn about profiling by tracking the events L1D.REPLACEMENT, MEM_LOAD_RETIRED.L2_MISS, and MEM_LOAD_RETIRED.L3_MISS using the CPU Counters instrument in Instruments 14.3.1 (14E300c) on my MacBook Pro 16" (2019) with the Intel Core i9-9980HK, running macOS 13.4 (22F66). In this run, the counters do show some values but they don't change after the first few seconds of the program even though the program ran much longer. In other runs, the Detail Area for the CPU Counters instruments doesn't get populated at all. What am I doing wrong here and how can I get this to work? Thank you for any advice.
Replies
1
Boosts
0
Views
1.1k
Activity
Jun ’23
Trackpad click not working
i have an apple m1 macbook pro. Recently I updated to the new Ventura 13.4 and afte the update my track pad refuses to be clicked, rebooted but the problem remains...
Replies
1
Boosts
0
Views
846
Activity
May ’23
Memory-mapped files in Allocations instrument
Dear Experts, Where do memory-mapped files appear in the Allocations instrument, if at all? In the screenshot below, the green "all anonymous VM" graph is almost completely explained by the purple "IO Accelerator" graph (GPU buffers, textures etc) - but there are periods at the start of each cycle (such as at the cursor position) where there is some other contribution. I have not been able to find this in the other more-specific graphs. Any ideas anyone? I have been trying to make this app better behaved memory-wise and have made a lot of progress, in particular by removing periods when two large memory allocations co-exist, and by breaking work up into chunks. It now bothers me that there is 150 MB of "anonymous VM" that I cannot explain!
Replies
1
Boosts
0
Views
1.2k
Activity
May ’23
watch app crashes when permissions for microphone and bluetooth are changed on iPhone
My watchOS app crashes when I accept/change the microphone or Bluetooth permission from its companion iOS app. It crashes with the following message in the console. Message from debugger: Terminated due to signal 9 Please let me know a way to identify and fix the exact problem. here are my device logs: Device logs and crash report
Replies
4
Boosts
1
Views
2.8k
Activity
May ’23
FIXED_CYCLES and FIXED_INSTRUCTIONS and sampling speed
When using Instruments to capture FIXED_CYCLES and FIXED_INSTRUCTIONS on both an M1 based MacBook and also on an iPhone, the value of these counts is much higher when enabling High Frequency Sampling. Why is the count of Instructions and Cycles higher with Higher Frequency Sampling? Is it due to stack sampling overheads? Which is more accurate to capture FIXED_CYCLES and FIXED_INSTRUCTIONS counts - with High Frequency Sampling or without?
Replies
5
Boosts
0
Views
1.9k
Activity
May ’23
Using Instrument Leaks to detect memory leaks for iOS project iOS 16.1
I am facing an issue trying to detect a memory leak for iOS project with any Simulator for iOS 16.1 on Xcode 14.1 I am working on an example app https://github.com/Showmax/automated-memory-leak-testing-ios That simply creates a memory leak using a strong delegation between Two classes The expectation: when using the memory debug graph I am expecting that Xcode will mark the instance of GeneratorViewController that have a leak as a leak. Behavior: It doesn't The same behavior is happing when I am using the instrument tool with the defaults Leaks template. I only see can see tons of leaks when I use Simulator iOS 14 which I am not sure why it's different. Can you please support? Thanks
Replies
3
Boosts
2
Views
3.7k
Activity
Apr ’23
How do I persist os_signposts so they don't get lost when the in-memory buffer overflows?
I have a tool that generates thousands of signpost events a second. Unfortunately, when profiling earlier signposts appear to get lost over the course of the run because they are not persisted and the buffer for these runs out. How can I get these to persist? For reference, I've filed a feedback for this as FB12129526, and more context can be found (in meme form) here: https://federated.saagarjha.com/notice/AUm3AprLdVOnUPfiQy.
Replies
1
Boosts
0
Views
1.4k
Activity
Apr ’23
Disclosure triangle missing from "HTTP Traffic" instrument
After recording a network request using the "HTTP Traffic" instrument, I don't see the disclosure triangle documented here. I'd expect to see something similar to this screenshot: Instead, my document's top-level track is missing the disclosure triangle: I'm launching Instruments from Xcode using a debug configuration with a development certificate. I'm using an instance of URLSession directly (no third-party libraries) and am creating a URLSessionDataTask to send the request. Is this a bug in Instruments? Or am I doing something dumb? Versions Instruments Version 14.3 (14E222b) iOS Version 16.3.1 (20D67) macOS Version 13.2.1 (22D68)
Replies
1
Boosts
0
Views
755
Activity
Apr ’23
Any option to profile JIT code with Instruments?
Hi, I would like to use the Instruments Time Profiler to profile code of an emulator project. The code is generated by a JIT compiler at runtime. Unfortunately, Instruments only displays an address and it cannot even display the disassembly of that dynamically generated code region. The solution for x86_64 is to use VTune on Windows, the VTune JIT Profiling API allows to specify code regions and give them a name (and even specify source code). Is there something like that for Instruments, too? Or any other alternatives to profile JIT code on Apple Silicon? Thanks a lot in advance! Lyve
Replies
2
Boosts
0
Views
861
Activity
Apr ’23
Watch app Optimize performance & Launch time
I'm trying to ensure my watch app launches as quickly as possible. I'm using the @WKApplicationDelegateAdaptor because of needing to implement the BackgroundRefresh handlers. What I'm finding is that the time between the app calling the main init() and then the ExtensionDelegate calling applicationDidFinishLaunching is often > 2 seconds. I've tried using Instruments to profile the App launch but have never had any luck with the tool on a watch app. So I then created a blank project just with the elements needed to implement the same WKApplicationDelegateAdaptor and oslog calls, performance was the same... This is tested on WatchOS 9.5 & 9.5. This is on a Series 6 and Series 8 Apple Watch (FYI S6 == S7 == S8 for Apple Watch CPU performance) Interestingly, on the simulator, the time gap was less, more like 1 second between main init() and applicationDidFinishLaunching.... not sure why this would be this way. Anyway, for real world device usage, is this the best performance I can expect? Is there anything that can be done to improve this?
Replies
0
Boosts
0
Views
1.2k
Activity
Apr ’23
Profile Metal application on MacOS
Hi, I have an application that uses Metal compute kernels to do image processing and it is not built as an Xcode project. Is there a tool to attach or launch a process to profile the scheduling and execution of Metal kernels similar to CUDA's Nsight Systems (or visual profiler)? I want to see the information like kernel execution sequence, duration, kernel names, thread group size, etc. Is that possible to do without an Xcode project? I tried the Instruments tool, but it didn't seem to show the labeled compute kernels. Thanks!
Replies
1
Boosts
2
Views
1.1k
Activity
Mar ’23
Find Unused code and variables
How can I find unused code and any other unused objects? I want to use Xcode
Replies
1
Boosts
0
Views
5.2k
Activity
Mar ’23
Memory Graph - Unable to acquire required task port
I'm trying to find memory leaks in my application with either Memory Graph or Inspector. I'm getting the following errors:Memory Graph - Unable to acquire required task portInspector Prompts for passwordError: Failed to attach to target processAn error occurred trying to capture Leaks data.Unable to acquire required task port ()The odd thing is that both work on initial execution of the target, but every subsequent launch triggers the above errors. (including after restarting xcode and after reboot).If I change my target name it works one time and then the errors start again. So the target name is being cached somewhere and causing subsequent testing with that name impossible.I'm running xCode 10.2 and Mac OS 10.14.4.Some more context and ugly work around. This is a swift server app and I'm using swift package manager to generate the xcode project. The following works and avoids the above errors, but it is a hassle.swift package generate-xcodeprojopen projName.xcodeprojbuild and runclick Debug Memory Graph button. App Stopped and Memory Graph displays fine. If I stop the app and run again then I get the above errors.stop the appchange the target name in Package.swiftswift package generate-xcodeprojopen projName.xcodeprojbuild and runMemory Graph works one time againrinse and repeatI've found that using Inspector exhibits the same behavior.Any help would be appreciated.Thanks,Dana
Replies
1
Boosts
2
Views
2.8k
Activity
Mar ’23
xctrace/instruments has big delay caused by dyld notifymonitor
Hello, While using the App Launch template with xctrace, the launch time for my app is much longer than expected. While investigating, I saw 4 syscalls to mach_msg_trap from dyld that are causing a delay of 100-300ms: I would like to know if there's any way to improve the performance here, as this is adding around 1 second more to my measurements and I have been trying to find a solution. Thank you very much for your help!
Replies
0
Boosts
0
Views
739
Activity
Mar ’23
Xctrace issue in M1 processor
Hi I am getting the below error while doing memory profiling(launching instruments using xctrace command) in M1 processor. Run issues were detected (trace is still ready to be viewed): [Error] Failed to start the recording: ktrace cannot trace the system under Rosetta translation [Error] Unexpected failure: Data source agent failed to arm. [Error] Unexpected failure: Couriers have returned unexpectedly. Recording failed with errors. Saving output file... I am launching below command via jenkins: xcrun xctrace record --template 'Leaks' --launch <app_name> --output 'recording.trace'.
Replies
3
Boosts
0
Views
2.2k
Activity
Mar ’23
Instruments Time Profiler does not show time at the C source code level
MacOS 12.3.1 Xcode 13.3.1 When I run my executable under Instruments with the Time Profiler it shows the time per function but when I click on the function name to see the time per line of code it displays the source but with no time information (percentage of time for that line). I've tried a variety of compiler options for my code such as -g and -g3 but that does not seem to matter. I have not used Instruments in a few years but I am pretty sure it displayed the time at the source code level with no special compiler flags in the past. Are special compiler flags needed to see the time per line of C source code? If not, how can I debug this? Thanks
Replies
4
Boosts
1
Views
2.9k
Activity
Feb ’23