Spatial SDK integrates seamlessly with the OVR Metrics Tool, allowing users to monitor and customize metrics for their apps. The OVR Metrics Tool is a performance monitoring tool for Meta Quest headsets. It provides various metrics such as framerate, heat, and GPU and CPU throttling values. You can add custom metrics or messages to the OVR Metrics Tool, display them in real-time, and record them to CSV files for later analysis.
Setting up
Before getting started with the OVR Metrics Tool, follow these steps to get setup:
Install the latest version from the Meta Horizon Store. Or search for ovr metrics tool and download the app from the App Store on headset.
You can use the OVR Metrics Tool to capture predefined metrics, create new customized metrics, record debug data to a CSV file, and append custom developer data into the CSV.
Spatial SDK predefined metrics
You can register the OVRMetricsFeature in your app to add predefined metrics of interest, as in the following example:
// override this in your activity
override fun registerFeatures(): List<SpatialFeature> {
return listOf(..., OVRMetricsFeature(this,
this,
OVRMetricsDataModel() {
numberOfMeshes()
numberOfPanels()
numberOfGrabbables()
},
OVRMetricsScene({ scene }) {
viewOrigin()
viewRotationX()
numberOfObjects()
numberOfAnchors()
},
OVRMetricsNetwork({ networkStatsDisplaySystem.networking }) {
rtt()
packetLoss()
}))
}
You can check our sample app Custom Components Sample, which showcases real-time metrics utilizing OVR Metrics Tool.
Existing metrics
Spatial SDK categorizes metrics into groups such as 3DScene, DataModel, and Network. Each group includes specific metrics like:
Spatial Scene Metrics: viewOrigin, viewRotationX, numberOfObjects, etc.
You can also define app-specific metrics. For example, the OVRMetricsScene metrics group can create its own metrics as shown below:
class OVRMetricsScene(val getScene: () -> Scene?, init: OVRMetricsScene.() -> Unit = {}) : OVRMetricsGroup() {
val groupName = "SpatialScene"
init {
init()
}
fun numberOfObjects(): OVRMetricsScene {
metrics.add(
OVRMetric(
OVRMetricDefinition(
Name = "number_of_objects",
DisplayName = "Obj#",
Group = groupName,
RangeMin = 0,
RangeMax = 1000),
{ getScene()?.getNumberOfObjects() ?: 0 }))
return this
}
fun viewOrigin(): OVRMetricsScene {
overlayMessages.add({
val pos = getScene()?.getViewOrigin() ?: Vector3(0f)
val formater = DecimalFormat("#,##0.00")
"Pos: (${formater.format(pos.x)}, ${formater.format(pos.y)}, ${formater.format(pos.z)})"
})
return this
}
...
}
In OVR Metrics Tool, there are two distinct categories of customized metrics. The first category presents metrics in the form of diagrams and numerical values, while the second category displays string messages in an overlay format.
Diagrams and numbers: This includes the metrics definition (display name, the range, etc) and the function that generates the values in runtime (for example, numberOfObjects).
String message in overlay: This uses a function to generate a string that’s appended to the overlay message automatically (for example, viewOrigin).
Publish debug strings
The OVR Metrics Tool also supports APIs for publishing debug strings on overlays or CSV files:
import com.meta.spatial.ovrmetrics.OVRMetricsTool
// Set the overlay debug string
OVRMetricsTool.setOverlayDebugString("Debug String")
// Append debug string to CSV files
OVRMetricsTool.appendCsvDebugString("Debug String")