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.
To trace an Objective-C method, add a MINT_METHOD_TRACE_START call to the beginning of your method and a MINT_METHOD_TRACE_STOP call to the end of it, as follows:
// Objective-C - (void)test { MINT_METHOD_TRACE_START NSLog(@"Hello, World"); MINT_METHOD_TRACE_STOP }
If you are not using ARC, use the MINT_NONARC_METHOD_TRACE_STOP macro to avoid a memory leak issue.
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 trace method automatically picks up performance metrics for your method and sends it to Splunk Enterprise. 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 |
This documentation applies to the following versions of Splunk MINT™ SDK for iOS (Legacy): 5.2.x
Feedback submitted, thanks!