Does the new HTTP Traffic instrument require iOS15 running on the device? I am attempting to profile my app and I get an error saying 'This device is lacking a required capability'?
Instruments
RSS for tagInstruments is a performance-analysis and testing tool for iOS, iPadOS, watchOS, tvOS, and macOS apps.
Post
Replies
Boosts
Views
Activity
When trying to profile any process with the Instruments CPU Profiler I get this message:
(Before run started) No allocated PMI record.
Not sure what to do here. I tried other instruments like time profile and that works fine so not sure what to do here... Didn't find any people having similar issues when googling so I'm hoping someone here can help me out.
Im using a m1 max 14 inch macbook pro with macOS 12.3 and instruments 13.0 (13A1030d)
I want to test app launch performance in my project.
Therefore I tried to use performance test with measure func and XCTApplicationLaunchMetric. But after test completion there is no any result with average time.
Here is a test example:
func testLaunchPerformance() throws {
if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) {
// This measures how long it takes to launch your application.
measure(metrics: [XCTApplicationLaunchMetric()]) {
XCUIApplication().launch()
}
}
}
But when I create a new empty project and add the same performance test – it works and shows app launch results.
1st image is a real project test – there is no test result.
and the 2nd image is a demo empty project test – it has performance result diagram.
I am running test on MacBook with M1 Pro chip. However, when my colleague is running the same performance test on our real project with Intel based MacBook Pro – all is fine, it shows app launch results correctly as my demo project.
I have no idea how it can be fixed, because it seems that it depends on M1 chip 🤷🏻♂️.
May be somebody have a solution?
I just downloaded Xcode 15 RC and iOS 17 RC on an iPhone Xr. When running the app it seems to run fine however when trying to run in profile mode I get the error:
Failed to install embedded profile for com...* : 0xe800801f (Attempted to install a Beta profile without the proper entitlement.)
Verify that the Developer App certificate for your account is trusted on your device. Open Settings on the device and navigate to General -> VPN & Device Management, then select your Developer App certificate to trust it.
Does anyone have any insight into what the issue may be? There is nothing to select within VPN & Device Management when I navigate there
Instruments CPU Profiler failed to start the profilable app (get-task-allow is set to true) with error "No PMI Record Found". Device is iPhone 13 Pro currently running iOS 17.0.3. Tried to profile in instruments shipped with Xcode 14.3.1, Xcode 15.0.1 and Xcode 15.1 Beta, same issue across. If it helps, I was able to successfully profile on iPhone X running iOS f16.7 using Xcode 14.2 instruments.
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!
I'm tracing a process, specifically focusing on the Metal device track, which records frames from other processes like Terminal, WindowServer, and sometimes processes that utilize the GPU.
I attempted tracing with all apps closed and only Instruments running. However, it also records traces for Instruments.
This behavior wasn't present in previous versions of Instruments. Was there a recent change in Instruments/Xcode 15.0.1? I cannot find any relevant information about this in the release notes either.
Is there a way to configure Instruments to record only the running process?
Steps to reproduce:
Open Instruments app
Settings
Select recording tab (Next to General)
Click Open Keyboard Shortcut preferences to produce the aforementioned error.
Profiler Version 15.1 (15C65) - Instruments
macOs 14.1.2 (23B92)
Thanks all.
Instruments freeze when WKWebView is created
I create a very simple mac os application
If I create a WKWebView like this
"
(void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.webview = [[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 500, 500)];
}
"
Then the instruments freeze when I record allocations
Why?
If I remove the creation of WKWebView, everything works fine
I'm using Xcode 14.2
When I use Instruments to record Allocation, the phone will display a dialog box indicating that the phone is unlocked when the screen is locked, as shown in Figure 1.
When I have started recording allocation and lock the screen 10s later, the allocation can be recorded normally. For details, see Figure 2. I want to know why. Start recording for 10s and lock the screen on the device. The recording can be performed normally. What is the principle of this?
In my iOS project, there is an infrequent crash related to virtual memory problem. Therefore, I plan to use UITest in combination with Product/Perform Action/Profile "TestCaseName" to conduct Game Performance-type testing. This allows the automatic testing to continuously operate until the profile stops recording upon a crash. This enables me to observe the various states of the program at the time of the crash.
However, I have found that the UITest using Profile is highly unstable. The UITestCase often terminates unexpectedly during execution, leading to failed tests (Instruments is still working). Sometimes, the app is terminated immediately after startup. It seems that the use of sleep() in the code can easily cause interruption issues, which do not occur during normal UI testing.
I am wondering if anyone has experience using Profile for UITest and whether they have encountered the issues I described."
Working Environment:
XCode14.3.1, iPhone Device iOS17.2
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.
I asked a similar question last year, and got no responses. I've written a much simpler (no network extension!) case that seems to demonstrate what I'm confused about.
Simple app with an XPC service. I have an ObjectiveC class TestObject which has an NSString* and an NSData* (which I never actually use). I have a protocol defined in Swift:
@objc protocol XPCTestServiceProtocol {
func logData(entry: TestObject) -> Void
func logData(entry: TestObject, completion: ((String) -> Void))
}
In the Switt XPC service, the code is:
class XPCTestService: NSObject, XPCTestServiceProtocol {
var totalBytes = 0
var lastName = ""
@objc func logData(entry: TestObject) {
totalBytes += (entry.data?.count ?? 0)
}
@objc func logData(entry: TestObject, completion: ((String) -> Void)) {
totalBytes += (entry.data?.count ?? 0)
completion("Finished")
}
I've got this code in the ObjC app:
id<XPCTestServiceProtocol> proxy = [self.connection remoteObjectProxyWithErrorHandler:^(NSError* error) {
self.stopRun = YES;
NSLog(@"Proxy got error %@", error);
}];
while (self.stopRun == NO) {
@synchronized (self) {
NSNumber *objNum = [NSNumber numberWithUnsignedLongLong:self.count++];
NSString *objName = [NSString stringWithFormat:@"Object %@", objNum];
TestObject __weak *toWeak = to;
#if USE_COMPLETION
[proxy logDataWithEntry:to completion:^(NSString *str) {
to = nil;
}];
#else
[proxy logDataWithEntry:to];
#endif
}
}
attached to a start button (and self.stopRun is set by a stop button, this is all super simple).
So I run that, start the test, and things start going (122k calls/second it says). According to Activity Monitor, my app is using about 1gbyte after 20 seconds or so.
However, if I run it under Instruments' Leaks template... Activity Monitor says it's used only about 60mbytes. (And at the end of the run, Instruments says it's used about 30mbytes.)
Now... if I use the completion and a synchronous proxy, then even without Instruments, Activity Monitor says it's 60mbytes or so.
Is the memory reported by Activity Monitor real? Or not real?
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.
If I try to run Instrument's logger for an app downloaded from TestFlight it says
"Permission to debug app name was denied".
"Recover Suggestion: The app must be debuggable and signed with 'get-task-allow'.
How do you make the app debuggable? (I tried creating an archive with the scheme set to Debug, but after uploading that to TestFlight, it doesn't appear. So presumably its not possible to upload an app built with debug scheme builds to TF?).
Therefore how can I make a TF build debuggable?, and how to sign it with get-task-allow?
Does it have to be a developer distribution .ipa rather than a TestFlight build to enable Instruments/Logger to run it?
Xcode Version 15.2 (15C500b)
After upgrading Xcode from 14 to 15.2 I am not able to attach system extension (packettunnel) process to Instruments tools for memory debugging. Same is working fine with Xcode 14.
Error displayed: "Process No Longer Exists". But the service is running and is listed in process list.
% ps -ax | grep -i pkttunnel | grep -v grep
61910 ?? 0:01.04 /Library/SystemExtensions/5F4AF6EF-****-****-****-F11****9CE78/com.******.client.*****-Client.***ui.***pkttunnel.systemextension/Contents/MacOS/com.******.client.*****-Client.***ui.***pkttunnel.systemextension
Note: I am able to attach a normal program to Instruments tool for memory debugging, I have noticed this issue with system extension processes only.
What's the best way in Instruments, to measure the amount of time spent on large memory copies? For a very simple example, when directly calling memcpy? Memory copying does not show up in the time profiler, it's not a VM cache miss or zeroing event, etc so it doesn't show there, it doesn't (as far as I can tell) show up in the system trace, and there aren't any other choices.
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?
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.
Hello,
This relates to NSTrackingDomains for Privacy Manifest.
Following doc here https://developer.apple.com/documentation/xcode/detecting-when-your-app-contacts-domains-that-may-be-profiling-users. (Also, I'm quite new to using the Network Instrument).
I'm not seeing any "Points of Interest" but I know my app has domains that should be shown as "Faults". Do I need to os_log to my Objective-C codebase. I don't have access to the code of various 3rd party SDKs. The doc mentioned above made it sound like these domains should automagically appear. Thanks!