aboutsummaryrefslogtreecommitdiffstats
path: root/LibOVRKernel/Src/Tracing
diff options
context:
space:
mode:
Diffstat (limited to 'LibOVRKernel/Src/Tracing')
-rw-r--r--LibOVRKernel/Src/Tracing/LibOVREvents.h1076
-rw-r--r--LibOVRKernel/Src/Tracing/LibOVREvents.manbin0 -> 42100 bytes
-rw-r--r--LibOVRKernel/Src/Tracing/LibOVREventsTEMP.BINbin0 -> 8874 bytes
-rw-r--r--LibOVRKernel/Src/Tracing/LibOVREvents_MSG00001.binbin0 -> 884 bytes
-rw-r--r--LibOVRKernel/Src/Tracing/README.md55
-rw-r--r--LibOVRKernel/Src/Tracing/Tracing.h197
-rw-r--r--LibOVRKernel/Src/Tracing/build.cmd15
-rw-r--r--LibOVRKernel/Src/Tracing/clean.cmd6
-rw-r--r--LibOVRKernel/Src/Tracing/install.cmd115
9 files changed, 1464 insertions, 0 deletions
diff --git a/LibOVRKernel/Src/Tracing/LibOVREvents.h b/LibOVRKernel/Src/Tracing/LibOVREvents.h
new file mode 100644
index 0000000..dcdd688
--- /dev/null
+++ b/LibOVRKernel/Src/Tracing/LibOVREvents.h
@@ -0,0 +1,1076 @@
+//**********************************************************************`
+//* This is an include file generated by Message Compiler. *`
+//* *`
+//* Copyright (c) Microsoft Corporation. All Rights Reserved. *`
+//**********************************************************************`
+#pragma once
+#include <wmistr.h>
+#include <evntrace.h>
+#include "evntprov.h"
+//
+// Initial Defs
+//
+#if !defined(ETW_INLINE)
+#define ETW_INLINE DECLSPEC_NOINLINE __inline
+#endif
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+//
+// Allow Diasabling of code generation
+//
+#ifndef MCGEN_DISABLE_PROVIDER_CODE_GENERATION
+#if !defined(McGenDebug)
+#define McGenDebug(a,b)
+#endif
+
+
+#if !defined(MCGEN_TRACE_CONTEXT_DEF)
+#define MCGEN_TRACE_CONTEXT_DEF
+typedef struct _MCGEN_TRACE_CONTEXT
+{
+ TRACEHANDLE RegistrationHandle;
+ TRACEHANDLE Logger;
+ ULONGLONG MatchAnyKeyword;
+ ULONGLONG MatchAllKeyword;
+ ULONG Flags;
+ ULONG IsEnabled;
+ UCHAR Level;
+ UCHAR Reserve;
+ USHORT EnableBitsCount;
+ PULONG EnableBitMask;
+ const ULONGLONG* EnableKeyWords;
+ const UCHAR* EnableLevel;
+} MCGEN_TRACE_CONTEXT, *PMCGEN_TRACE_CONTEXT;
+#endif
+
+#if !defined(MCGEN_LEVEL_KEYWORD_ENABLED_DEF)
+#define MCGEN_LEVEL_KEYWORD_ENABLED_DEF
+FORCEINLINE
+BOOLEAN
+McGenLevelKeywordEnabled(
+ _In_ PMCGEN_TRACE_CONTEXT EnableInfo,
+ _In_ UCHAR Level,
+ _In_ ULONGLONG Keyword
+ )
+{
+ //
+ // Check if the event Level is lower than the level at which
+ // the channel is enabled.
+ // If the event Level is 0 or the channel is enabled at level 0,
+ // all levels are enabled.
+ //
+
+ if ((Level <= EnableInfo->Level) || // This also covers the case of Level == 0.
+ (EnableInfo->Level == 0)) {
+
+ //
+ // Check if Keyword is enabled
+ //
+
+ if ((Keyword == (ULONGLONG)0) ||
+ ((Keyword & EnableInfo->MatchAnyKeyword) &&
+ ((Keyword & EnableInfo->MatchAllKeyword) == EnableInfo->MatchAllKeyword))) {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+
+}
+#endif
+
+#if !defined(MCGEN_EVENT_ENABLED_DEF)
+#define MCGEN_EVENT_ENABLED_DEF
+FORCEINLINE
+BOOLEAN
+McGenEventEnabled(
+ _In_ PMCGEN_TRACE_CONTEXT EnableInfo,
+ _In_ PCEVENT_DESCRIPTOR EventDescriptor
+ )
+{
+
+ return McGenLevelKeywordEnabled(EnableInfo, EventDescriptor->Level, EventDescriptor->Keyword);
+
+}
+#endif
+
+
+//
+// EnableCheckMacro
+//
+#ifndef MCGEN_ENABLE_CHECK
+#define MCGEN_ENABLE_CHECK(Context, Descriptor) (Context.IsEnabled && McGenEventEnabled(&Context, &Descriptor))
+#endif
+
+#if !defined(MCGEN_CONTROL_CALLBACK)
+#define MCGEN_CONTROL_CALLBACK
+
+DECLSPEC_NOINLINE __inline
+VOID
+__stdcall
+McGenControlCallbackV2(
+ _In_ LPCGUID SourceId,
+ _In_ ULONG ControlCode,
+ _In_ UCHAR Level,
+ _In_ ULONGLONG MatchAnyKeyword,
+ _In_ ULONGLONG MatchAllKeyword,
+ _In_opt_ PEVENT_FILTER_DESCRIPTOR FilterData,
+ _Inout_opt_ PVOID CallbackContext
+ )
+/*++
+
+Routine Description:
+
+ This is the notification callback for Vista.
+
+Arguments:
+
+ SourceId - The GUID that identifies the session that enabled the provider.
+
+ ControlCode - The parameter indicates whether the provider
+ is being enabled or disabled.
+
+ Level - The level at which the event is enabled.
+
+ MatchAnyKeyword - The bitmask of keywords that the provider uses to
+ determine the category of events that it writes.
+
+ MatchAllKeyword - This bitmask additionally restricts the category
+ of events that the provider writes.
+
+ FilterData - The provider-defined data.
+
+ CallbackContext - The context of the callback that is defined when the provider
+ called EtwRegister to register itself.
+
+Remarks:
+
+ ETW calls this function to notify provider of enable/disable
+
+--*/
+{
+ PMCGEN_TRACE_CONTEXT Ctx = (PMCGEN_TRACE_CONTEXT)CallbackContext;
+ ULONG Ix;
+#ifndef MCGEN_PRIVATE_ENABLE_CALLBACK_V2
+ UNREFERENCED_PARAMETER(SourceId);
+ UNREFERENCED_PARAMETER(FilterData);
+#endif
+
+ if (Ctx == NULL) {
+ return;
+ }
+
+ switch (ControlCode) {
+
+ case EVENT_CONTROL_CODE_ENABLE_PROVIDER:
+ Ctx->Level = Level;
+ Ctx->MatchAnyKeyword = MatchAnyKeyword;
+ Ctx->MatchAllKeyword = MatchAllKeyword;
+ Ctx->IsEnabled = EVENT_CONTROL_CODE_ENABLE_PROVIDER;
+
+ for (Ix = 0; Ix < Ctx->EnableBitsCount; Ix += 1) {
+ if (McGenLevelKeywordEnabled(Ctx, Ctx->EnableLevel[Ix], Ctx->EnableKeyWords[Ix]) != FALSE) {
+ Ctx->EnableBitMask[Ix >> 5] |= (1 << (Ix % 32));
+ } else {
+ Ctx->EnableBitMask[Ix >> 5] &= ~(1 << (Ix % 32));
+ }
+ }
+ break;
+
+ case EVENT_CONTROL_CODE_DISABLE_PROVIDER:
+ Ctx->IsEnabled = EVENT_CONTROL_CODE_DISABLE_PROVIDER;
+ Ctx->Level = 0;
+ Ctx->MatchAnyKeyword = 0;
+ Ctx->MatchAllKeyword = 0;
+ if (Ctx->EnableBitsCount > 0) {
+ RtlZeroMemory(Ctx->EnableBitMask, (((Ctx->EnableBitsCount - 1) / 32) + 1) * sizeof(ULONG));
+ }
+ break;
+
+ default:
+ break;
+ }
+
+#ifdef MCGEN_PRIVATE_ENABLE_CALLBACK_V2
+ //
+ // Call user defined callback
+ //
+ MCGEN_PRIVATE_ENABLE_CALLBACK_V2(
+ SourceId,
+ ControlCode,
+ Level,
+ MatchAnyKeyword,
+ MatchAllKeyword,
+ FilterData,
+ CallbackContext
+ );
+#endif
+
+ return;
+}
+
+#endif
+#endif // MCGEN_DISABLE_PROVIDER_CODE_GENERATION
+//+
+// Provider OVR-SDK-LibOVR Event Count 19
+//+
+EXTERN_C __declspec(selectany) const GUID LibOVRProvider = {0x553787fc, 0xd3d7, 0x4f5e, {0xac, 0xb2, 0x15, 0x97, 0xc7, 0x20, 0x9b, 0x3c}};
+
+//
+// Channel
+//
+#define DEBUG_CHANNEL 0x10
+#define ANALYTIC_CHANNEL 0x11
+#define ERROR_CHANNEL 0x12
+
+//
+// Opcodes
+//
+#define FN_CALL 0xa
+#define FN_RETURN 0xb
+#define FN_WAYPOINT 0xc
+#define DIS_BEGIN 0xd
+#define DIS_WAITGPU 0xe
+#define DIS_PRESENT 0xf
+#define DIS_END 0x10
+#define HMD_DESC 0x11
+#define CAM_RECEIVE 0x12
+#define CAM_REQUEST 0x13
+
+//
+// Tasks
+//
+#define FN_TRACE 0x1
+#define DIS_TRACE 0x2
+#define HMD_TRACE 0x3
+#define CAMERA_TRACE 0x4
+#define LOG_TRACE 0x5
+
+//
+// Event Descriptors
+//
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR Call = {0x0, 0x0, 0x11, 0x4, 0xa, 0x1, 0x4000000000000000};
+#define Call_value 0x0
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR Return = {0x1, 0x0, 0x11, 0x4, 0xb, 0x1, 0x4000000000000000};
+#define Return_value 0x1
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR Waypoint = {0x2, 0x0, 0x10, 0x4, 0xc, 0x1, 0x8000000000000000};
+#define Waypoint_value 0x2
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR DistortionBegin = {0x4, 0x0, 0x11, 0x4, 0xd, 0x2, 0x4000000000000000};
+#define DistortionBegin_value 0x4
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR DistortionWaitGPU = {0x5, 0x0, 0x11, 0x4, 0xe, 0x2, 0x4000000000000000};
+#define DistortionWaitGPU_value 0x5
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR DistortionPresent = {0x6, 0x0, 0x11, 0x4, 0xf, 0x2, 0x4000000000000000};
+#define DistortionPresent_value 0x6
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR DistortionEnd = {0x7, 0x0, 0x11, 0x4, 0x10, 0x2, 0x4000000000000000};
+#define DistortionEnd_value 0x7
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR HmdDesc = {0x8, 0x0, 0x11, 0x4, 0x11, 0x3, 0x4000000000000000};
+#define HmdDesc_value 0x8
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR CameraFrameReceived = {0x9, 0x0, 0x11, 0x4, 0x12, 0x4, 0x4000000000000000};
+#define CameraFrameReceived_value 0x9
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR CameraBeginProcessing = {0xa, 0x0, 0x11, 0x4, 0xd, 0x4, 0x4000000000000000};
+#define CameraBeginProcessing_value 0xa
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR CameraFrameRequest = {0xb, 0x0, 0x11, 0x4, 0x13, 0x4, 0x4000000000000000};
+#define CameraFrameRequest_value 0xb
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR CameraEndProcessing = {0xc, 0x0, 0x11, 0x4, 0x10, 0x4, 0x4000000000000000};
+#define CameraEndProcessing_value 0xc
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR CameraSkippedFrames = {0xd, 0x0, 0x11, 0x4, 0xc, 0x4, 0x4000000000000000};
+#define CameraSkippedFrames_value 0xd
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR JSONChunk = {0xe, 0x0, 0x11, 0x4, 0xc, 0x3, 0x4000000000000000};
+#define JSONChunk_value 0xe
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR LogDebugMessage = {0xf, 0x0, 0x10, 0x5, 0xc, 0x5, 0x8000000000000000};
+#define LogDebugMessage_value 0xf
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR LogInfoMessage = {0x10, 0x0, 0x11, 0x4, 0xc, 0x5, 0x4000000000000000};
+#define LogInfoMessage_value 0x10
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR LogErrorMessage = {0x11, 0x0, 0x12, 0x2, 0xc, 0x5, 0x2000000000000000};
+#define LogErrorMessage_value 0x11
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR HmdTrackingState = {0x12, 0x0, 0x11, 0x4, 0xc, 0x3, 0x4000000000000000};
+#define HmdTrackingState_value 0x12
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR CameraBlobs = {0x13, 0x0, 0x11, 0x4, 0xc, 0x4, 0x4000000000000000};
+#define CameraBlobs_value 0x13
+
+//
+// Note on Generate Code from Manifest Windows Vista and above
+//
+//Structures : are handled as a size and pointer pairs. The macro for the event will have an extra
+//parameter for the size in bytes of the structure. Make sure that your structures have no extra padding.
+//
+//Strings: There are several cases that can be described in the manifest. For array of variable length
+//strings, the generated code will take the count of characters for the whole array as an input parameter.
+//
+//SID No support for array of SIDs, the macro will take a pointer to the SID and use appropriate
+//GetLengthSid function to get the length.
+//
+
+//
+// Allow Diasabling of code generation
+//
+#ifndef MCGEN_DISABLE_PROVIDER_CODE_GENERATION
+
+//
+// Globals
+//
+
+
+//
+// Event Enablement Bits
+//
+
+EXTERN_C __declspec(selectany) DECLSPEC_CACHEALIGN ULONG OVR_SDK_LibOVREnableBits[1];
+EXTERN_C __declspec(selectany) const ULONGLONG OVR_SDK_LibOVRKeywords[4] = {0x4000000000000000, 0x8000000000000000, 0x8000000000000000, 0x2000000000000000};
+EXTERN_C __declspec(selectany) const UCHAR OVR_SDK_LibOVRLevels[4] = {4, 4, 5, 2};
+EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT LibOVRProvider_Context = {0, 0, 0, 0, 0, 0, 0, 0, 4, OVR_SDK_LibOVREnableBits, OVR_SDK_LibOVRKeywords, OVR_SDK_LibOVRLevels};
+
+EXTERN_C __declspec(selectany) REGHANDLE OVR_SDK_LibOVRHandle = (REGHANDLE)0;
+
+#if !defined(McGenEventRegisterUnregister)
+#define McGenEventRegisterUnregister
+DECLSPEC_NOINLINE __inline
+ULONG __stdcall
+McGenEventRegister(
+ _In_ LPCGUID ProviderId,
+ _In_opt_ PENABLECALLBACK EnableCallback,
+ _In_opt_ PVOID CallbackContext,
+ _Inout_ PREGHANDLE RegHandle
+ )
+/*++
+
+Routine Description:
+
+ This function register the provider with ETW USER mode.
+
+Arguments:
+ ProviderId - Provider Id to be register with ETW.
+
+ EnableCallback - Callback to be used.
+
+ CallbackContext - Context for this provider.
+
+ RegHandle - Pointer to Registration handle.
+
+Remarks:
+
+ If the handle != NULL will return ERROR_SUCCESS
+
+--*/
+{
+ ULONG Error;
+
+
+ if (*RegHandle) {
+ //
+ // already registered
+ //
+ return ERROR_SUCCESS;
+ }
+
+ Error = EventRegister( ProviderId, EnableCallback, CallbackContext, RegHandle);
+
+ return Error;
+}
+
+
+DECLSPEC_NOINLINE __inline
+ULONG __stdcall
+McGenEventUnregister(_Inout_ PREGHANDLE RegHandle)
+/*++
+
+Routine Description:
+
+ Unregister from ETW USER mode
+
+Arguments:
+ RegHandle this is the pointer to the provider context
+Remarks:
+ If Provider has not register RegHandle = NULL,
+ return ERROR_SUCCESS
+--*/
+{
+ ULONG Error;
+
+
+ if(!(*RegHandle)) {
+ //
+ // Provider has not registerd
+ //
+ return ERROR_SUCCESS;
+ }
+
+ Error = EventUnregister(*RegHandle);
+ *RegHandle = (REGHANDLE)0;
+
+ return Error;
+}
+#endif
+//
+// Register with ETW Vista +
+//
+#ifndef EventRegisterOVR_SDK_LibOVR
+#define EventRegisterOVR_SDK_LibOVR() McGenEventRegister(&LibOVRProvider, McGenControlCallbackV2, &LibOVRProvider_Context, &OVR_SDK_LibOVRHandle)
+#endif
+
+//
+// UnRegister with ETW
+//
+#ifndef EventUnregisterOVR_SDK_LibOVR
+#define EventUnregisterOVR_SDK_LibOVR() McGenEventUnregister(&OVR_SDK_LibOVRHandle)
+#endif
+
+//
+// Enablement check macro for Call
+//
+
+#define EventEnabledCall() ((OVR_SDK_LibOVREnableBits[0] & 0x00000001) != 0)
+
+//
+// Event Macro for Call
+//
+#define EventWriteCall(Name, Line, FrameID)\
+ EventEnabledCall() ?\
+ Template_zdq(OVR_SDK_LibOVRHandle, &Call, Name, Line, FrameID)\
+ : ERROR_SUCCESS\
+
+//
+// Enablement check macro for Return
+//
+
+#define EventEnabledReturn() ((OVR_SDK_LibOVREnableBits[0] & 0x00000001) != 0)
+
+//
+// Event Macro for Return
+//
+#define EventWriteReturn(Name, Line, FrameID)\
+ EventEnabledReturn() ?\
+ Template_zdq(OVR_SDK_LibOVRHandle, &Return, Name, Line, FrameID)\
+ : ERROR_SUCCESS\
+
+//
+// Enablement check macro for Waypoint
+//
+
+#define EventEnabledWaypoint() ((OVR_SDK_LibOVREnableBits[0] & 0x00000002) != 0)
+
+//
+// Event Macro for Waypoint
+//
+#define EventWriteWaypoint(Name, Line, FrameID)\
+ EventEnabledWaypoint() ?\
+ Template_zdq(OVR_SDK_LibOVRHandle, &Waypoint, Name, Line, FrameID)\
+ : ERROR_SUCCESS\
+
+//
+// Enablement check macro for DistortionBegin
+//
+
+#define EventEnabledDistortionBegin() ((OVR_SDK_LibOVREnableBits[0] & 0x00000001) != 0)
+
+//
+// Event Macro for DistortionBegin
+//
+#define EventWriteDistortionBegin(VidPnTargetId, FrameID)\
+ EventEnabledDistortionBegin() ?\
+ Template_qq(OVR_SDK_LibOVRHandle, &DistortionBegin, VidPnTargetId, FrameID)\
+ : ERROR_SUCCESS\
+
+//
+// Enablement check macro for DistortionWaitGPU
+//
+
+#define EventEnabledDistortionWaitGPU() ((OVR_SDK_LibOVREnableBits[0] & 0x00000001) != 0)
+
+//
+// Event Macro for DistortionWaitGPU
+//
+#define EventWriteDistortionWaitGPU(VidPnTargetId, FrameID)\
+ EventEnabledDistortionWaitGPU() ?\
+ Template_qq(OVR_SDK_LibOVRHandle, &DistortionWaitGPU, VidPnTargetId, FrameID)\
+ : ERROR_SUCCESS\
+
+//
+// Enablement check macro for DistortionPresent
+//
+
+#define EventEnabledDistortionPresent() ((OVR_SDK_LibOVREnableBits[0] & 0x00000001) != 0)
+
+//
+// Event Macro for DistortionPresent
+//
+#define EventWriteDistortionPresent(VidPnTargetId, FrameID)\
+ EventEnabledDistortionPresent() ?\
+ Template_qq(OVR_SDK_LibOVRHandle, &DistortionPresent, VidPnTargetId, FrameID)\
+ : ERROR_SUCCESS\
+
+//
+// Enablement check macro for DistortionEnd
+//
+
+#define EventEnabledDistortionEnd() ((OVR_SDK_LibOVREnableBits[0] & 0x00000001) != 0)
+
+//
+// Event Macro for DistortionEnd
+//
+#define EventWriteDistortionEnd(VidPnTargetId, FrameID)\
+ EventEnabledDistortionEnd() ?\
+ Template_qq(OVR_SDK_LibOVRHandle, &DistortionEnd, VidPnTargetId, FrameID)\
+ : ERROR_SUCCESS\
+
+//
+// Enablement check macro for HmdDesc
+//
+
+#define EventEnabledHmdDesc() ((OVR_SDK_LibOVREnableBits[0] & 0x00000001) != 0)
+
+//
+// Event Macro for HmdDesc
+//
+#define EventWriteHmdDesc(Type, VendorId, ProductId, SerialNumber, FirmwareMajor, FirmwareMinor, HmdCaps, TrackingCaps, DistortionCaps, ResolutionWidth, ResolutionHeight)\
+ EventEnabledHmdDesc() ?\
+ Template_qlls24llqqqdd(OVR_SDK_LibOVRHandle, &HmdDesc, Type, VendorId, ProductId, SerialNumber, FirmwareMajor, FirmwareMinor, HmdCaps, TrackingCaps, DistortionCaps, ResolutionWidth, ResolutionHeight)\
+ : ERROR_SUCCESS\
+
+//
+// Enablement check macro for CameraFrameReceived
+//
+
+#define EventEnabledCameraFrameReceived() ((OVR_SDK_LibOVREnableBits[0] & 0x00000001) != 0)
+
+//
+// Event Macro for CameraFrameReceived
+//
+#define EventWriteCameraFrameReceived(FrameRate, FrameNumber, ArrivalTimeSeconds, CaptureTime, LostFrames)\
+ EventEnabledCameraFrameReceived() ?\
+ Template_fqggq(OVR_SDK_LibOVRHandle, &CameraFrameReceived, FrameRate, FrameNumber, ArrivalTimeSeconds, CaptureTime, LostFrames)\
+ : ERROR_SUCCESS\
+
+//
+// Enablement check macro for CameraBeginProcessing
+//
+
+#define EventEnabledCameraBeginProcessing() ((OVR_SDK_LibOVREnableBits[0] & 0x00000001) != 0)
+
+//
+// Event Macro for CameraBeginProcessing
+//
+#define EventWriteCameraBeginProcessing(FrameRate, FrameNumber, ArrivalTimeSeconds, CaptureTime, LostFrames)\
+ EventEnabledCameraBeginProcessing() ?\
+ Template_fqggq(OVR_SDK_LibOVRHandle, &CameraBeginProcessing, FrameRate, FrameNumber, ArrivalTimeSeconds, CaptureTime, LostFrames)\
+ : ERROR_SUCCESS\
+
+//
+// Enablement check macro for CameraFrameRequest
+//
+
+#define EventEnabledCameraFrameRequest() ((OVR_SDK_LibOVREnableBits[0] & 0x00000001) != 0)
+
+//
+// Event Macro for CameraFrameRequest
+//
+#define EventWriteCameraFrameRequest(RequestNumber, FrameCounter, LastFrameNumber)\
+ EventEnabledCameraFrameRequest() ?\
+ Template_xxq(OVR_SDK_LibOVRHandle, &CameraFrameRequest, RequestNumber, FrameCounter, LastFrameNumber)\
+ : ERROR_SUCCESS\
+
+//
+// Enablement check macro for CameraEndProcessing
+//
+
+#define EventEnabledCameraEndProcessing() ((OVR_SDK_LibOVREnableBits[0] & 0x00000001) != 0)
+
+//
+// Event Macro for CameraEndProcessing
+//
+#define EventWriteCameraEndProcessing(FrameRate, FrameNumber, ArrivalTimeSeconds, CaptureTime, LostFrames)\
+ EventEnabledCameraEndProcessing() ?\
+ Template_fqggq(OVR_SDK_LibOVRHandle, &CameraEndProcessing, FrameRate, FrameNumber, ArrivalTimeSeconds, CaptureTime, LostFrames)\
+ : ERROR_SUCCESS\
+
+//
+// Enablement check macro for CameraSkippedFrames
+//
+
+#define EventEnabledCameraSkippedFrames() ((OVR_SDK_LibOVREnableBits[0] & 0x00000001) != 0)
+
+//
+// Event Macro for CameraSkippedFrames
+//
+#define EventWriteCameraSkippedFrames(RequestNumber, FrameCounter, LastFrameNumber)\
+ EventEnabledCameraSkippedFrames() ?\
+ Template_xxq(OVR_SDK_LibOVRHandle, &CameraSkippedFrames, RequestNumber, FrameCounter, LastFrameNumber)\
+ : ERROR_SUCCESS\
+
+//
+// Enablement check macro for JSONChunk
+//
+
+#define EventEnabledJSONChunk() ((OVR_SDK_LibOVREnableBits[0] & 0x00000001) != 0)
+
+//
+// Event Macro for JSONChunk
+//
+#define EventWriteJSONChunk(Name, TotalChunks, ChunkSequence, TotalSize, ChunkSize, ChunkOffset, Chunk)\
+ EventEnabledJSONChunk() ?\
+ Template_zqqqqqb(OVR_SDK_LibOVRHandle, &JSONChunk, Name, TotalChunks, ChunkSequence, TotalSize, ChunkSize, ChunkOffset, Chunk)\
+ : ERROR_SUCCESS\
+
+//
+// Enablement check macro for LogDebugMessage
+//
+
+#define EventEnabledLogDebugMessage() ((OVR_SDK_LibOVREnableBits[0] & 0x00000004) != 0)
+
+//
+// Event Macro for LogDebugMessage
+//
+#define EventWriteLogDebugMessage(Message)\
+ EventEnabledLogDebugMessage() ?\
+ Template_s(OVR_SDK_LibOVRHandle, &LogDebugMessage, Message)\
+ : ERROR_SUCCESS\
+
+//
+// Enablement check macro for LogInfoMessage
+//
+
+#define EventEnabledLogInfoMessage() ((OVR_SDK_LibOVREnableBits[0] & 0x00000001) != 0)
+
+//
+// Event Macro for LogInfoMessage
+//
+#define EventWriteLogInfoMessage(Message)\
+ EventEnabledLogInfoMessage() ?\
+ Template_s(OVR_SDK_LibOVRHandle, &LogInfoMessage, Message)\
+ : ERROR_SUCCESS\
+
+//
+// Enablement check macro for LogErrorMessage
+//
+
+#define EventEnabledLogErrorMessage() ((OVR_SDK_LibOVREnableBits[0] & 0x00000008) != 0)
+
+//
+// Event Macro for LogErrorMessage
+//
+#define EventWriteLogErrorMessage(Message)\
+ EventEnabledLogErrorMessage() ?\
+ Template_s(OVR_SDK_LibOVRHandle, &LogErrorMessage, Message)\
+ : ERROR_SUCCESS\
+
+//
+// Enablement check macro for HmdTrackingState
+//
+
+#define EventEnabledHmdTrackingState() ((OVR_SDK_LibOVREnableBits[0] & 0x00000001) != 0)
+
+//
+// Event Macro for HmdTrackingState
+//
+#define EventWriteHmdTrackingState(TimeInSeconds, HeadPoseQuat, HeadPoseTranslation, HeadAngularVelocity, HeadLinearVelocity, CameraPoseQuat, CameraPoseTranslation, SensorAccelerometer, SensorGyro, SensorMagnetometer, SensorTemperature, SensortTimeInSeconds, StatusFlags, LastCameraFrameCounter)\
+ EventEnabledHmdTrackingState() ?\
+ Template_gF4F3F3F3F4F3F3F3F3ffqq(OVR_SDK_LibOVRHandle, &HmdTrackingState, TimeInSeconds, HeadPoseQuat, HeadPoseTranslation, HeadAngularVelocity, HeadLinearVelocity, CameraPoseQuat, CameraPoseTranslation, SensorAccelerometer, SensorGyro, SensorMagnetometer, SensorTemperature, SensortTimeInSeconds, StatusFlags, LastCameraFrameCounter)\
+ : ERROR_SUCCESS\
+
+//
+// Enablement check macro for CameraBlobs
+//
+
+#define EventEnabledCameraBlobs() ((OVR_SDK_LibOVREnableBits[0] & 0x00000001) != 0)
+
+//
+// Event Macro for CameraBlobs
+//
+#define EventWriteCameraBlobs(BlobCount, PositionX, PositionY, Size)\
+ EventEnabledCameraBlobs() ?\
+ Template_qGR0GR0DR0(OVR_SDK_LibOVRHandle, &CameraBlobs, BlobCount, PositionX, PositionY, Size)\
+ : ERROR_SUCCESS\
+
+#endif // MCGEN_DISABLE_PROVIDER_CODE_GENERATION
+
+
+//
+// Allow Diasabling of code generation
+//
+#ifndef MCGEN_DISABLE_PROVIDER_CODE_GENERATION
+
+//
+// Template Functions
+//
+//
+//Template from manifest : FunctionWaypoint
+//
+#ifndef Template_zdq_def
+#define Template_zdq_def
+ETW_INLINE
+ULONG
+Template_zdq(
+ _In_ REGHANDLE RegHandle,
+ _In_ PCEVENT_DESCRIPTOR Descriptor,
+ _In_opt_ PCWSTR _Arg0,
+ _In_ const signed int _Arg1,
+ _In_ const unsigned int _Arg2
+ )
+{
+#define ARGUMENT_COUNT_zdq 3
+
+ EVENT_DATA_DESCRIPTOR EventData[ARGUMENT_COUNT_zdq];
+
+ EventDataDescCreate(&EventData[0],
+ (_Arg0 != NULL) ? _Arg0 : L"NULL",
+ (_Arg0 != NULL) ? (ULONG)((wcslen(_Arg0) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"NULL"));
+
+ EventDataDescCreate(&EventData[1], &_Arg1, sizeof(const signed int) );
+
+ EventDataDescCreate(&EventData[2], &_Arg2, sizeof(const unsigned int) );
+
+ return EventWrite(RegHandle, Descriptor, ARGUMENT_COUNT_zdq, EventData);
+}
+#endif
+
+//
+//Template from manifest : Distortion
+//
+#ifndef Template_qq_def
+#define Template_qq_def
+ETW_INLINE
+ULONG
+Template_qq(
+ _In_ REGHANDLE RegHandle,
+ _In_ PCEVENT_DESCRIPTOR Descriptor,
+ _In_ const unsigned int _Arg0,
+ _In_ const unsigned int _Arg1
+ )
+{
+#define ARGUMENT_COUNT_qq 2
+
+ EVENT_DATA_DESCRIPTOR EventData[ARGUMENT_COUNT_qq];
+
+ EventDataDescCreate(&EventData[0], &_Arg0, sizeof(const unsigned int) );
+
+ EventDataDescCreate(&EventData[1], &_Arg1, sizeof(const unsigned int) );
+
+ return EventWrite(RegHandle, Descriptor, ARGUMENT_COUNT_qq, EventData);
+}
+#endif
+
+//
+//Template from manifest : HmdDesc
+//
+#ifndef Template_qlls24llqqqdd_def
+#define Template_qlls24llqqqdd_def
+ETW_INLINE
+ULONG
+Template_qlls24llqqqdd(
+ _In_ REGHANDLE RegHandle,
+ _In_ PCEVENT_DESCRIPTOR Descriptor,
+ _In_ const unsigned int _Arg0,
+ _In_ const signed short _Arg1,
+ _In_ const signed short _Arg2,
+ _In_reads_(24) LPCCH _Arg3,
+ _In_ const signed short _Arg4,
+ _In_ const signed short _Arg5,
+ _In_ const unsigned int _Arg6,
+ _In_ const unsigned int _Arg7,
+ _In_ const unsigned int _Arg8,
+ _In_ const signed int _Arg9,
+ _In_ const signed int _Arg10
+ )
+{
+#define ARGUMENT_COUNT_qlls24llqqqdd 11
+
+ EVENT_DATA_DESCRIPTOR EventData[ARGUMENT_COUNT_qlls24llqqqdd];
+
+ EventDataDescCreate(&EventData[0], &_Arg0, sizeof(const unsigned int) );
+
+ EventDataDescCreate(&EventData[1], &_Arg1, sizeof(const signed short) );
+
+ EventDataDescCreate(&EventData[2], &_Arg2, sizeof(const signed short) );
+
+ EventDataDescCreate(&EventData[3], _Arg3, (ULONG)(sizeof(CHAR)*24));
+
+ EventDataDescCreate(&EventData[4], &_Arg4, sizeof(const signed short) );
+
+ EventDataDescCreate(&EventData[5], &_Arg5, sizeof(const signed short) );
+
+ EventDataDescCreate(&EventData[6], &_Arg6, sizeof(const unsigned int) );
+
+ EventDataDescCreate(&EventData[7], &_Arg7, sizeof(const unsigned int) );
+
+ EventDataDescCreate(&EventData[8], &_Arg8, sizeof(const unsigned int) );
+
+ EventDataDescCreate(&EventData[9], &_Arg9, sizeof(const signed int) );
+
+ EventDataDescCreate(&EventData[10], &_Arg10, sizeof(const signed int) );
+
+ return EventWrite(RegHandle, Descriptor, ARGUMENT_COUNT_qlls24llqqqdd, EventData);
+}
+#endif
+
+//
+//Template from manifest : CameraFrameData
+//
+#ifndef Template_fqggq_def
+#define Template_fqggq_def
+ETW_INLINE
+ULONG
+Template_fqggq(
+ _In_ REGHANDLE RegHandle,
+ _In_ PCEVENT_DESCRIPTOR Descriptor,
+ _In_ const float _Arg0,
+ _In_ const unsigned int _Arg1,
+ _In_ const double _Arg2,
+ _In_ const double _Arg3,
+ _In_ const unsigned int _Arg4
+ )
+{
+#define ARGUMENT_COUNT_fqggq 5
+
+ EVENT_DATA_DESCRIPTOR EventData[ARGUMENT_COUNT_fqggq];
+
+ EventDataDescCreate(&EventData[0], &_Arg0, sizeof(const float) );
+
+ EventDataDescCreate(&EventData[1], &_Arg1, sizeof(const unsigned int) );
+
+ EventDataDescCreate(&EventData[2], &_Arg2, sizeof(const double) );
+
+ EventDataDescCreate(&EventData[3], &_Arg3, sizeof(const double) );
+
+ EventDataDescCreate(&EventData[4], &_Arg4, sizeof(const unsigned int) );
+
+ return EventWrite(RegHandle, Descriptor, ARGUMENT_COUNT_fqggq, EventData);
+}
+#endif
+
+//
+//Template from manifest : CameraFrameRequest
+//
+#ifndef Template_xxq_def
+#define Template_xxq_def
+ETW_INLINE
+ULONG
+Template_xxq(
+ _In_ REGHANDLE RegHandle,
+ _In_ PCEVENT_DESCRIPTOR Descriptor,
+ _In_ unsigned __int64 _Arg0,
+ _In_ unsigned __int64 _Arg1,
+ _In_ const unsigned int _Arg2
+ )
+{
+#define ARGUMENT_COUNT_xxq 3
+
+ EVENT_DATA_DESCRIPTOR EventData[ARGUMENT_COUNT_xxq];
+
+ EventDataDescCreate(&EventData[0], &_Arg0, sizeof(unsigned __int64) );
+
+ EventDataDescCreate(&EventData[1], &_Arg1, sizeof(unsigned __int64) );
+
+ EventDataDescCreate(&EventData[2], &_Arg2, sizeof(const unsigned int) );
+
+ return EventWrite(RegHandle, Descriptor, ARGUMENT_COUNT_xxq, EventData);
+}
+#endif
+
+//
+//Template from manifest : JSONChunk
+//
+#ifndef Template_zqqqqqb_def
+#define Template_zqqqqqb_def
+ETW_INLINE
+ULONG
+Template_zqqqqqb(
+ _In_ REGHANDLE RegHandle,
+ _In_ PCEVENT_DESCRIPTOR Descriptor,
+ _In_opt_ PCWSTR _Arg0,
+ _In_ const unsigned int _Arg1,
+ _In_ const unsigned int _Arg2,
+ _In_ const unsigned int _Arg3,
+ _In_ const unsigned int _Arg4,
+ _In_ const unsigned int _Arg5,
+ _In_reads_(_Arg4) const BYTE* _Arg6
+ )
+{
+#define ARGUMENT_COUNT_zqqqqqb 7
+
+ EVENT_DATA_DESCRIPTOR EventData[ARGUMENT_COUNT_zqqqqqb];
+
+ EventDataDescCreate(&EventData[0],
+ (_Arg0 != NULL) ? _Arg0 : L"NULL",
+ (_Arg0 != NULL) ? (ULONG)((wcslen(_Arg0) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"NULL"));
+
+ EventDataDescCreate(&EventData[1], &_Arg1, sizeof(const unsigned int) );
+
+ EventDataDescCreate(&EventData[2], &_Arg2, sizeof(const unsigned int) );
+
+ EventDataDescCreate(&EventData[3], &_Arg3, sizeof(const unsigned int) );
+
+ EventDataDescCreate(&EventData[4], &_Arg4, sizeof(const unsigned int) );
+
+ EventDataDescCreate(&EventData[5], &_Arg5, sizeof(const unsigned int) );
+
+ EventDataDescCreate(&EventData[6], _Arg6, (ULONG)sizeof(char)*_Arg4);
+
+ return EventWrite(RegHandle, Descriptor, ARGUMENT_COUNT_zqqqqqb, EventData);
+}
+#endif
+
+//
+//Template from manifest : Log
+//
+#ifndef Template_s_def
+#define Template_s_def
+ETW_INLINE
+ULONG
+Template_s(
+ _In_ REGHANDLE RegHandle,
+ _In_ PCEVENT_DESCRIPTOR Descriptor,
+ _In_opt_ LPCSTR _Arg0
+ )
+{
+#define ARGUMENT_COUNT_s 1
+
+ EVENT_DATA_DESCRIPTOR EventData[ARGUMENT_COUNT_s];
+
+ EventDataDescCreate(&EventData[0],
+ (_Arg0 != NULL) ? _Arg0 : "NULL",
+ (_Arg0 != NULL) ? (ULONG)((strlen(_Arg0) + 1) * sizeof(CHAR)) : (ULONG)sizeof("NULL"));
+
+ return EventWrite(RegHandle, Descriptor, ARGUMENT_COUNT_s, EventData);
+}
+#endif
+
+//
+//Template from manifest : HmdTrackingState
+//
+#ifndef Template_gF4F3F3F3F4F3F3F3F3ffqq_def
+#define Template_gF4F3F3F3F4F3F3F3F3ffqq_def
+ETW_INLINE
+ULONG
+Template_gF4F3F3F3F4F3F3F3F3ffqq(
+ _In_ REGHANDLE RegHandle,
+ _In_ PCEVENT_DESCRIPTOR Descriptor,
+ _In_ const double _Arg0,
+ _In_reads_(4) const float *_Arg1,
+ _In_reads_(3) const float *_Arg2,
+ _In_reads_(3) const float *_Arg3,
+ _In_reads_(3) const float *_Arg4,
+ _In_reads_(4) const float *_Arg5,
+ _In_reads_(3) const float *_Arg6,
+ _In_reads_(3) const float *_Arg7,
+ _In_reads_(3) const float *_Arg8,
+ _In_reads_(3) const float *_Arg9,
+ _In_ const float _Arg10,
+ _In_ const float _Arg11,
+ _In_ const unsigned int _Arg12,
+ _In_ const unsigned int _Arg13
+ )
+{
+#define ARGUMENT_COUNT_gF4F3F3F3F4F3F3F3F3ffqq 14
+
+ EVENT_DATA_DESCRIPTOR EventData[ARGUMENT_COUNT_gF4F3F3F3F4F3F3F3F3ffqq];
+
+ EventDataDescCreate(&EventData[0], &_Arg0, sizeof(const double) );
+
+ EventDataDescCreate(&EventData[1], _Arg1, sizeof(const float)*4);
+
+ EventDataDescCreate(&EventData[2], _Arg2, sizeof(const float)*3);
+
+ EventDataDescCreate(&EventData[3], _Arg3, sizeof(const float)*3);
+
+ EventDataDescCreate(&EventData[4], _Arg4, sizeof(const float)*3);
+
+ EventDataDescCreate(&EventData[5], _Arg5, sizeof(const float)*4);
+
+ EventDataDescCreate(&EventData[6], _Arg6, sizeof(const float)*3);
+
+ EventDataDescCreate(&EventData[7], _Arg7, sizeof(const float)*3);
+
+ EventDataDescCreate(&EventData[8], _Arg8, sizeof(const float)*3);
+
+ EventDataDescCreate(&EventData[9], _Arg9, sizeof(const float)*3);
+
+ EventDataDescCreate(&EventData[10], &_Arg10, sizeof(const float) );
+
+ EventDataDescCreate(&EventData[11], &_Arg11, sizeof(const float) );
+
+ EventDataDescCreate(&EventData[12], &_Arg12, sizeof(const unsigned int) );
+
+ EventDataDescCreate(&EventData[13], &_Arg13, sizeof(const unsigned int) );
+
+ return EventWrite(RegHandle, Descriptor, ARGUMENT_COUNT_gF4F3F3F3F4F3F3F3F3ffqq, EventData);
+}
+#endif
+
+//
+//Template from manifest : CameraBlobs
+//
+#ifndef Template_qGR0GR0DR0_def
+#define Template_qGR0GR0DR0_def
+ETW_INLINE
+ULONG
+Template_qGR0GR0DR0(
+ _In_ REGHANDLE RegHandle,
+ _In_ PCEVENT_DESCRIPTOR Descriptor,
+ _In_ const unsigned int _Arg0,
+ _In_reads_(_Arg0) const double *_Arg1,
+ _In_reads_(_Arg0) const double *_Arg2,
+ _In_reads_(_Arg0) const signed int *_Arg3
+ )
+{
+#define ARGUMENT_COUNT_qGR0GR0DR0 4
+
+ EVENT_DATA_DESCRIPTOR EventData[ARGUMENT_COUNT_qGR0GR0DR0];
+
+ EventDataDescCreate(&EventData[0], &_Arg0, sizeof(const unsigned int) );
+
+ EventDataDescCreate(&EventData[1], _Arg1, sizeof(const double)*_Arg0);
+
+ EventDataDescCreate(&EventData[2], _Arg2, sizeof(const double)*_Arg0);
+
+ EventDataDescCreate(&EventData[3], _Arg3, sizeof(const signed int)*_Arg0);
+
+ return EventWrite(RegHandle, Descriptor, ARGUMENT_COUNT_qGR0GR0DR0, EventData);
+}
+#endif
+
+#endif // MCGEN_DISABLE_PROVIDER_CODE_GENERATION
+
+#if defined(__cplusplus)
+};
+#endif
+
+#define MSG_OVR_SDK_LibOVR_opcode_FN_CALL_message 0x3000000AL
+#define MSG_OVR_SDK_LibOVR_opcode_FN_RETURN_message 0x3000000BL
+#define MSG_OVR_SDK_LibOVR_opcode_FN_WAYPOINT_message 0x3000000CL
+#define MSG_OVR_SDK_LibOVR_opcode_DIS_BEGIN_message 0x3000000DL
+#define MSG_OVR_SDK_LibOVR_opcode_DIS_WAITGPU_message 0x3000000EL
+#define MSG_OVR_SDK_LibOVR_opcode_DIS_PRESENT_message 0x3000000FL
+#define MSG_OVR_SDK_LibOVR_opcode_DIS_END_message 0x30000010L
+#define MSG_OVR_SDK_LibOVR_opcode_HMD_DESC_message 0x30000011L
+#define MSG_OVR_SDK_LibOVR_opcode_CAM_RECEIVE_message 0x30000012L
+#define MSG_OVR_SDK_LibOVR_opcode_CAM_REQUEST_message 0x30000013L
+#define MSG_level_Error 0x50000002L
+#define MSG_level_Informational 0x50000004L
+#define MSG_level_Verbose 0x50000005L
+#define MSG_OVR_SDK_LibOVR_task_FN_TRACE_message 0x70000001L
+#define MSG_OVR_SDK_LibOVR_task_DIS_TRACE_message 0x70000002L
+#define MSG_OVR_SDK_LibOVR_task_HMD_TRACE_message 0x70000003L
+#define MSG_OVR_SDK_LibOVR_task_CAMERA_TRACE_message 0x70000004L
+#define MSG_OVR_SDK_LibOVR_task_LOG_TRACE_message 0x70000005L
+#define MSG_OVR_SDK_LibOVR_event_0_message 0xB0000000L
+#define MSG_OVR_SDK_LibOVR_event_1_message 0xB0000001L
+#define MSG_OVR_SDK_LibOVR_event_2_message 0xB0000002L
+#define MSG_OVR_SDK_LibOVR_event_4_message 0xB0000004L
+#define MSG_OVR_SDK_LibOVR_event_5_message 0xB0000005L
+#define MSG_OVR_SDK_LibOVR_event_6_message 0xB0000006L
+#define MSG_OVR_SDK_LibOVR_event_7_message 0xB0000007L
+#define MSG_OVR_SDK_LibOVR_event_8_message 0xB0000008L
+#define MSG_OVR_SDK_LibOVR_event_9_message 0xB0000009L
+#define MSG_OVR_SDK_LibOVR_event_10_message 0xB000000AL
+#define MSG_OVR_SDK_LibOVR_event_11_message 0xB000000BL
+#define MSG_OVR_SDK_LibOVR_event_12_message 0xB000000CL
+#define MSG_OVR_SDK_LibOVR_event_13_message 0xB000000DL
+#define MSG_OVR_SDK_LibOVR_event_14_message 0xB000000EL
+#define MSG_OVR_SDK_LibOVR_event_15_message 0xB000000FL
+#define MSG_OVR_SDK_LibOVR_event_16_message 0xB0000010L
+#define MSG_OVR_SDK_LibOVR_event_17_message 0xB0000011L
+#define MSG_OVR_SDK_LibOVR_event_18_message 0xB0000012L
+#define MSG_OVR_SDK_LibOVR_event_19_message 0xB0000013L
diff --git a/LibOVRKernel/Src/Tracing/LibOVREvents.man b/LibOVRKernel/Src/Tracing/LibOVREvents.man
new file mode 100644
index 0000000..368d90b
--- /dev/null
+++ b/LibOVRKernel/Src/Tracing/LibOVREvents.man
Binary files differ
diff --git a/LibOVRKernel/Src/Tracing/LibOVREventsTEMP.BIN b/LibOVRKernel/Src/Tracing/LibOVREventsTEMP.BIN
new file mode 100644
index 0000000..acb7d7b
--- /dev/null
+++ b/LibOVRKernel/Src/Tracing/LibOVREventsTEMP.BIN
Binary files differ
diff --git a/LibOVRKernel/Src/Tracing/LibOVREvents_MSG00001.bin b/LibOVRKernel/Src/Tracing/LibOVREvents_MSG00001.bin
new file mode 100644
index 0000000..56365b0
--- /dev/null
+++ b/LibOVRKernel/Src/Tracing/LibOVREvents_MSG00001.bin
Binary files differ
diff --git a/LibOVRKernel/Src/Tracing/README.md b/LibOVRKernel/Src/Tracing/README.md
new file mode 100644
index 0000000..cbf3739
--- /dev/null
+++ b/LibOVRKernel/Src/Tracing/README.md
@@ -0,0 +1,55 @@
+#Setup
+
+If you want stack walking to work on x64:
+
+ > reg add "HKLM\System\CurrentControlSet\Control\Session Manager\Memory Management" -v DisablePagingExecutive -d 0x1 -t REG_DWORD -f
+
+Add USERS Read & Execute privileges to the folder (or one of its parents) containing the LibOVREvents.man file:
+
+ > icacls . /grant BUILTIN\Users:(OI)(CI)(RX)
+
+To install or reinstall the ETW manifest after building LibOVR run `install.cmd` as Administrator:
+
+ > install
+
+Note: the install script will also attempt to install the manifests for the driver and runtime. Also note that the install
+script installs the manifest from the newest version of LibOVR.dll, which might not be the version you are debugging in
+Visual Studio (this will only matter if the two versions have specified different events). To be safe make sure your build
+is up-to-date.
+
+#Adding trace points
+
+See [./Tracing.h] and the examples in [../OVR_CAPI.cpp].
+
+The following macros can be used to trace call/return and progress through a function:
+
+ TraceCall(frameIndex)
+ TraceReturn(frameIndex)
+ TraceWaypoint(frameIndex)
+
+Try to place the Call/Return instrumentation as close as possible to the function entry/exit points, and don't forget
+to instrument all return paths.
+
+Supply a frame index of 0 if a frame index is not applicable/available.
+
+#Adding new trace events
+
+Use the `ECManGen.exe` utility from the Windows 8.1 SDK to edit the `LibOVREvents.man` manifest.
+
+See [http://msdn.microsoft.com/en-us/library/windows/desktop/dd996930%28v=vs.85%29.aspx]
+The `F1` help is also useful.
+
+#Rebuilding the ETW headers and resources
+
+Use the `build.cmd` script to regenerate the `LibOVREvents.h`, `LibOVREvents.rc` and `LibOVREvents*.bin` files.
+`clean.cmd` will remove all generated files.
+
+Note that the outputs are checked into the repository so you'll need to `p4 edit` them first.
+
+#Capturing ETW traces
+
+See [../../../Tools/XPerf/README.md]
+
+#Viewing ETW traces with GPUView
+
+See [http://msdn.microsoft.com/en-us/library/windows/desktop/jj585574(v=vs.85).aspx]
diff --git a/LibOVRKernel/Src/Tracing/Tracing.h b/LibOVRKernel/Src/Tracing/Tracing.h
new file mode 100644
index 0000000..c14dc4a
--- /dev/null
+++ b/LibOVRKernel/Src/Tracing/Tracing.h
@@ -0,0 +1,197 @@
+/************************************************************************************
+
+PublicHeader: n/a
+Filename : Tracing.h
+Content : Performance tracing
+Created : December 4, 2014
+Author : Ed Hutchins
+
+Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved.
+
+Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License");
+you may not use the Oculus VR Rift SDK except in compliance with the License,
+which is provided at the time of installation or download, or which
+otherwise accompanies this software in either electronic or hard copy form.
+
+You may obtain a copy of the License at
+
+http://www.oculusvr.com/licenses/LICENSE-3.2
+
+Unless required by applicable law or agreed to in writing, the Oculus VR SDK
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+************************************************************************************/
+
+#ifndef OVR_Tracing_h
+#define OVR_Tracing_h
+
+//-----------------------------------------------------------------------------------
+// ***** OVR_ENABLE_ETW_TRACING definition (XXX default to on for windows builds?)
+//
+
+#ifdef OVR_OS_WIN32
+#define OVR_ENABLE_ETW_TRACING
+#endif
+
+//-----------------------------------------------------------------------------------
+// ***** Trace* definitions
+//
+
+#ifdef OVR_ENABLE_ETW_TRACING
+
+ #define TracingIsEnabled() (OVR_SDK_LibOVREnableBits[0] != 0)
+
+ #ifdef TRACE_STATE_CAPTURE_FUNC
+ // hook in our own state capture callback to record the state of all opened HMDs (supress unused parameter warnings with void() casts)
+ #define MCGEN_PRIVATE_ENABLE_CALLBACK_V2(SourceId, ControlCode, Level, MatchAnyKeyword, MatchAllKeywords, FilterData, CallbackContext) \
+ ( \
+ void(SourceId), \
+ void(Level), \
+ void(MatchAnyKeyword), \
+ void(MatchAllKeywords), \
+ void(FilterData), \
+ void(CallbackContext), \
+ (((ControlCode) == EVENT_CONTROL_CODE_CAPTURE_STATE) ? (TRACE_STATE_CAPTURE_FUNC) : 0) \
+ )
+ #endif
+
+ #if !defined(_In_reads_)
+ // get VS2010 working
+ #define _In_reads_(x)
+ #endif
+
+ #include "LibOVREvents.h"
+
+ // Register/Unregister the OVR_SDK_LibOVR provider with ETW
+ // (MCGEN_PRIVATE_ENABLE_CALLBACK_V2 hooks in our state capture)
+ #define TraceInit() \
+ do { \
+ ULONG status = EventRegisterOVR_SDK_LibOVR(); \
+ if (ERROR_SUCCESS != status) { \
+ LogError("[LibOVR] Failed to register ETW provider (%ul)", status); \
+ } \
+ } while (0)
+ #define TraceFini() EventUnregisterOVR_SDK_LibOVR()
+
+ // Trace function call and return for perf, and waypoints for debug
+ #define TraceCall(frameIndex) EventWriteCall(__FUNCTIONW__, __LINE__, (frameIndex))
+ #define TraceReturn(frameIndex) EventWriteReturn(__FUNCTIONW__, __LINE__, (frameIndex))
+ #define TraceWaypoint(frameIndex) EventWriteWaypoint(__FUNCTIONW__, __LINE__, (frameIndex))
+
+ // DistortionRenderer events
+ #define TraceDistortionBegin(id, frameIndex) EventWriteDistortionBegin((id), (frameIndex))
+ #define TraceDistortionWaitGPU(id, frameIndex) EventWriteDistortionWaitGPU((id), (frameIndex))
+ #define TraceDistortionPresent(id, frameIndex) EventWriteDistortionPresent((id), (frameIndex))
+ #define TraceDistortionEnd(id, frameIndex) EventWriteDistortionEnd((id), (frameIndex))
+
+ // Tracking Camera events
+ #define _TraceCameraFrameData(fn,img) \
+ fn( \
+ 0, \
+ (img).FrameNumber, \
+ (img).ArrivalTime, \
+ (img).CaptureTime, \
+ 0 \
+ )
+ #define TraceCameraFrameReceived(img) _TraceCameraFrameData(EventWriteCameraFrameReceived,(img))
+ #define TraceCameraBeginProcessing(img) _TraceCameraFrameData(EventWriteCameraBeginProcessing,(img))
+ #define TraceCameraFrameRequest(requestNumber, frameCount, lastFrameNumber) EventWriteCameraFrameRequest(requestNumber, frameCount, lastFrameNumber)
+ #define TraceCameraEndProcessing(img) _TraceCameraFrameData(EventWriteCameraEndProcessing,(img))
+ #define TraceCameraSkippedFrames(requestNumber, frameCount, lastFrameNumber) EventWriteCameraSkippedFrames(requestNumber, frameCount, lastFrameNumber)
+
+ // Trace the interesting parts of an ovrHmdDesc structure
+ #define TraceHmdDesc(desc) \
+ EventWriteHmdDesc( \
+ (desc).Type, \
+ (desc).VendorId, \
+ (desc).ProductId, \
+ (desc).SerialNumber, \
+ (desc).FirmwareMajor, \
+ (desc).FirmwareMinor, \
+ (desc).HmdCaps, \
+ (desc).TrackingCaps, \
+ (desc).DistortionCaps, \
+ (desc).Resolution.w, \
+ (desc).Resolution.h \
+ )
+
+ // Trace part of a JSON string (events have a 64k limit)
+ #define TraceJSONChunk(Name, TotalChunks, ChunkSequence, TotalSize, ChunkSize, ChunkOffset, Chunk) \
+ EventWriteJSONChunk(Name, TotalChunks, ChunkSequence, TotalSize, ChunkSize, ChunkOffset, Chunk)
+
+ // Trace messages from the public ovr_Trace API and our internal logger
+ #define TraceLogDebug(message) EventWriteLogDebugMessage(message)
+ #define TraceLogInfo(message) EventWriteLogInfoMessage(message)
+ #define TraceLogError(message) EventWriteLogErrorMessage(message)
+
+ // Trace an ovrTrackingState
+ #define TraceTrackingState(ts) \
+ EventWriteHmdTrackingState( \
+ (ts).HeadPose.TimeInSeconds, \
+ &(ts).HeadPose.ThePose.Orientation.x, \
+ &(ts).HeadPose.ThePose.Position.x, \
+ &(ts).HeadPose.AngularVelocity.x, \
+ &(ts).HeadPose.LinearVelocity.x, \
+ &(ts).CameraPose.Orientation.x, \
+ &(ts).CameraPose.Position.x, \
+ &(ts).RawSensorData.Accelerometer.x, \
+ &(ts).RawSensorData.Gyro.x, \
+ &(ts).RawSensorData.Magnetometer.x, \
+ (ts).RawSensorData.Temperature, \
+ (ts).RawSensorData.TimeInSeconds, \
+ (ts).StatusFlags, \
+ (ts).LastCameraFrameCounter \
+ )
+
+ #define TraceCameraBlobs(blobs) \
+ if (EventEnabledCameraBlobs()) \
+ { \
+ const int max_blobs = 80; \
+ int count = (blobs).GetSizeI(); \
+ double x[max_blobs]; \
+ double y[max_blobs]; \
+ int size[max_blobs]; \
+ if (count > max_blobs) \
+ count = max_blobs; \
+ for (int i = 0; i < count; ++i) \
+ { \
+ x[i] = (blobs)[i].Position.x; \
+ y[i] = (blobs)[i].Position.y; \
+ size[i] = (blobs)[i].BlobSize; \
+ } \
+ EventWriteCameraBlobs(count, x, y, size); \
+ } \
+ else ((void)0)
+
+#else // OVR_ENABLE_ETW_TRACING
+
+ // Eventually other platforms could support their form of performance tracing
+ #define TracingIsEnabled() (false)
+ #define TraceInit() ((void)0)
+ #define TraceFini() ((void)0)
+ #define TraceCall(frameIndex) ((void)0)
+ #define TraceReturn(frameIndex) ((void)0)
+ #define TraceWaypoint(frameIndex) ((void)0)
+ #define TraceDistortionBegin(id, frameIndex) ((void)0)
+ #define TraceDistortionWaitGPU(id, frameIndex) ((void)0)
+ #define TraceDistortionPresent(id, frameIndex) ((void)0)
+ #define TraceDistortionEnd(id, frameIndex) ((void)0)
+ #define TraceCameraFrameReceived(cfd) ((void)0)
+ #define TraceCameraBeginProcessing(cfd) ((void)0)
+ #define TraceCameraFrameRequest(requestNumber, frameCount, lastFrameNumber) ((void)0)
+ #define TraceCameraEndProcessing(cfd) ((void)0)
+ #define TraceCameraSkippedFrames(requestNumber, frameCount, lastFrameNumber) ((void)0)
+ #define TraceHmdDesc(desc) ((void)0)
+ #define TraceJSONChunk(Name, TotalChunks, ChunkSequence, TotalSize, ChunkSize, ChunkOffset, Chunk) ((void)0)
+ #define TraceLogDebug(message) ((void)0)
+ #define TraceLogInfo(message) ((void)0)
+ #define TraceLogError(message) ((void)0)
+ #define TraceTrackingState(ts) ((void)0)
+ #define TraceCameraBlobs(blobs) ((void)0)
+
+#endif // OVR_ENABLE_ETW_TRACING
+
+#endif // OVR_Tracing_h
diff --git a/LibOVRKernel/Src/Tracing/build.cmd b/LibOVRKernel/Src/Tracing/build.cmd
new file mode 100644
index 0000000..7251627
--- /dev/null
+++ b/LibOVRKernel/Src/Tracing/build.cmd
@@ -0,0 +1,15 @@
+@echo off
+REM
+REM build.cmd - rebuild generated ETW tracing files from LibOVREvents.man
+REM
+
+REM assume mc.exe is in a path relative to xperf.exe
+for /f "delims=" %%a in ('where /F Xperf') do set XPERF_PATH=%%~dpa
+
+set OSTYPE=x86
+if not "%PROCESSOR_ARCHITECTURE%"=="x86" set OSTYPE=x64
+if not "%PROCESSOR_ARCHITEW6432%"=="" set OSTYPE=x64
+
+set MC="%XPERF_PATH%..\bin\%OSTYPE%\mc.exe"
+
+%MC% -v -a -A -n -um .\LibOVREvents.man -h . -z LibOVREvents
diff --git a/LibOVRKernel/Src/Tracing/clean.cmd b/LibOVRKernel/Src/Tracing/clean.cmd
new file mode 100644
index 0000000..77200b5
--- /dev/null
+++ b/LibOVRKernel/Src/Tracing/clean.cmd
@@ -0,0 +1,6 @@
+@echo off
+REM
+REM clean.cmd - remove generated ETW tracing files
+REM
+
+del LibOVREvents.h LibOVREvents.rc LibOVREvents*.bin *LibOVRRT*.dll
diff --git a/LibOVRKernel/Src/Tracing/install.cmd b/LibOVRKernel/Src/Tracing/install.cmd
new file mode 100644
index 0000000..5f64640
--- /dev/null
+++ b/LibOVRKernel/Src/Tracing/install.cmd
@@ -0,0 +1,115 @@
+@echo off
+setlocal
+REM run this script from an Admin shell to set up ETW tracing
+
+REM set SDK_MANIFEST_PATH to the SDK install path (e.g. C:\Program Files (x86)\Oculus)
+for /f "delims=" %%a in ('reg query "HKLM\System\CurrentControlSet\Services\OVRService" -v "ImagePath"') do set SDK_MANIFEST_PATH=%%a
+set SDK_MANIFEST_PATH=%SDK_MANIFEST_PATH:~34,-31%\Tools\ETW
+
+REM Add USERS Read & Execute privileges to the folder
+icacls . /grant BUILTIN\Users:(OI)(CI)(RX) >nul
+if %errorlevel% equ 0 goto CaclsOk
+
+echo Failed to set cacls, installation may fail
+
+:CaclsOk
+
+set OSTYPE=x64
+set RIFTENABLER_SYS=%windir%\System32\drivers\RiftEnabler.sys
+set OCUSBVID_SYS=%windir%\System32\drivers\OCUSBVID.sys
+set OVRDISPLAYRT_DLL=%windir%\System32\OVRDisplayRT64.dll
+if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto GotOSTYPE
+if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto GotOSTYPE
+set OSTYPE=x86
+REM XXX is this right?
+set RIFTENABLER_SYS=%windir%\System32\drivers\RiftEnabler.sys
+set OCUSBVID_SYS=%windir%\System32\drivers\OCUSBVID.sys
+set OVRDISPLAYRT_DLL=%windir%\System32\OVRDisplayRT32.dll
+
+:GotOSTYPE
+
+REM disable paging on x64 systems if stack walks are desired
+if %OSTYPE% neq x64 goto SkipRegCheck
+for /f "delims=" %%a in ('reg query "HKLM\System\CurrentControlSet\Control\Session Manager\Memory Management" -v "DisablePagingExecutive"') do set REG_DPA=%%a
+
+if %REG_DPA:~-3% equ 0x1 goto SkipRegCheck
+echo ************************
+echo DisablePagingExecutive should be set if you want stack tracing to work on %OSTYPE%
+echo To disable paging run the following as Administrator:
+echo reg add "HKLM\System\CurrentControlSet\Control\Session Manager\Memory Management" -v DisablePagingExecutive -d 0x1 -t REG_DWORD -f
+echo and reboot
+echo ************************
+
+:SkipRegCheck
+
+set RIFTDISPLAYDRIVER_DIR=..\..\..\RiftDisplayDriver
+set RIFTCAMERADRIVER_DIR=..\..\..\RiftPTDriver
+
+if exist "%SDK_MANIFEST_PATH%\OVRKernelEvents.man" set KERNEL_EVENTS_MAN=%SDK_MANIFEST_PATH%\OVRKernelEvents.man
+if exist "%RIFTDISPLAYDRIVER_DIR%\RiftEnabler\OVRKernelEvents.man" set KERNEL_EVENTS_MAN=%RIFTDISPLAYDRIVER_DIR%\RiftEnabler\OVRKernelEvents.man
+if exist ".\OVRKernelEvents.man" set KERNEL_EVENTS_MAN=.\OVRKernelEvents.man
+
+echo Installing %RIFTENABLER_SYS% manifest...
+REM uninstall any existing manifest first
+wevtutil.exe uninstall-manifest "%KERNEL_EVENTS_MAN%"
+if %errorlevel% neq 0 echo WARNING: This step failed.
+wevtutil.exe install-manifest "%KERNEL_EVENTS_MAN%" /rf:%RIFTENABLER_SYS% /mf:%RIFTENABLER_SYS%
+REM make sure it worked
+wevtutil get-publisher OVR-Kernel > nul
+if %errorlevel% neq 0 echo WARNING: This step failed.
+echo Installed %KERNEL_EVENTS_MAN%
+
+if exist "%SDK_MANIFEST_PATH%\RTFilterEvents.man" set RFILTER_EVENTS_MAN=%SDK_MANIFEST_PATH%\RTFilterEvents.man
+if exist "%RIFTDISPLAYDRIVER_DIR%\rt_filter\RTFilterEvents.man" set RFILTER_EVENTS_MAN=%RIFTDISPLAYDRIVER_DIR%\rt_filter\RTFilterEvents.man
+if exist ".\RTFilterEvents.man" set RFILTER_EVENTS_MAN=.\RTFilterEvents.man
+
+echo Installing %OVRDISPLAYRT_DLL% manifest...
+REM uninstall any existing manifest first
+wevtutil.exe uninstall-manifest "%RFILTER_EVENTS_MAN%"
+if %errorlevel% neq 0 echo WARNING: This step failed.
+wevtutil.exe install-manifest "%RFILTER_EVENTS_MAN%" /rf:%OVRDISPLAYRT_DLL% /mf:%OVRDISPLAYRT_DLL%
+REM make sure it worked
+wevtutil get-publisher OVR-RTFilter > nul
+if %errorlevel% neq 0 echo WARNING: This step failed.
+echo Installed %RFILTER_EVENTS_MAN%
+
+if exist "%SDK_MANIFEST_PATH%\OVRUSBVidEvents.man" set USBVID_EVENTS_MAN=%SDK_MANIFEST_PATH%\OVRUSBVidEvents.man
+if exist "%RIFTCAMERADRIVER_DIR%\OCUSBVID\OVRUSBVidEvents.man" set USBVID_EVENTS_MAN=%RIFTCAMERADRIVER_DIR%\OCUSBVID\OVRUSBVidEvents.man
+if exist ".\OVRUSBVidEvents.man" set USBVID_EVENTS_MAN=.\OVRUSBVidEvents.man
+
+echo Installing %OCUSBVID_SYS% manifest...
+REM uninstall any existing manifest first
+wevtutil.exe uninstall-manifest "%USBVID_EVENTS_MAN%"
+if %errorlevel% neq 0 echo WARNING: This step failed.
+wevtutil.exe install-manifest "%USBVID_EVENTS_MAN%" /rf:%OCUSBVID_SYS% /mf:%OCUSBVID_SYS%
+REM make sure it worked
+wevtutil get-publisher OVR-USBVid > nul
+if %errorlevel% neq 0 echo WARNING: This step failed.
+echo Installed %USBVID_EVENTS_MAN%
+
+REM XXX eventually add OVR-Compositor here...
+
+if exist "%SDK_MANIFEST_PATH%\LibOVREvents.man" set LIBOVR_EVENTS_MAN=%SDK_MANIFEST_PATH%\LibOVREvents.man
+if exist ".\LibOVREvents.man" set LIBOVR_EVENTS_MAN=.\LibOVREvents.man
+
+REM this nightmare command copies the newest version of LibOVRRT*.dll into the current directory without prompting...
+forfiles /p:c:\Windows\System32 /m:LibOVRRT*.dll /c "cmd /c xcopy /y /f /d @path %cd% >nul" >nul 2>nul
+forfiles /s /p:..\..\..\LibOVR\Lib\Windows /m:LibOVRRT*.dll /c "cmd /c xcopy /y /f /d @path %cd% >nul" >nul 2>nul
+for /f "delims=" %%a in ('dir /b /o:d LibOVRRT*.dll') do set LIBOVR_DLL=%%a
+set LIBOVR_DLL=%cd%\%LIBOVR_DLL%
+echo Installing %LIBOVR_DLL% manifest...
+REM uninstall any existing manifest first
+wevtutil uninstall-manifest "%LIBOVR_EVENTS_MAN%"
+if %errorlevel% neq 0 exit /b 1
+wevtutil install-manifest "%LIBOVR_EVENTS_MAN%" /rf:%LIBOVR_DLL% /mf:%LIBOVR_DLL%
+REM make sure it worked
+wevtutil get-publisher OVR-SDK-LibOVR > nul
+if %errorlevel% neq 0 exit /b 1
+echo Installed %LIBOVR_EVENTS_MAN%
+
+echo You can now start/stop traces with the GUI:
+echo cd ..\..\..\Tools\TraceScript\ovrtap
+echo .\startovrtap.cmd
+echo or (command-line):
+echo cd ..\..\..\Tools\Xperf
+echo log