IOCTL_USB_GET_FRAME_NUMBER_AND_QPC_FOR_TIME_SYNC IOCTL

Retrieves the system query performance counter (QPC) value synchronized with the frame and microframe.

Major Code

IRP_MJ_DEVICE_CONTROL

Input / Output Buffer

A pointer to a USB_FRAME_NUMBER_AND_QPC_FOR_TIME_SYNC_INFORMATION structure that contains the time tracking handled retrieved by the IOCTL_USB_START_TRACKING_FOR_TIME_SYNC request. On input, the caller can specify a frame and microframe number for which to retrieve the QPC value.

On output, the CurrentQueryPerformanceCounter member is set to a value predicted by the USB driver stack. The value represents the system QPC value in microseconds.

Input / Output Buffer Length

The size of the USB_FRAME_NUMBER_AND_QPC_FOR_TIME_SYNC_INFORMATION structure.

Status Block

Irp->IoStatus.Status is set to STATUS_SUCCESS if the request is successful. Otherwise, Status indicates an the appropriate error condition as a NTSTATUS code.

Remarks

On input, the caller can optionally specify a frame and microframe for which the caller is interested in knowing the associated system QPC value. Those values must be provided in the InputFrameNumber and InputMicroFrameNumber members of USB_FRAME_NUMBER_AND_QPC_FOR_TIME_SYNC_INFORMATION, respectively. On output, the USB driver stack fills the QueryPerformanceCounterAtInputFrameOrMicroFrame member with a system QPC value calculated by the USB driver stack.

If the caller is not interested those values, InputFrameNumber and InputMicroFrameNumber values must be initialized to 0. On output, QueryPerformanceCounterAtInputFrameOrMicroFrame is set to 0.

If the USB driver stack encountered a frame boundary, the PredictedAccuracyInMicroSeconds value indicates accuracy in 125-microseconds unit. It also takes into consideration if sufficient time has elapsed since tracking is enabled.

The USB driver stack can also predict the system QPC value that are synchronized with bus frame and microframe numbers retrieved directly from the host controller.

In order to predict QPC values with accuracy, the USB driver stack might poll the frame and microframe time sources. That polling operation might require raising or lowering of IRQL to eliminate scheduling delays interfering with the accuracy of the value (after attempting to read the register/QPC timer from passive IRQL for a given number of tries). Given this possible additional CPU cost, this interface must only be used to get associated USB bus and QPC values and must not be used as a replacement to existing methods for retrieving just the USB bus time.

Requirements

   
Minimum supported client Windows 10, version 1709
Minimum supported server Windows Server 2016
Header usbioctl.h
IRQL "<= DISPATCH_LEVEL"

See Also

Creating IOCTL Requests in Drivers

WdfIoTargetSendInternalIoctlOthersSynchronously

WdfIoTargetSendInternalIoctlSynchronously

WdfIoTargetSendIoctlSynchronously