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 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
1k
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
541
Aug ’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
480
Aug ’23
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.8k
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
2.0k
Jun ’22