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

An address of the top frame's IP is always off by 1 in *-profile tables
Hi! Is there a reason why trace's *-profile tables (time-profile, cpu-profile, counters-profile) always use an instruction pointer value that is 1 byte larger than what should be a true instruction pointer value? Odd valued IPs on Apple M2 are definitely incorrect as instructions have to be word-aligned. It's also worth mentioning that addresses in "source" tables ("time-sample" for "time-profile", "kdebug-counters-with-pmi-sample" for "cpu-profile" and "counters-profile") are correct (or, at least, are correctly aligned aligned). Here's an example: % xctrace version xctrace version 15.2 (15C500b) # run recording % xctrace record --template "Time Profile" --output TP.trace --launch /bin/dd if=/dev/random of=/dev/null bs=1024 count=1048576 # extract "source" table % xctrace export --input TP.trace --xpath='/trace-toc/run[1]/data/table[@schema="time-sample"]' > tp.time-sample.xml # extract "derived" table % xctrace export --input TP.trace --xpath='/trace-toc/run[1]/data/table[@schema="time-profile"]' > tp.time-profile.xml % xmllint --xpath '//row[1]' tp.time-sample.xml <row><sample-time id="1" fmt="00:00.040.502">40502000</sample-time><thread id="2" fmt="Main Thread 0x37c2d0a (dd, pid: 32471)"><tid id="3" fmt="0x37c2d0a">58469642</tid><process id="4" fmt="dd (32471)"><pid id="5" fmt="32471">32471</pid><device-session id="6" fmt="TODO">TODO</device-session></process></thread><core id="7" fmt="CPU 4 (P Core)">4</core><thread-state id="8" fmt="Running">Running</thread-state><sentinel/><kperf-bt id="9" fmt="PC:0x1863149fc, 3 frames, 1 regs, pid: 32471"><text-addresses id="10" fmt="frag 1717">6546645708 6546360308 0</text-addresses><text-address id="11" fmt="0x1863149fc">6546344444</text-address><process ref="4"/><register-content id="12" fmt="0x2e4c00018635e2cc">3336041430521340620</register-content></kperf-bt><time-sample-kind id="13" fmt="Timer Fired">0</time-sample-kind></row> % xmllint --xpath '//row[1]' tp.time-profile.xml <row><sample-time id="1" fmt="00:00.040.502">40502000</sample-time><thread id="2" fmt="Main Thread 0x37c2d0a (dd, pid: 32471)"><tid id="3" fmt="0x37c2d0a">58469642</tid><process id="4" fmt="dd (32471)"><pid id="5" fmt="32471">32471</pid><device-session id="6" fmt="TODO">TODO</device-session></process></thread><process ref="4"/><core id="7" fmt="CPU 4 (P Core)">4</core><thread-state id="8" fmt="Running">Running</thread-state><weight id="9" fmt="1.00 ms">1000000</weight><backtrace id="10"><frame id="11" name="0x1863149fd" addr="0x1863149fd"><binary id="12" name="dyld" UUID="324E4AD9-E01F-3183-B09F-3E20B326643A" arch="arm64e" load-addr="0x186313000" path="/usr/lib/dyld"/></frame><frame id="13" name="0x18635e2cc" addr="0x18635e2cc"><binary ref="12"/></frame><frame id="14" name="start" addr="0x1863187f4"><binary ref="12"/></frame></backtrace></row> As you can see, <kperf-bt id="9" fmt="PC:0x1863149fc, 3 frames, 1 regs, pid: 32471"> refers to a properly aligned address, but the address from <backtrace id="10"><frame id="11" name="0x1863149fd" addr="0x1863149fd">... is off by one. It seems like only an address from the top frame is incorrect, as others are aligned properly. The same issue exists for "CPU Profile" and "CPU Counters" instruments and could be reproduced on macOs running on both x86-64 and Apple-Silicon CPUs.
1
0
295
2d
os_signpost not working on macOS device, works on iOS device
I have an iOS app that uses os_signpost API for instrumentation. When I profile it from Xcode on real iOS device, it works as expected. When I profile its macCatalyst variant (using the identical code) on the same Mac where Xcode is running, the os_signpost Instrument does not show anything, not even the Apple provided signposts that are otherwise visible on the iOS. How do I make it work?
5
0
523
2d
OSSignposts not working after upgrade to Sonoma (14.2.1)
The Points of Interest Instrument is not recording any data when profiling my application on Sonoma. The same code is producing signposts when profiling on a computer running Sonoma. Here's what how the instruments screen looks: Note that there are no Points of Interest being recorded. I created a new project for this test and added code to emit signposts whenever the application becomes active or goes into the background. This is the code I'm using for the test (copied from forum post from a year ago). import os.signpost @main class AppDelegate: NSObject, NSApplicationDelegate { var window: NSWindow? var blackWindow: NSWindow? var alertWindow: NSWindow? static var originalAppDelegate: AppDelegate! var signposter: OSSignposter var signpostInterval: OSSignpostIntervalState? func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool { return true } override init() { signposter = OSSignposter(subsystem: Bundle.main.bundleIdentifier ?? "unknown", category: .pointsOfInterest) super.init() assert(signposter.isEnabled) signposter.emitEvent(#function) } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } func applicationWillResignActive(_ notifiction: Notification) { guard let interval = signpostInterval else { assertionFailure("no interval") return } print("backgrounding, ending active state") signposter.endInterval("active", interval) } func applicationDidBecomeActive(_ notification: Notification) { print("begin active state") signpostInterval = signposter.beginInterval("active") } } Is anyone else having this problem? I tested this on my development machine (Retina 5K, 27-inch, 2019) running Sonoma 14.2.1. The problem occurs even with a clean install of Sonoma onto an external boot disk. The same code produces this screenshot when running in Ventura 13.6.1.
8
1
812
2d
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
181
2d
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?
3
0
182
1w
Instruments in XCode 15.0.1 does not support CPU counters in A16(iPhone 14 Pro Max) with iOS 17.1?
Instruments in XCode 14 used to support CPU counters in A16 with iOS 16.x, but after I upgrade iOS to 17.1 and also XCode to 15.0.1, In "CPU Counters", it says "CPU Name: Unsupported" and thus I cannot choose "Sample by" events etc. Found some link on this:https://stackoverflow.com/questions/77344529/is-latest-instruments-not-support-a17-pro-for-cpu-counters Please help to confirm this is some known issue, and if so, how to fix it. Thanks!
3
0
830
1w
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
191
2w
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
190
2w
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
150
3w
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
185
3w
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
223
3w
Regarding network connection blocking of NSPrivacyTrackingDomains
・Xcode 15.1 ・The app is also compatible with Watch. In the privacy manifest, we defined NSPrivacyTracking to YES and NSPrivacyTrackingDomains to specific domains. Furthermore, to avoid warnings when uploading to Testflight, we have implemented a privacy manifest file in the app with the following configuration. ・Place the .xcprivacy files for the app itself and WatchExtension under their respective Target directories. ・Settings related to tracking domains are listed in .xcprivacy of the app itself. ・In .xcprivacy of WatchExtension, only describe the reason for UserDefault of NSPrivacyAccessedAPIType However, these implementations do not block network connections, "Fault" still occurs on "Point of Intereset instruments". Is there something wrong with my implementation?
0
0
276
Apr ’24
M1 macOS | Memory leaks while using APPLE shipped libcurl/8.1.2 (SecureTransport)
Hi, Machine: M1 sonoma 14.1.1 At my test I am using macOS shipped lib of curl, and its default LibreSSL, that is: curl 8.1.2 (x86_64-apple-darwin23.0) libcurl/8.1.2 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.12 nghttp2/1.55.1 I am getting memory leaks while running the following test: void CallCurl() { CURL *hnd; hnd = curl_easy_init(); curl_easy_setopt(hnd, CURLOPT_URL, "https://www.google.com"); curl_easy_perform(hnd); curl_easy_cleanup(hnd); } I track the leaks with macOS instruments, and I see that all leaks are from libcrypto. The leaks are measured after curl_easy_cleanup. Examples for the leaks stack frames: serialize_ECPublicKey ECDSA_do_verify_new ossl_ecdsa_verify EVP_DigestVerifyFinal tls13_server_certificate_verify_recv tls13_handshake_perform tls13_legacy_connect ossl_connect_common ssl_cf_connect cf_setup_connect cf_hc_connect Curl_conn_connect multi_runsingle curl_multi_perform curl_easy_perform CallCurl() main start ccMallocECCryptor CCECCryptorImportKey ECDSA_do_verify_new ossl_ecdsa_verify EVP_DigestVerifyFinal tls13_server_certificate_verify_recv tls13_handshake_perform tls13_legacy_connect ossl_connect_common ssl_cf_connect cf_setup_connect cf_hc_connect Curl_conn_connect multi_runsingle curl_multi_perform curl_easy_perform CallCurl() main start ccMallocECCryptor CCECCryptorImportKey ECDSA_do_verify_new ossl_ecdsa_verify EVP_DigestVerifyFinal tls13_server_certificate_verify_recv tls13_handshake_perform tls13_legacy_connect ossl_connect_common ssl_cf_connect cf_setup_connect cf_hc_connect Curl_conn_connect multi_runsingle curl_multi_perform curl_easy_perform CallCurl() main start Any you familiar with memory leaks issues at curl that is shipped with macOS? Is there a workaround? Thx, Moshe.
1
0
1.2k
Apr ’24
Instruments cannot find binary for disassembly
Since version 14, Instruments cannot find the binary to show disassembly of executable or library. It says: Error - Binary file for selected symbol is expected to be here: /Users/<user>/Library/Developer/Xcode/DerivedData/<project>/Build/Products/Release/<project>. The thing is that the path shown by Instruments is actually the right one, and of course the binary exists in this directory. Am I missing something somewhere ?
3
1
1.6k
Apr ’24