Class METAPerformanceMetrics
This extension provides APIs to enumerate and query performance metrics counters of the current XR device and XR application. Developers can perform performance analysis and do targeted optimization to the XR application using the performance metrics counters being collected. The application should not change its behavior based on the counter reads.
The performance metrics counters are organized into predefined XrPath values, under the root path pathname:/perfmetrics_meta. An application can query the available counters through EnumeratePerformanceMetricsCounterPathsMETA. Here is a list of the performance metrics counter paths that may be provided on Meta devices:
- pathname:/perfmetrics_meta/app/cpu_frametime
- pathname:/perfmetrics_meta/app/gpu_frametime
- pathname:/perfmetrics_meta/app/motion_to_photon_latency
- pathname:/perfmetrics_meta/compositor/cpu_frametime
- pathname:/perfmetrics_meta/compositor/gpu_frametime
- pathname:/perfmetrics_meta/compositor/dropped_frame_count
- pathname:/perfmetrics_meta/compositor/spacewarp_mode
- pathname:/perfmetrics_meta/device/cpu_utilization_average
- pathname:/perfmetrics_meta/device/cpu_utilization_worst
- pathname:/perfmetrics_meta/device/gpu_utilization
- pathname:/perfmetrics_meta/device/cpu0_utilization through pathname:/perfmetrics_meta/device/cpuX_utilization
After a session is created, an application can use SetPerformanceMetricsStateMETA to enable the performance metrics system for that session. An application can use QueryPerformanceMetricsCounterMETA to query a performance metrics counter on a session that has the performance metrics system enabled, or use GetPerformanceMetricsStateMETA to query if the performance metrics system is enabled.
Note: the measurement intervals of individual performance metrics counters are defined by the OpenXR runtime. The application must not make assumptions or change its behavior at runtime by measuring them.
In order to enable the functionality of this extension, the application must pass the name of the extension into CreateInstance via the XrInstanceCreateInfo::enabledExtensionNames parameter as indicated in the extension section.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe extension name.static final intThe extension specification version.static final intXrPerformanceMetricsCounterFlagBitsMETA - XrPerformanceMetricsCounterFlagBitsMETAstatic final intXrPerformanceMetricsCounterFlagBitsMETA - XrPerformanceMetricsCounterFlagBitsMETAstatic final intXrPerformanceMetricsCounterFlagBitsMETA - XrPerformanceMetricsCounterFlagBitsMETAstatic final intXrPerformanceMetricsCounterUnitMETA - XrPerformanceMetricsCounterUnitMETAstatic final intXrPerformanceMetricsCounterUnitMETA - XrPerformanceMetricsCounterUnitMETAstatic final intXrPerformanceMetricsCounterUnitMETA - XrPerformanceMetricsCounterUnitMETAstatic final intXrPerformanceMetricsCounterUnitMETA - XrPerformanceMetricsCounterUnitMETAstatic final intXrPerformanceMetricsCounterUnitMETA - XrPerformanceMetricsCounterUnitMETAstatic final intExtendsXrStructureType.static final intExtendsXrStructureType. -
Method Summary
Modifier and TypeMethodDescriptionstatic intnxrEnumeratePerformanceMetricsCounterPathsMETA(org.lwjgl.openxr.XrInstance instance, int counterPathCapacityInput, long counterPathCountOutput, long counterPaths) Unsafe version of:EnumeratePerformanceMetricsCounterPathsMETAstatic intnxrGetPerformanceMetricsStateMETA(XrSession session, long state) Unsafe version of:GetPerformanceMetricsStateMETAstatic intnxrQueryPerformanceMetricsCounterMETA(XrSession session, long counterPath, long counter) Unsafe version of:QueryPerformanceMetricsCounterMETAstatic intnxrSetPerformanceMetricsStateMETA(XrSession session, long state) Unsafe version of:SetPerformanceMetricsStateMETAstatic intxrEnumeratePerformanceMetricsCounterPathsMETA(org.lwjgl.openxr.XrInstance instance, IntBuffer counterPathCountOutput, @Nullable LongBuffer counterPaths) Enumerate all performance metrics counter paths that supported by the runtime.static intxrGetPerformanceMetricsStateMETA(XrSession session, XrPerformanceMetricsStateMETA state) Get current state of performance metrics.static intxrQueryPerformanceMetricsCounterMETA(XrSession session, long counterPath, XrPerformanceMetricsCounterMETA counter) Query performance metrics counter.static intxrSetPerformanceMetricsStateMETA(XrSession session, XrPerformanceMetricsStateMETA state) Enable/disable performance metrics.
-
Field Details
-
XR_META_performance_metrics_SPEC_VERSION
public static final int XR_META_performance_metrics_SPEC_VERSIONThe extension specification version.- See Also:
-
XR_META_PERFORMANCE_METRICS_EXTENSION_NAME
The extension name.- See Also:
-
XR_TYPE_PERFORMANCE_METRICS_STATE_META
public static final int XR_TYPE_PERFORMANCE_METRICS_STATE_METAExtendsXrStructureType.Enum values:
- See Also:
-
XR_TYPE_PERFORMANCE_METRICS_COUNTER_META
public static final int XR_TYPE_PERFORMANCE_METRICS_COUNTER_METAExtendsXrStructureType.Enum values:
- See Also:
-
XR_PERFORMANCE_METRICS_COUNTER_ANY_VALUE_VALID_BIT_META
public static final int XR_PERFORMANCE_METRICS_COUNTER_ANY_VALUE_VALID_BIT_METAXrPerformanceMetricsCounterFlagBitsMETA - XrPerformanceMetricsCounterFlagBitsMETAFlag Descriptions
PERFORMANCE_METRICS_COUNTER_ANY_VALUE_VALID_BIT_META— Indicates any of the values in XrPerformanceMetricsCounterMETA is valid.PERFORMANCE_METRICS_COUNTER_UINT_VALUE_VALID_BIT_META— Indicates the uintValue in XrPerformanceMetricsCounterMETA is valid.PERFORMANCE_METRICS_COUNTER_FLOAT_VALUE_VALID_BIT_META— Indicates the floatValue in XrPerformanceMetricsCounterMETA is valid.
- See Also:
-
XR_PERFORMANCE_METRICS_COUNTER_UINT_VALUE_VALID_BIT_META
public static final int XR_PERFORMANCE_METRICS_COUNTER_UINT_VALUE_VALID_BIT_METAXrPerformanceMetricsCounterFlagBitsMETA - XrPerformanceMetricsCounterFlagBitsMETAFlag Descriptions
PERFORMANCE_METRICS_COUNTER_ANY_VALUE_VALID_BIT_META— Indicates any of the values in XrPerformanceMetricsCounterMETA is valid.PERFORMANCE_METRICS_COUNTER_UINT_VALUE_VALID_BIT_META— Indicates the uintValue in XrPerformanceMetricsCounterMETA is valid.PERFORMANCE_METRICS_COUNTER_FLOAT_VALUE_VALID_BIT_META— Indicates the floatValue in XrPerformanceMetricsCounterMETA is valid.
- See Also:
-
XR_PERFORMANCE_METRICS_COUNTER_FLOAT_VALUE_VALID_BIT_META
public static final int XR_PERFORMANCE_METRICS_COUNTER_FLOAT_VALUE_VALID_BIT_METAXrPerformanceMetricsCounterFlagBitsMETA - XrPerformanceMetricsCounterFlagBitsMETAFlag Descriptions
PERFORMANCE_METRICS_COUNTER_ANY_VALUE_VALID_BIT_META— Indicates any of the values in XrPerformanceMetricsCounterMETA is valid.PERFORMANCE_METRICS_COUNTER_UINT_VALUE_VALID_BIT_META— Indicates the uintValue in XrPerformanceMetricsCounterMETA is valid.PERFORMANCE_METRICS_COUNTER_FLOAT_VALUE_VALID_BIT_META— Indicates the floatValue in XrPerformanceMetricsCounterMETA is valid.
- See Also:
-
XR_PERFORMANCE_METRICS_COUNTER_UNIT_GENERIC_META
public static final int XR_PERFORMANCE_METRICS_COUNTER_UNIT_GENERIC_METAXrPerformanceMetricsCounterUnitMETA - XrPerformanceMetricsCounterUnitMETADescription
Enum Description PERFORMANCE_METRICS_COUNTER_UNIT_GENERIC_METAthe performance counter unit is generic (unspecified). PERFORMANCE_METRICS_COUNTER_UNIT_PERCENTAGE_METAthe performance counter unit is percentage (%). PERFORMANCE_METRICS_COUNTER_UNIT_MILLISECONDS_METAthe performance counter unit is millisecond. PERFORMANCE_METRICS_COUNTER_UNIT_BYTES_METAthe performance counter unit is byte. PERFORMANCE_METRICS_COUNTER_UNIT_HERTZ_METAthe performance counter unit is hertz (Hz). See Also
- See Also:
-
XR_PERFORMANCE_METRICS_COUNTER_UNIT_PERCENTAGE_META
public static final int XR_PERFORMANCE_METRICS_COUNTER_UNIT_PERCENTAGE_METAXrPerformanceMetricsCounterUnitMETA - XrPerformanceMetricsCounterUnitMETADescription
Enum Description PERFORMANCE_METRICS_COUNTER_UNIT_GENERIC_METAthe performance counter unit is generic (unspecified). PERFORMANCE_METRICS_COUNTER_UNIT_PERCENTAGE_METAthe performance counter unit is percentage (%). PERFORMANCE_METRICS_COUNTER_UNIT_MILLISECONDS_METAthe performance counter unit is millisecond. PERFORMANCE_METRICS_COUNTER_UNIT_BYTES_METAthe performance counter unit is byte. PERFORMANCE_METRICS_COUNTER_UNIT_HERTZ_METAthe performance counter unit is hertz (Hz). See Also
- See Also:
-
XR_PERFORMANCE_METRICS_COUNTER_UNIT_MILLISECONDS_META
public static final int XR_PERFORMANCE_METRICS_COUNTER_UNIT_MILLISECONDS_METAXrPerformanceMetricsCounterUnitMETA - XrPerformanceMetricsCounterUnitMETADescription
Enum Description PERFORMANCE_METRICS_COUNTER_UNIT_GENERIC_METAthe performance counter unit is generic (unspecified). PERFORMANCE_METRICS_COUNTER_UNIT_PERCENTAGE_METAthe performance counter unit is percentage (%). PERFORMANCE_METRICS_COUNTER_UNIT_MILLISECONDS_METAthe performance counter unit is millisecond. PERFORMANCE_METRICS_COUNTER_UNIT_BYTES_METAthe performance counter unit is byte. PERFORMANCE_METRICS_COUNTER_UNIT_HERTZ_METAthe performance counter unit is hertz (Hz). See Also
- See Also:
-
XR_PERFORMANCE_METRICS_COUNTER_UNIT_BYTES_META
public static final int XR_PERFORMANCE_METRICS_COUNTER_UNIT_BYTES_METAXrPerformanceMetricsCounterUnitMETA - XrPerformanceMetricsCounterUnitMETADescription
Enum Description PERFORMANCE_METRICS_COUNTER_UNIT_GENERIC_METAthe performance counter unit is generic (unspecified). PERFORMANCE_METRICS_COUNTER_UNIT_PERCENTAGE_METAthe performance counter unit is percentage (%). PERFORMANCE_METRICS_COUNTER_UNIT_MILLISECONDS_METAthe performance counter unit is millisecond. PERFORMANCE_METRICS_COUNTER_UNIT_BYTES_METAthe performance counter unit is byte. PERFORMANCE_METRICS_COUNTER_UNIT_HERTZ_METAthe performance counter unit is hertz (Hz). See Also
- See Also:
-
XR_PERFORMANCE_METRICS_COUNTER_UNIT_HERTZ_META
public static final int XR_PERFORMANCE_METRICS_COUNTER_UNIT_HERTZ_METAXrPerformanceMetricsCounterUnitMETA - XrPerformanceMetricsCounterUnitMETADescription
Enum Description PERFORMANCE_METRICS_COUNTER_UNIT_GENERIC_METAthe performance counter unit is generic (unspecified). PERFORMANCE_METRICS_COUNTER_UNIT_PERCENTAGE_METAthe performance counter unit is percentage (%). PERFORMANCE_METRICS_COUNTER_UNIT_MILLISECONDS_METAthe performance counter unit is millisecond. PERFORMANCE_METRICS_COUNTER_UNIT_BYTES_METAthe performance counter unit is byte. PERFORMANCE_METRICS_COUNTER_UNIT_HERTZ_METAthe performance counter unit is hertz (Hz). See Also
- See Also:
-
-
Method Details
-
nxrEnumeratePerformanceMetricsCounterPathsMETA
public static int nxrEnumeratePerformanceMetricsCounterPathsMETA(org.lwjgl.openxr.XrInstance instance, int counterPathCapacityInput, long counterPathCountOutput, long counterPaths) Unsafe version of:EnumeratePerformanceMetricsCounterPathsMETA- Parameters:
counterPathCapacityInput- the capacity of thecounterPathsarray, or 0 to indicate a request to retrieve the required capacity.
-
xrEnumeratePerformanceMetricsCounterPathsMETA
public static int xrEnumeratePerformanceMetricsCounterPathsMETA(org.lwjgl.openxr.XrInstance instance, IntBuffer counterPathCountOutput, @Nullable LongBuffer counterPaths) Enumerate all performance metrics counter paths that supported by the runtime.C Specification
The
EnumeratePerformanceMetricsCounterPathsMETAfunction enumerates all performance metrics counter paths that supported by the runtime, it is defined as:XrResult xrEnumeratePerformanceMetricsCounterPathsMETA( XrInstance instance, uint32_t counterPathCapacityInput, uint32_t* counterPathCountOutput, XrPath* counterPaths);Valid Usage (Implicit)
- The
XR_META_performance_metricsextension must be enabled prior to callingEnumeratePerformanceMetricsCounterPathsMETA instancemust be a validXrInstancehandlecounterPathCountOutputmust be a pointer to auint32_tvalue- If
counterPathCapacityInputis not 0,counterPathsmust be a pointer to an array ofcounterPathCapacityInputXrPathvalues
Return Codes
- On success, this command returns
- On failure, this command returns
- Parameters:
instance- anXrInstancehandle previously created withCreateInstance.counterPathCountOutput- filled in by the runtime with the count ofcounterPathswritten or the required capacity in the case thatcounterPathCapacityInputis insufficient.counterPaths- an array ofXrPathfilled in by the runtime which contains all the available performance metrics counters, but can beNULLifcounterPathCapacityInputis 0.
- The
-
nxrSetPerformanceMetricsStateMETA
Unsafe version of:SetPerformanceMetricsStateMETA -
xrSetPerformanceMetricsStateMETA
public static int xrSetPerformanceMetricsStateMETA(XrSession session, XrPerformanceMetricsStateMETA state) Enable/disable performance metrics.C Specification
The
SetPerformanceMetricsStateMETAfunction is defined as:XrResult xrSetPerformanceMetricsStateMETA( XrSession session, const XrPerformanceMetricsStateMETA* state);Description
The
SetPerformanceMetricsStateMETAfunction enables or disables the performance metrics system.Valid Usage (Implicit)
- The
XR_META_performance_metricsextension must be enabled prior to callingSetPerformanceMetricsStateMETA sessionmust be a validXrSessionhandlestatemust be a pointer to a validXrPerformanceMetricsStateMETAstructure
Return Codes
- On success, this command returns
- On failure, this command returns
See Also
XrPerformanceMetricsStateMETA,GetPerformanceMetricsStateMETA- Parameters:
session- anXrSessionhandle previously created withCreateSession.state- a pointer to anXrPerformanceMetricsStateMETAstructure.
- The
-
nxrGetPerformanceMetricsStateMETA
Unsafe version of:GetPerformanceMetricsStateMETA -
xrGetPerformanceMetricsStateMETA
public static int xrGetPerformanceMetricsStateMETA(XrSession session, XrPerformanceMetricsStateMETA state) Get current state of performance metrics.C Specification
The
GetPerformanceMetricsStateMETAfunction is defined as:XrResult xrGetPerformanceMetricsStateMETA( XrSession session, XrPerformanceMetricsStateMETA* state);Description
The
GetPerformanceMetricsStateMETAfunction gets the current state of the performance metrics system.Valid Usage (Implicit)
- The
XR_META_performance_metricsextension must be enabled prior to callingGetPerformanceMetricsStateMETA sessionmust be a validXrSessionhandlestatemust be a pointer to anXrPerformanceMetricsStateMETAstructure
Return Codes
- On success, this command returns
- On failure, this command returns
See Also
XrPerformanceMetricsStateMETA,SetPerformanceMetricsStateMETA- Parameters:
session- anXrSessionhandle previously created withCreateSession.state- a pointer to anXrPerformanceMetricsStateMETAstructure.
- The
-
nxrQueryPerformanceMetricsCounterMETA
public static int nxrQueryPerformanceMetricsCounterMETA(XrSession session, long counterPath, long counter) Unsafe version of:QueryPerformanceMetricsCounterMETA -
xrQueryPerformanceMetricsCounterMETA
public static int xrQueryPerformanceMetricsCounterMETA(XrSession session, long counterPath, XrPerformanceMetricsCounterMETA counter) Query performance metrics counter.C Specification
The
QueryPerformanceMetricsCounterMETAfunction is defined as:XrResult xrQueryPerformanceMetricsCounterMETA( XrSession session, XrPath counterPath, XrPerformanceMetricsCounterMETA* counter);Description
The
QueryPerformanceMetricsCounterMETAfunction queries a performance metrics counter.The application should enable the performance metrics system (by calling
SetPerformanceMetricsStateMETA) before querying metrics usingQueryPerformanceMetricsCounterMETA. If the performance metrics system has not been enabled before callingQueryPerformanceMetricsCounterMETA, the runtime must returnERROR_VALIDATION_FAILURE.If
counterPathis not in the list returned byEnumeratePerformanceMetricsCounterPathsMETA, the runtime must returnERROR_PATH_UNSUPPORTED.Valid Usage (Implicit)
- The
XR_META_performance_metricsextension must be enabled prior to callingQueryPerformanceMetricsCounterMETA sessionmust be a validXrSessionhandlecountermust be a pointer to anXrPerformanceMetricsCounterMETAstructure
Return Codes
- On success, this command returns
- On failure, this command returns
See Also
- Parameters:
session- anXrSessionhandle previously created withCreateSession.counterPath- a valid performance metrics counter path.counter- a pointer to anXrPerformanceMetricsCounterMETAstructure.
- The
-