Trace Objective-C methods
If you are using Objective-C, you can log trace information on specific methods in your code to measure performance using the following macros:
- MINT_METHOD_TRACE_START: Starts the method trace.
- MINT_METHOD_TRACE_STOP: Stops the method trace.
- MINT_NONARC_METHOD_TRACE_STOP: Stops the method trace. Use this macro if you are not using ARC.
Note You cannot use this feature with Swift, which does not support macros.
Start and stop the trace just once in a given method, as follows:
// Objective-C - (void)test { MINT_METHOD_TRACE_START NSLog(@"Hello, World"); MINT_METHOD_TRACE_STOP }
Then, run a search in Splunk Web on the "mint:methodinvocation" sourcetype to view trace information and performance metrics, for example:
index=mint sourcetype="mint:methodinvocation" | head 5
The following fields contain trace information:
- threadID: The thread ID.
- method: The method that was traced.
- elapsedTime: The elapsed time between starting and stopping the method trace, in nanoseconds.
Here's an example result:
{ apiKey: 12345 appEnvironment: Testing appRunningState: Foreground appVersionCode: 1 appVersionName: 1.0 batteryLevel: -100 carrier: NA connection: WIFI currentView: GHUnitIOSViewController device: x86_64 elapsedTime: 52077306 extraData: { } locale: US method: -[SplunkiOSTests testMethodTrace] msFromStart: 1679 osVersion: 9.2 packageName: SplunkTests platform: iOS remoteIP: 204.107.141.240 screenOrientation: Portrait sdkVersion: 5.0.0 session_id: 83B0BFA2-D224-4EE8-B65F-1A9C6A2A790A state: CONNECTED threadID: 19207 transactions: { } userIdentifier: NA uuid: fake_uid }
View memory warnings | Disable network monitoring for URLs |
This documentation applies to the following versions of Splunk MINT™ SDK for iOS (EOL): 5.1.x
Feedback submitted, thanks!