Instruments

RSS for tag

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

Posts under Instruments tag

94 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Xcode Instruments selects wrong application when started from Xcode
Hello, I see the Instruments app has gotten a nice upgrade for Xcode 16. There is one issue left that has been bothering me though. If my app is installed inside the "Application" folder, and I then try to launch Instruments for a new build of the same app from within XCode, Instruments will run the app installed in "Applications" instead of running the app I just built. The problem with this, is that it's very easy to accidentally profile an old version of your app, and come to the wrong conclusions. I've created a video showing this issue: https://youtu.be/IloFsQQFgSw
1
0
94
4d
Instruments of Xcode not showing correct memory allocation on the latest version of iOS for PacketTunnelProvider Process
We have observed for a few months that the Instruments tool in Xcode does not show correct memory allocation for the PacketTunnelProvider process on iOS 17. The memory allocation does not exceed 6-7 MB, which is not the case with iOS 16 or 15. Additionally, Instruments crashes the PacketTunnelProvider process after profiling for a few minutes. Please note that I am not running Xcode in debugger mode for the PacketTunnelProvider process along with instruments, as this is a known issue that causes the PacketTunnelProvider to be killed when both Instruments and the Xcode debugger are running. Is anyone else facing this issue and have a workaround?
0
1
167
2w
Instruments false positives
I have been able to get rid of reported memory leaks in Instruments not by fixing a leak but by adding some lines (like releasing a previous nil object) that convinced Instruments it is not a leak. But I am stuck are some I cannot stop Instruments from reporting. It reports a leak in this code if(expr.length>0) { // add previous Atomic Atomic *atom = [[Atomic alloc] initWithString:[string substringWithRange:expr] isNumber:aNum]; [exprTokens addObject:atom]; [atom release]; } } and it underlines the substringWithRange method. I changed code to explicitly release atom and I assumed substringWithRange would return an autoreleased new string. I am aware Instruments tells you where the leaked object is created and not where it is leak, but only things created here are atom and a sub string and atom is released immediately. The initWithString method might do it, but I don't find anything there. Also, while running instruments, this code is 8542 times (I am pretty sure always in the same context) and Instruments says it only leaks 61 times. I don't now if there is misunderstanding are a code problem?
1
0
201
2d
CoreML Performance Report Error on Xcode Beta
Error when trying to generate CoreML performance report, message says The data couldn't be written because it isn't in the correct format. Here is the code to replicate the issue import numpy as np import coremltools as ct from coremltools.converters.mil import Builder as mb import coremltools.converters.mil as mil w = np.random.normal(size=(256, 128, 1)) wemb = np.random.normal(size=(1, 32000, 128)) # .astype(np.float16) rope_emb = np.random.normal(size=(1, 2048, 128)) shapes = [(1, seqlen) for seqlen in (32, 64)] enum_shape = mil.input_types.EnumeratedShapes(shapes=shapes) fixed_shape = (1, 128) max_length = 2048 dtype = np.float32 @mb.program( input_specs=[ # mb.TensorSpec(enum_shape.symbolic_shape, dtype=mil.input_types.types.int32), mb.TensorSpec(enum_shape.symbolic_shape, dtype=mil.input_types.types.int32), ], opset_version=mil.builder.AvailableTarget.iOS17, ) def flex_like(input_ids): indices = mb.fill_like(ref_tensor=input_ids, value=np.array(1, dtype=np.int32)) causal_mask = np.expand_dims( np.triu(np.full((max_length, max_length), -np.inf, dtype=dtype), 1), axis=0, ) mask = mb.gather( x=causal_mask, indices=indices, axis=2, batch_dims=1, name="mask_gather_0", ) # mask = mb.gather( # x=mask, indices=indices, axis=1, batch_dims=1, name="mask_gather_1" # ) rope = mb.gather(x=rope_emb.astype(dtype), indices=indices, axis=1, batch_dims=1, name="rope") hidden_states = mb.gather(x=wemb.astype(dtype), indices=input_ids, axis=1, batch_dims=1, name="embedding") return ( hidden_states, mask, rope, ) cml_flex_like = ct.convert( flex_like, compute_units=ct.ComputeUnit.ALL, compute_precision=ct.precision.FLOAT32, minimum_deployment_target=ct.target.iOS17, inputs=[ ct.TensorType(name="input_ids", shape=enum_shape), ], ) cml_flex_like.save("flex_like_32") If I remove the hidden states from the return it does work, and it also works if I keep the hidden states, but remove both mask, and rope, i.e, the report is generated for both programs with either these returns: return ( # hidden_states, mask, rope, ) and return ( hidden_states, # mask, # rope, ) It also works if I use a static shape instead of an EnumeratedShape I'm using macOS 15.0 and Xcode 16.0 Edit 1: Forgot to mention that although the performance report fails, the model is still able to make predictions
1
0
384
3w
AttributeGraph: cycle detected Warning with WatchOS app
I've been seeing warning like the following with my Apple Watch app: === AttributeGraph: cycle detected through attribute 140952 === === AttributeGraph: cycle detected through attribute 131640 === === AttributeGraph: cycle detected through attribute 131640 === === AttributeGraph: cycle detected through attribute 131640 === === AttributeGraph: cycle detected through attribute 131640 === === AttributeGraph: cycle detected through attribute 131640 === === AttributeGraph: cycle detected through attribute 131640 === I've done some debugging with Instruments and Xcode, I've determined that its caused by adding a .toolbar { ToolbarItemGroup(placement: .topBarTrailing) { Label("Stop", systemImage: "xmark") } } to an item within my NavigationSplitView List Destination view. To aid reproduction of this issue even more, I've verified the same warning occurs with the Apple sample code from the WWDC23 Backyard Birds app. https://developer.apple.com/documentation/swiftui/backyard-birds-sample?changes=_9 If you take the Apple sample code, open it in Xcode 15.4 and run it in the Apple Watch WatchOS 10.5 simulator, then select the Bird Springs item, all is well. If you then add the above toolbar code to the BackyardSummaryTab file at the bottom of the VStack, you'll see the same AttributeGraph issues I'm seeing in my app. Is this a bug? I can't understand why adding a static ToolBarItem in WatchOS is causing this. I've seen this issue in the simulator and also on device.
1
0
378
Jun ’24
Memory profiler crash on running profile for debugging WKWebKit crash
We are getting crash issue in our WKWebkit based Cordova application due to memory issues. However, for debugging the memory issue we are trying to use JavaScript allocations in the memory profiler of instruments. and while using it, the profiler automatically closes within few seconds, and we are not able to debug the underlaying memory issue in the WKWebKit. I
4
0
306
Jun ’24
Integrate performance profiling in another application
We're planning to integrate performance profiling tool into our own Application. The standard tool is Xcode Instruments, which is great but requires Xcode to be installed. I have couple of queries related to that. Is there a way to use Instruments without clients needing to install Xcode? If not, then can we include Xcode installation as part of my application installation in the customer machine?
4
0
461
Jun ’24
Is it possible to run instruments an App without being connected to Xcode?
I'm currently supporting an app where one of the dependencies we use had an update. The app is an iPad only app that is meant to be run as a kiosk (guided access, single app mode). After the dependency update for the casing of the tablet / kiosk, we noticed an uptick in errors that may or may not have been associated with the recent 3rd party software update. I wanted to verify if the update had an impact on our production kiosks. To get a good idea of whether or not the update for casework's library had a negative impact, though, I would need to run instruments on a tablet while it's in the case. There's only one power cable to the iPad and the cable that would be used to connect directly to a Mac / Xcode is the same cable that connects to the casework. Is it possible to run instruments, and then retrieve data, from an app that's not directly connected to Xcode? Or is it possible for Xcode to somehow connect via a running instance of an app remotely?
1
0
450
May ’24
Developer Strap and Xcode Instruments
I have the Vision Pro developer strap, do I need to do anything to make Instruments transfer the data over it rather than wifi? Or will it do that automatically? It seems incredibly slow for transferring and then analysing data. I can see the Vision Pro recognised in Configurator, so assume it's working. Otherwise.. Any tips for speeding up Instruments? Capturing 5 mins of gameplay (high-freq) then takes 30-40+ mins to appear in Instruments on an M2 Max 32gb. Thanks!
2
0
343
May ’24
Get rid of the task time displayed by the system
When I run my app in debug mode, whenever a time consuming task is run (like a core data fetch request) there is a time indication appearing on top of the view. I am unable to find the meaning of this and how it is named. It looks like: "appName NNNN ms" (it is not caught by the screen shot) Can someone tell if it is possible to get rid of it and how ? Thanks for your help !
1
0
379
May ’24
how to make shared propery async
I was watching https://developer.apple.com/videos/play/wwdc2023/10248/ , in this video it is adviced to make below shated property async to benefit from concurency (in video 40:04 , exact time) , do yo know how to do it ? class ColorizingService { static let shared = ColorizingService() func colorize(_ grayscaleImage: CGImage) async throws -> CGImage // [...] } struct ImageTile: View { // [...] // implicit @MainActor var body: some View { mainContent .task() { // inherits @MainActor isolation // [...] result = try await ColorizingService.shared.colorize(image) } } }
1
0
268
May ’24
Custom keyboard extension modified to allow full access back to App being killed
Hello, technical friends, I am developing a custom keyboard extension, currently encountered a technical difficulty, almost asked AI and Google have not solved my problem. 

 Problem description: 
 When my App was first installed, I opened Settings from the App, enabled full access, and crashed when I returned to the App. Run the App for the second time, open the Settings from the App, update the full access permission, and automatically re-run the App after returning to the App, and then the third, fourth, and NTH times will not crash. 

 Seems like ios will kill host apps for custom keyboard extensions after full access is updated? I want my App installed for the first time to update full access to return App without crashing, but don't know how to fix this problem. I look forward to the technical experts working in Apple development to help me provide relevant technical methods and ideas so that I can solve this problem. Thank you very much! When tracing debugging in xcode, after the App forces exit, the console prompts: Message from debugger: Terminated due to signal 9 When I was monitoring CPU and memory usage, it was very low and I didn't see anything unusual.
0
0
312
May ’24
Unknown network connection Xcode instruments
Users have reported unusually high data usage with my app. So to investigate I have profiled in instruments. My app as expected in using minimal data. However in instruments I see an "Unknown" process. Which sends around 1mb of data every 2 seconds. Can anyone explain what unknown process is? Sorry my question is vague but I'm at the beginning of understanding the instruments outputs so your help is so very much appreciated.
1
0
404
May ’24