mxSignpost 事件在 Xcode Organizer 中可见吗?
Are mxSignpost events visible in Xcode Organizer?
我可以在
中包装一些重要的代码(我想在其中观察新应用版本的性能变化)
let handle = MXMetricManager.makeLogHandle(category: "Custom Category")
mxSignpost(.begin, log: handle, name: "Custom Event Name")
和
mxSignpost(.end, log: handle, name: "Custom Event Name")
据我所知,当我使用 MXMetricManager.shared.add(someClass)
和 MXMetricManagerSubscriber
委托时,我每 24 小时收到一次报告,这些报告将包含一个单独的性能部分,用于 mxSignpost(.begin)
之间的间隔] 和 mxSignpost(.end)
.
问题:
我可以在Xcode组织器中看到上面代码中“自定义事件名称”或“自定义类别”的这些性能分离吗?
指标管理器没有文档中的此功能:
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.
获取正在检查的路标信息的唯一方法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)
}
}
}
}
}
我可以在
中包装一些重要的代码(我想在其中观察新应用版本的性能变化)let handle = MXMetricManager.makeLogHandle(category: "Custom Category")
mxSignpost(.begin, log: handle, name: "Custom Event Name")
和
mxSignpost(.end, log: handle, name: "Custom Event Name")
据我所知,当我使用 MXMetricManager.shared.add(someClass)
和 MXMetricManagerSubscriber
委托时,我每 24 小时收到一次报告,这些报告将包含一个单独的性能部分,用于 mxSignpost(.begin)
之间的间隔] 和 mxSignpost(.end)
.
问题:
我可以在Xcode组织器中看到上面代码中“自定义事件名称”或“自定义类别”的这些性能分离吗?
指标管理器没有文档中的此功能:
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.
获取正在检查的路标信息的唯一方法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)
}
}
}
}
}