Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are mxSignpost events visible in Xcode Organizer?

I can wrap some important code (where I want to observe performance change with new App Versions) in

let handle = MXMetricManager.makeLogHandle(category: "Custom Category")
mxSignpost(.begin, log: handle, name: "Custom Event Name")

and

mxSignpost(.end, log: handle, name: "Custom Event Name")

And as far as I understand when I use MXMetricManager.shared.add(someClass) and in MXMetricManagerSubscriber delegate I receive reports every 24 hours, these reports will contain a separate performance sections for the intervals between mxSignpost(.begin) and mxSignpost(.end).

The question:

Can I see these performance separation in Xcode Organizer for "Custom Event Name" or "Custom Category" from the code above?

enter image description here

like image 991
Paul T. Avatar asked Oct 27 '25 11:10

Paul T.


1 Answers

The Metric organizer doesn't have this feature from the doc:

MetricKit goes beyond the metrics shown in the Metrics organizer to include average pixel luminance, cellular network conditions, and durations associated with custom OSSignpost events in your app. https://developer.apple.com/documentation/metrickit/improving_your_app_s_performance.

The only way to get signpost info it's inspecting MXMetricPayload:

import UIKit
import MetricKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        MXMetricManager.shared.add(self)
        return true
    }

    func applicationWillTerminate(_ application: UIApplication) {
        MXMetricManager.shared.remove(self)
    }
}

extension AppDelegate: MXMetricManagerSubscriber {
    func didReceive(_ payloads: [MXMetricPayload]) {
        for payload in payloads {
            if let signpostMetrics = payload.signpostMetrics {
                for metric in signpostMetrics {
                    print(metric.description)
                }
            }
        }
    }
}
like image 59
iUrii Avatar answered Oct 28 '25 23:10

iUrii



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!