From 3a3d1d5be3255ddc5ea98ca0caa2d1f0659960e5 Mon Sep 17 00:00:00 2001 From: Anandraj Govindan Date: Mon, 9 Dec 2019 14:38:35 -0800 Subject: [PATCH 1/4] Miscellaneous fixes in ETW tracing and Systrace --- vnext/Desktop/React.Windows.Desktop.vcxproj | 7 +- .../JSI.Desktop.UnitTests.vcxproj | 7 +- vnext/PropertySheets/React.Cpp.props | 12 +- vnext/ReactCommon/ReactCommon.vcxproj | 5 +- vnext/ReactUWP/ReactUWP.vcxproj | 7 +- .../ReactWindowsCore/ReactWindowsCore.vcxproj | 7 +- .../etw/react_native_windows.h | 930 ++++++++---------- .../etw/react_native_windows.man | 169 ++-- vnext/ReactWindowsCore/tracing/fbsystrace.h | 38 +- vnext/ReactWindowsCore/tracing/tracing.cpp | 101 +- vnext/Shared/OInstance.cpp | 4 +- 11 files changed, 552 insertions(+), 735 deletions(-) diff --git a/vnext/Desktop/React.Windows.Desktop.vcxproj b/vnext/Desktop/React.Windows.Desktop.vcxproj index eee91750a38..d6d761f2934 100644 --- a/vnext/Desktop/React.Windows.Desktop.vcxproj +++ b/vnext/Desktop/React.Windows.Desktop.vcxproj @@ -56,10 +56,9 @@ BOOST_ASIO_HAS_IOCP - Force unique layout/size for boost::asio::basic_stream_socket<> subtypes. --> BOOST_ASIO_HAS_IOCP;_WINSOCK_DEPRECATED_NO_WARNINGS;_WIN32_WINNT=_WIN32_WINNT_WIN7;WIN32;_WINDOWS;REACTNATIVEWIN32_EXPORTS;FOLLY_NO_CONFIG;NOMINMAX;GLOG_NO_ABBREVIATED_SEVERITIES;_HAS_AUTO_PTR_ETC;CHAKRACORE;RN_PLATFORM=win32;RN_EXPORT=;JSI_EXPORT=;%(PreprocessorDefinitions) - ENABLE_TRACING;%(PreprocessorDefinitions) - ENABLE_NATIVE_SYSTRACE;WITH_FBSYSTRACE;%(PreprocessorDefinitions) - ENABLE_JS_SYSTRACE;WITH_FBSYSTRACE;%(PreprocessorDefinitions) - ENABLE_TRACE_POSTPROCESSING;%(PreprocessorDefinitions) + ENABLE_ETW_TRACING;%(PreprocessorDefinitions) + ENABLE_NATIVE_SYSTRACE_TO_ETW;WITH_FBSYSTRACE;%(PreprocessorDefinitions) + ENABLE_JS_SYSTRACE_TO_ETW;WITH_FBSYSTRACE;%(PreprocessorDefinitions) %(AdditionalOptions) /Zc:strictStrings /bigobj Use pch.h diff --git a/vnext/JSI.Desktop.UnitTests/JSI.Desktop.UnitTests.vcxproj b/vnext/JSI.Desktop.UnitTests/JSI.Desktop.UnitTests.vcxproj index a13b12a0645..781ae42b822 100644 --- a/vnext/JSI.Desktop.UnitTests/JSI.Desktop.UnitTests.vcxproj +++ b/vnext/JSI.Desktop.UnitTests/JSI.Desktop.UnitTests.vcxproj @@ -49,10 +49,9 @@ string literals. It prevents code like wchar_t* str = L"hello"; from compiling. --> - ENABLE_TRACING;%(PreprocessorDefinitions) - ENABLE_NATIVE_SYSTRACE;WITH_FBSYSTRACE;%(PreprocessorDefinitions) - ENABLE_JS_SYSTRACE;WITH_FBSYSTRACE;%(PreprocessorDefinitions) - ENABLE_TRACE_POSTPROCESSING;%(PreprocessorDefinitions) + ENABLE_ETW_TRACING;%(PreprocessorDefinitions) + ENABLE_NATIVE_SYSTRACE_TO_ETW;WITH_FBSYSTRACE;%(PreprocessorDefinitions) + ENABLE_JS_SYSTRACE_TO_ETW;WITH_FBSYSTRACE;%(PreprocessorDefinitions) %(AdditionalOptions) /Zc:strictStrings diff --git a/vnext/PropertySheets/React.Cpp.props b/vnext/PropertySheets/React.Cpp.props index 1bdbb1c6174..f514845af0c 100644 --- a/vnext/PropertySheets/React.Cpp.props +++ b/vnext/PropertySheets/React.Cpp.props @@ -25,10 +25,14 @@ 0.1.6 $(SolutionDir)packages\ReactNative.V8JSI.Windows.$(HERMES_Version) - true - true - true - false + + true + + + true + + + true diff --git a/vnext/ReactCommon/ReactCommon.vcxproj b/vnext/ReactCommon/ReactCommon.vcxproj index 760d3817f69..729361ef95d 100644 --- a/vnext/ReactCommon/ReactCommon.vcxproj +++ b/vnext/ReactCommon/ReactCommon.vcxproj @@ -66,9 +66,8 @@ false true $(ReactNativeDir)\ReactCommon;$(JSI_Source);$(ReactNativeDir)\ReactCommon\jscallinvoker;$(ReactNativeDir)\ReactCommon\jsiexecutor;$(FollyDir);$(ReactNativeWindowsDir)stubs;$(ReactNativeWindowsDir)\ReactWindowsCore\tracing;%(AdditionalIncludeDirectories) - ENABLE_NATIVE_SYSTRACE;WITH_FBSYSTRACE;%(PreprocessorDefinitions) - ENABLE_JS_SYSTRACE;WITH_FBSYSTRACE;%(PreprocessorDefinitions) - ENABLE_TRACE_POSTPROCESSING;%(PreprocessorDefinitions) + ENABLE_NATIVE_SYSTRACE_TO_ETW;WITH_FBSYSTRACE;%(PreprocessorDefinitions) + ENABLE_JS_SYSTRACE_TO_ETW;WITH_FBSYSTRACE;%(PreprocessorDefinitions) _WIN32;_CRT_SECURE_NO_WARNINGS;FOLLY_NO_CONFIG;NOMINMAX;RN_EXPORT=;JSI_EXPORT=;WIN32;_WINDLL;%(PreprocessorDefinitions) 4715;4146;4251;4800;4804;4305;4722;%(DisableSpecificWarnings) diff --git a/vnext/ReactUWP/ReactUWP.vcxproj b/vnext/ReactUWP/ReactUWP.vcxproj index c8c23995d8c..bb7291198f1 100644 --- a/vnext/ReactUWP/ReactUWP.vcxproj +++ b/vnext/ReactUWP/ReactUWP.vcxproj @@ -76,10 +76,9 @@ USE_EDGEMODE_JSRT;%(PreprocessorDefinitions) USE_HERMES;%(PreprocessorDefinitions) USE_V8;%(PreprocessorDefinitions) - ENABLE_TRACING;%(PreprocessorDefinitions) - ENABLE_NATIVE_SYSTRACE;WITH_FBSYSTRACE;%(PreprocessorDefinitions) - ENABLE_JS_SYSTRACE;WITH_FBSYSTRACE;%(PreprocessorDefinitions) - ENABLE_TRACE_POSTPROCESSING;%(PreprocessorDefinitions) + ENABLE_ETW_TRACING;%(PreprocessorDefinitions) + ENABLE_NATIVE_SYSTRACE_TO_ETW;WITH_FBSYSTRACE;%(PreprocessorDefinitions) + ENABLE_JS_SYSTRACE_TO_ETW;WITH_FBSYSTRACE;%(PreprocessorDefinitions) REACTWINDOWS_BUILD; RN_PLATFORM=windows; diff --git a/vnext/ReactWindowsCore/ReactWindowsCore.vcxproj b/vnext/ReactWindowsCore/ReactWindowsCore.vcxproj index ce508282b28..a6e822a71f9 100644 --- a/vnext/ReactWindowsCore/ReactWindowsCore.vcxproj +++ b/vnext/ReactWindowsCore/ReactWindowsCore.vcxproj @@ -70,10 +70,9 @@ REACTWINDOWS_BUILD;NOMINMAX;FOLLY_NO_CONFIG;WIN32=0;RN_EXPORT=;CHAKRACORE;%(PreprocessorDefinitions) USE_HERMES;%(PreprocessorDefinitions) USE_V8;%(PreprocessorDefinitions) - ENABLE_TRACING;%(PreprocessorDefinitions) - ENABLE_NATIVE_SYSTRACE;WITH_FBSYSTRACE;%(PreprocessorDefinitions) - ENABLE_JS_SYSTRACE;WITH_FBSYSTRACE;%(PreprocessorDefinitions) - ENABLE_TRACE_POSTPROCESSING;%(PreprocessorDefinitions) + ENABLE_ETW_TRACING;%(PreprocessorDefinitions) + ENABLE_NATIVE_SYSTRACE_TO_ETW;WITH_FBSYSTRACE;%(PreprocessorDefinitions) + ENABLE_JS_SYSTRACE_TO_ETW;WITH_FBSYSTRACE;%(PreprocessorDefinitions) $(ReactNativeWindowsDir);$(ReactNativeWindowsDir)Common;$(ReactNativeWindowsDir)Shared;$(ReactNativeWindowsDir)include;$(ReactNativeWindowsDir)include\ReactWindowsCore;$(ReactNativeDir)\ReactCommon;$(JSI_Source);$(ReactNativeWindowsDir)stubs;$(FollyDir);$(ReactNativeWindowsDir)\ReactWindowsCore\tracing;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) $(HERMES_Package)\installed\$(VcpkgTriplet)\include\;%(AdditionalIncludeDirectories) $(V8_Package)\installed\$(VcpkgTriplet)\include\;%(AdditionalIncludeDirectories) diff --git a/vnext/ReactWindowsCore/etw/react_native_windows.h b/vnext/ReactWindowsCore/etw/react_native_windows.h index c017cf782d4..9c674957305 100644 --- a/vnext/ReactWindowsCore/etw/react_native_windows.h +++ b/vnext/ReactWindowsCore/etw/react_native_windows.h @@ -50,9 +50,9 @@ // //***************************************************************************** -#include -#include #include +#include +#include #if !defined(ETW_INLINE) #define ETW_INLINE DECLSPEC_NOINLINE __inline @@ -79,11 +79,11 @@ extern "C" { // MCGEN_EVENTWRITETRANSFER or MCGEN_EVENTREGISTER macros. // #ifndef MCGEN_USE_KERNEL_MODE_APIS -#ifdef _ETW_KM_ -#define MCGEN_USE_KERNEL_MODE_APIS 1 -#else -#define MCGEN_USE_KERNEL_MODE_APIS 0 -#endif + #ifdef _ETW_KM_ + #define MCGEN_USE_KERNEL_MODE_APIS 1 + #else + #define MCGEN_USE_KERNEL_MODE_APIS 0 + #endif #endif // MCGEN_USE_KERNEL_MODE_APIS // @@ -104,22 +104,21 @@ extern "C" { // or more provider in a manifest has provider traits. // #ifndef MCGEN_HAVE_EVENTSETINFORMATION -#ifdef MCGEN_EVENTSETINFORMATION // if MCGEN_EVENTSETINFORMATION has been - // customized, -#define MCGEN_HAVE_EVENTSETINFORMATION 1 // directly invoke MCGEN_EVENTSETINFORMATION(...). -#elif MCGEN_USE_KERNEL_MODE_APIS // else if using kernel-mode APIs, -#if NTDDI_VERSION >= 0x06040000 // if target OS is Windows 10 or later, -#define MCGEN_HAVE_EVENTSETINFORMATION 1 // directly invoke MCGEN_EVENTSETINFORMATION(...). -#else // else -#define MCGEN_HAVE_EVENTSETINFORMATION 2 // find "EtwSetInformation" via MmGetSystemRoutineAddress. -#endif // else (using user-mode APIs) -#else // if target OS and SDK is Windows 8 or later, -#if WINVER >= 0x0602 && defined(EVENT_FILTER_TYPE_SCHEMATIZED) -#define MCGEN_HAVE_EVENTSETINFORMATION 1 // directly invoke MCGEN_EVENTSETINFORMATION(...). -#else // else -#define MCGEN_HAVE_EVENTSETINFORMATION 2 // find "EventSetInformation" via GetModuleHandleExW/GetProcAddress. -#endif -#endif + #ifdef MCGEN_EVENTSETINFORMATION // if MCGEN_EVENTSETINFORMATION has been customized, + #define MCGEN_HAVE_EVENTSETINFORMATION 1 // directly invoke MCGEN_EVENTSETINFORMATION(...). + #elif MCGEN_USE_KERNEL_MODE_APIS // else if using kernel-mode APIs, + #if NTDDI_VERSION >= 0x06040000 // if target OS is Windows 10 or later, + #define MCGEN_HAVE_EVENTSETINFORMATION 1 // directly invoke MCGEN_EVENTSETINFORMATION(...). + #else // else + #define MCGEN_HAVE_EVENTSETINFORMATION 2 // find "EtwSetInformation" via MmGetSystemRoutineAddress. + #endif // else (using user-mode APIs) + #else // if target OS and SDK is Windows 8 or later, + #if WINVER >= 0x0602 && defined(EVENT_FILTER_TYPE_SCHEMATIZED) + #define MCGEN_HAVE_EVENTSETINFORMATION 1 // directly invoke MCGEN_EVENTSETINFORMATION(...). + #else // else + #define MCGEN_HAVE_EVENTSETINFORMATION 2 // find "EventSetInformation" via GetModuleHandleExW/GetProcAddress. + #endif + #endif #endif // MCGEN_HAVE_EVENTSETINFORMATION // @@ -127,11 +126,11 @@ extern "C" { // Override to use a custom API. // #ifndef MCGEN_EVENTWRITETRANSFER -#if MCGEN_USE_KERNEL_MODE_APIS -#define MCGEN_EVENTWRITETRANSFER EtwWriteTransfer -#else -#define MCGEN_EVENTWRITETRANSFER EventWriteTransfer -#endif + #if MCGEN_USE_KERNEL_MODE_APIS + #define MCGEN_EVENTWRITETRANSFER EtwWriteTransfer + #else + #define MCGEN_EVENTWRITETRANSFER EventWriteTransfer + #endif #endif // MCGEN_EVENTWRITETRANSFER // @@ -139,11 +138,11 @@ extern "C" { // Override to use a custom API. // #ifndef MCGEN_EVENTREGISTER -#if MCGEN_USE_KERNEL_MODE_APIS -#define MCGEN_EVENTREGISTER EtwRegister -#else -#define MCGEN_EVENTREGISTER EventRegister -#endif + #if MCGEN_USE_KERNEL_MODE_APIS + #define MCGEN_EVENTREGISTER EtwRegister + #else + #define MCGEN_EVENTREGISTER EventRegister + #endif #endif // MCGEN_EVENTREGISTER // @@ -152,11 +151,11 @@ extern "C" { // (McGenEventSetInformation also affected by MCGEN_HAVE_EVENTSETINFORMATION.) // #ifndef MCGEN_EVENTSETINFORMATION -#if MCGEN_USE_KERNEL_MODE_APIS -#define MCGEN_EVENTSETINFORMATION EtwSetInformation -#else -#define MCGEN_EVENTSETINFORMATION EventSetInformation -#endif + #if MCGEN_USE_KERNEL_MODE_APIS + #define MCGEN_EVENTSETINFORMATION EtwSetInformation + #else + #define MCGEN_EVENTSETINFORMATION EventSetInformation + #endif #endif // MCGEN_EVENTSETINFORMATION // @@ -164,11 +163,11 @@ extern "C" { // Override to use a custom API. // #ifndef MCGEN_EVENTUNREGISTER -#if MCGEN_USE_KERNEL_MODE_APIS -#define MCGEN_EVENTUNREGISTER EtwUnregister -#else -#define MCGEN_EVENTUNREGISTER EventUnregister -#endif + #if MCGEN_USE_KERNEL_MODE_APIS + #define MCGEN_EVENTUNREGISTER EtwUnregister + #else + #define MCGEN_EVENTUNREGISTER EventUnregister + #endif #endif // MCGEN_EVENTUNREGISTER // @@ -177,11 +176,11 @@ extern "C" { // (Should match the type used by MCGEN_EVENTREGISTER.) // #ifndef MCGEN_PENABLECALLBACK -#if MCGEN_USE_KERNEL_MODE_APIS -#define MCGEN_PENABLECALLBACK PETWENABLECALLBACK -#else -#define MCGEN_PENABLECALLBACK PENABLECALLBACK -#endif + #if MCGEN_USE_KERNEL_MODE_APIS + #define MCGEN_PENABLECALLBACK PETWENABLECALLBACK + #else + #define MCGEN_PENABLECALLBACK PENABLECALLBACK + #endif #endif // MCGEN_PENABLECALLBACK // @@ -189,11 +188,11 @@ extern "C" { // Override to use a custom API. // #ifndef MCGEN_GETLENGTHSID -#if MCGEN_USE_KERNEL_MODE_APIS -#define MCGEN_GETLENGTHSID(p) RtlLengthSid((PSID)(p)) -#else -#define MCGEN_GETLENGTHSID(p) GetLengthSid((PSID)(p)) -#endif + #if MCGEN_USE_KERNEL_MODE_APIS + #define MCGEN_GETLENGTHSID(p) RtlLengthSid((PSID)(p)) + #else + #define MCGEN_GETLENGTHSID(p) GetLengthSid((PSID)(p)) + #endif #endif // MCGEN_GETLENGTHSID // @@ -211,12 +210,11 @@ extern "C" { // Implements testing a bit in an array of ULONG, optimized for CPU type. // #ifndef MCGEN_EVENT_BIT_SET -#if defined(_M_IX86) || defined(_M_X64) -#define MCGEN_EVENT_BIT_SET(EnableBits, BitPosition) \ - ((((const unsigned char *)EnableBits)[BitPosition >> 3] & (1u << (BitPosition & 7))) != 0) -#else -#define MCGEN_EVENT_BIT_SET(EnableBits, BitPosition) ((EnableBits[BitPosition >> 5] & (1u << (BitPosition & 31))) != 0) -#endif +# if defined(_M_IX86) || defined(_M_X64) +# define MCGEN_EVENT_BIT_SET(EnableBits, BitPosition) ((((const unsigned char*)EnableBits)[BitPosition >> 3] & (1u << (BitPosition & 7))) != 0) +# else +# define MCGEN_EVENT_BIT_SET(EnableBits, BitPosition) ((EnableBits[BitPosition >> 5] & (1u << (BitPosition & 31))) != 0) +# endif #endif // MCGEN_EVENT_BIT_SET // @@ -231,19 +229,20 @@ extern "C" { #if !defined(MCGEN_TRACE_CONTEXT_DEF) #define MCGEN_TRACE_CONTEXT_DEF -typedef struct _MCGEN_TRACE_CONTEXT { - TRACEHANDLE RegistrationHandle; - TRACEHANDLE Logger; // Used as pointer to provider traits. - ULONGLONG MatchAnyKeyword; - ULONGLONG MatchAllKeyword; - ULONG Flags; - ULONG IsEnabled; - UCHAR Level; - UCHAR Reserve; - USHORT EnableBitsCount; - PULONG EnableBitMask; - const ULONGLONG *EnableKeyWords; - const UCHAR *EnableLevel; +typedef struct _MCGEN_TRACE_CONTEXT +{ + TRACEHANDLE RegistrationHandle; + TRACEHANDLE Logger; // Used as pointer to provider traits. + 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 // MCGEN_TRACE_CONTEXT_DEF @@ -257,28 +256,34 @@ typedef struct _MCGEN_TRACE_CONTEXT { // 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)) { +McGenLevelKeywordEnabled( + _In_ PMCGEN_TRACE_CONTEXT EnableInfo, + _In_ UCHAR Level, + _In_ ULONGLONG Keyword + ) +{ // - // Check if Keyword is enabled + // 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 ((Keyword == (ULONGLONG)0) || - ((Keyword & EnableInfo->MatchAnyKeyword) && - ((Keyword & EnableInfo->MatchAllKeyword) == EnableInfo->MatchAllKeyword))) { - return TRUE; + 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; + return FALSE; } #endif // MCGEN_LEVEL_KEYWORD_ENABLED_DEF @@ -291,22 +296,30 @@ McGenLevelKeywordEnabled(_In_ PMCGEN_TRACE_CONTEXT EnableInfo, _In_ UCHAR Level, // FORCEINLINE BOOLEAN -McGenEventEnabled(_In_ PMCGEN_TRACE_CONTEXT EnableInfo, _In_ PCEVENT_DESCRIPTOR EventDescriptor) { - return McGenLevelKeywordEnabled(EnableInfo, EventDescriptor->Level, EventDescriptor->Keyword); +McGenEventEnabled( + _In_ PMCGEN_TRACE_CONTEXT EnableInfo, + _In_ PCEVENT_DESCRIPTOR EventDescriptor + ) +{ + return McGenLevelKeywordEnabled(EnableInfo, EventDescriptor->Level, EventDescriptor->Keyword); } #endif // MCGEN_EVENT_ENABLED_DEF #if !defined(MCGEN_CONTROL_CALLBACK) #define MCGEN_CONTROL_CALLBACK -DECLSPEC_NOINLINE __inline VOID __stdcall McGenControlCallbackV2( +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) + _Inout_opt_ PVOID CallbackContext + ) /*++ Routine Description: @@ -330,8 +343,8 @@ Routine Description: FilterData - The provider-defined data. - CallbackContext - The context of the callback that is defined when the -provider called EtwRegister to register itself. + CallbackContext - The context of the callback that is defined when the provider + called EtwRegister to register itself. Remarks: @@ -339,86 +352,104 @@ provider called EtwRegister to register itself. --*/ { - PMCGEN_TRACE_CONTEXT Ctx = (PMCGEN_TRACE_CONTEXT)CallbackContext; - ULONG Ix; + PMCGEN_TRACE_CONTEXT Ctx = (PMCGEN_TRACE_CONTEXT)CallbackContext; + ULONG Ix; #ifndef MCGEN_PRIVATE_ENABLE_CALLBACK_V2 - UNREFERENCED_PARAMETER(SourceId); - UNREFERENCED_PARAMETER(FilterData); + 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; - } + 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); + // + // Call user defined callback + // + MCGEN_PRIVATE_ENABLE_CALLBACK_V2( + SourceId, + ControlCode, + Level, + MatchAnyKeyword, + MatchAllKeyword, + FilterData, + CallbackContext + ); #endif // MCGEN_PRIVATE_ENABLE_CALLBACK_V2 - return; + return; } #endif // MCGEN_CONTROL_CALLBACK #ifndef McGenEventWrite_def #define McGenEventWrite_def -DECLSPEC_NOINLINE __inline ULONG __stdcall McGenEventWrite( +DECLSPEC_NOINLINE __inline +ULONG __stdcall +McGenEventWrite( _In_ PMCGEN_TRACE_CONTEXT Context, _In_ PCEVENT_DESCRIPTOR Descriptor, _In_opt_ LPCGUID ActivityId, _In_range_(1, 128) ULONG EventDataCount, - _Inout_updates_(EventDataCount) EVENT_DATA_DESCRIPTOR *EventData) { - const USHORT UNALIGNED *Traits; + _Inout_updates_(EventDataCount) EVENT_DATA_DESCRIPTOR* EventData + ) +{ + const USHORT UNALIGNED* Traits; - // Some customized MCGEN_EVENTWRITETRANSFER macros might ignore ActivityId. - UNREFERENCED_PARAMETER(ActivityId); + // Some customized MCGEN_EVENTWRITETRANSFER macros might ignore ActivityId. + UNREFERENCED_PARAMETER(ActivityId); - Traits = (const USHORT UNALIGNED *)(UINT_PTR)Context->Logger; + Traits = (const USHORT UNALIGNED*)(UINT_PTR)Context->Logger; - if (Traits == NULL) { - EventData[0].Ptr = 0; - EventData[0].Size = 0; - EventData[0].Reserved = 0; - } else { - EventData[0].Ptr = (ULONG_PTR)Traits; - EventData[0].Size = *Traits; - EventData[0].Reserved = 2; // EVENT_DATA_DESCRIPTOR_TYPE_PROVIDER_METADATA - } + if (Traits == NULL) { + EventData[0].Ptr = 0; + EventData[0].Size = 0; + EventData[0].Reserved = 0; + } else { + EventData[0].Ptr = (ULONG_PTR)Traits; + EventData[0].Size = *Traits; + EventData[0].Reserved = 2; // EVENT_DATA_DESCRIPTOR_TYPE_PROVIDER_METADATA + } - return MCGEN_EVENTWRITETRANSFER(Context->RegistrationHandle, Descriptor, ActivityId, NULL, EventDataCount, EventData); + return MCGEN_EVENTWRITETRANSFER( + Context->RegistrationHandle, + Descriptor, + ActivityId, + NULL, + EventDataCount, + EventData); } #endif // McGenEventWrite_def @@ -426,12 +457,15 @@ DECLSPEC_NOINLINE __inline ULONG __stdcall McGenEventWrite( #define McGenEventRegisterUnregister #pragma warning(push) -#pragma warning(disable : 6103) -DECLSPEC_NOINLINE __inline ULONG __stdcall McGenEventRegister( +#pragma warning(disable:6103) +DECLSPEC_NOINLINE __inline +ULONG __stdcall +McGenEventRegister( _In_ LPCGUID ProviderId, _In_opt_ MCGEN_PENABLECALLBACK EnableCallback, _In_opt_ PVOID CallbackContext, - _Inout_ PREGHANDLE RegHandle) + _Inout_ PREGHANDLE RegHandle + ) /*++ Routine Description: @@ -457,19 +491,24 @@ Routine Description: --*/ { - ULONG Error; + ULONG Error; - if (*RegHandle != 0) { - Error = 0; // ERROR_SUCCESS - } else { - Error = MCGEN_EVENTREGISTER(ProviderId, EnableCallback, CallbackContext, RegHandle); - } + if (*RegHandle != 0) + { + Error = 0; // ERROR_SUCCESS + } + else + { + Error = MCGEN_EVENTREGISTER(ProviderId, EnableCallback, CallbackContext, RegHandle); + } - return Error; + return Error; } #pragma warning(pop) -DECLSPEC_NOINLINE __inline ULONG __stdcall McGenEventUnregister(_Inout_ PREGHANDLE RegHandle) +DECLSPEC_NOINLINE __inline +ULONG __stdcall +McGenEventUnregister(_Inout_ PREGHANDLE RegHandle) /*++ Routine Description: @@ -488,16 +527,19 @@ Routine Description: --*/ { - ULONG Error; + ULONG Error; - if (*RegHandle == 0) { - Error = 0; // ERROR_SUCCESS - } else { - Error = MCGEN_EVENTUNREGISTER(*RegHandle); - *RegHandle = (REGHANDLE)0; - } + if(*RegHandle == 0) + { + Error = 0; // ERROR_SUCCESS + } + else + { + Error = MCGEN_EVENTUNREGISTER(*RegHandle); + *RegHandle = (REGHANDLE)0; + } - return Error; + return Error; } #endif // McGenEventRegisterUnregister @@ -509,10 +551,7 @@ Routine Description: //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // Provider GUID = cec49226-329e-4ea2-a16a-c37c6c0b2cd7 -EXTERN_C __declspec(selectany) const GUID REACT_NATIVE_WINDOWS = {0xcec49226, - 0x329e, - 0x4ea2, - {0xa1, 0x6a, 0xc3, 0x7c, 0x6c, 0x0b, 0x2c, 0xd7}}; +EXTERN_C __declspec(selectany) const GUID REACT_NATIVE_WINDOWS = {0xcec49226, 0x329e, 0x4ea2, {0xa1, 0x6a, 0xc3, 0x7c, 0x6c, 0x0b, 0x2c, 0xd7}}; #ifndef REACT_NATIVE_WINDOWS_Traits #define REACT_NATIVE_WINDOWS_Traits NULL @@ -597,19 +636,7 @@ EXTERN_C __declspec(selectany) const unsigned char React_Native_Windows_Provider // // Provider context // -EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context = { - 0, - (ULONG_PTR)REACT_NATIVE_WINDOWS_Traits, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - React_Native_Windows_ProviderEnableBits, - React_Native_Windows_ProviderKeywords, - React_Native_Windows_ProviderLevels}; +EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context = {0, (ULONG_PTR)REACT_NATIVE_WINDOWS_Traits, 0, 0, 0, 0, 0, 0, 1, React_Native_Windows_ProviderEnableBits, React_Native_Windows_ProviderKeywords, React_Native_Windows_ProviderLevels}; // // Provider REGHANDLE @@ -632,12 +659,7 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // EventUnregister macros (they will be no-ops if EventRegister failed). // #ifndef EventRegisterReact_Native_Windows_Provider -#define EventRegisterReact_Native_Windows_Provider() \ - McGenEventRegister( \ - &REACT_NATIVE_WINDOWS, \ - McGenControlCallbackV2, \ - &REACT_NATIVE_WINDOWS_Context, \ - &React_Native_Windows_ProviderHandle) +#define EventRegisterReact_Native_Windows_Provider() McGenEventRegister(&REACT_NATIVE_WINDOWS, McGenControlCallbackV2, &REACT_NATIVE_WINDOWS_Context, &React_Native_Windows_ProviderHandle) #endif // @@ -645,9 +667,7 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // is specified in the manifest). Advanced scenarios only. // #ifndef EventRegisterByGuidReact_Native_Windows_Provider -#define EventRegisterByGuidReact_Native_Windows_Provider(Guid) \ - McGenEventRegister( \ - &(Guid), McGenControlCallbackV2, &REACT_NATIVE_WINDOWS_Context, &React_Native_Windows_ProviderHandle) +#define EventRegisterByGuidReact_Native_Windows_Provider(Guid) McGenEventRegister(&(Guid), McGenControlCallbackV2, &REACT_NATIVE_WINDOWS_Context, &React_Native_Windows_ProviderHandle) #endif // @@ -670,36 +690,11 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // // Event write macros for JS_BEGIN_SECTION // -#define EventWriteJS_BEGIN_SECTION(tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ - MCGEN_EVENT_ENABLED(JS_BEGIN_SECTION) \ - ? McTemplateU0xsssssssss( \ - &REACT_NATIVE_WINDOWS_Context, \ - &JS_BEGIN_SECTION, \ - tag, \ - profileName, \ - arg0, \ - arg1, \ - arg2, \ - arg3, \ - arg4, \ - arg5, \ - arg6, \ - arg7) \ - : 0 -#define EventWriteJS_BEGIN_SECTION_AssumeEnabled(tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ - McTemplateU0xsssssssss( \ - &REACT_NATIVE_WINDOWS_Context, \ - &JS_BEGIN_SECTION, \ - tag, \ - profileName, \ - arg0, \ - arg1, \ - arg2, \ - arg3, \ - arg4, \ - arg5, \ - arg6, \ - arg7) +#define EventWriteJS_BEGIN_SECTION(id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ + MCGEN_EVENT_ENABLED(JS_BEGIN_SECTION) \ + ? McTemplateU0xxsssssssss(&REACT_NATIVE_WINDOWS_Context, &JS_BEGIN_SECTION, id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) : 0 +#define EventWriteJS_BEGIN_SECTION_AssumeEnabled(id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ + McTemplateU0xxsssssssss(&REACT_NATIVE_WINDOWS_Context, &JS_BEGIN_SECTION, id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) // // Enablement check macro for JS_END_SECTION @@ -709,11 +704,11 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // // Event write macros for JS_END_SECTION // -#define EventWriteJS_END_SECTION(tag, profileName, duration) \ - MCGEN_EVENT_ENABLED(JS_END_SECTION) \ - ? McTemplateU0xsg(&REACT_NATIVE_WINDOWS_Context, &JS_END_SECTION, tag, profileName, duration) : 0 -#define EventWriteJS_END_SECTION_AssumeEnabled(tag, profileName, duration) \ - McTemplateU0xsg(&REACT_NATIVE_WINDOWS_Context, &JS_END_SECTION, tag, profileName, duration) +#define EventWriteJS_END_SECTION(id, tag, profileName, duration) \ + MCGEN_EVENT_ENABLED(JS_END_SECTION) \ + ? McTemplateU0xxsg(&REACT_NATIVE_WINDOWS_Context, &JS_END_SECTION, id, tag, profileName, duration) : 0 +#define EventWriteJS_END_SECTION_AssumeEnabled(id, tag, profileName, duration) \ + McTemplateU0xxsg(&REACT_NATIVE_WINDOWS_Context, &JS_END_SECTION, id, tag, profileName, duration) // // Enablement check macro for JS_ASYNC_BEGIN_SECTION @@ -724,10 +719,10 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // Event write macros for JS_ASYNC_BEGIN_SECTION // #define EventWriteJS_ASYNC_BEGIN_SECTION(tag, profileName, cookie, duration) \ - MCGEN_EVENT_ENABLED(JS_ASYNC_BEGIN_SECTION) \ - ? McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &JS_ASYNC_BEGIN_SECTION, tag, profileName, cookie, duration) : 0 + MCGEN_EVENT_ENABLED(JS_ASYNC_BEGIN_SECTION) \ + ? McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &JS_ASYNC_BEGIN_SECTION, tag, profileName, cookie, duration) : 0 #define EventWriteJS_ASYNC_BEGIN_SECTION_AssumeEnabled(tag, profileName, cookie, duration) \ - McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &JS_ASYNC_BEGIN_SECTION, tag, profileName, cookie, duration) + McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &JS_ASYNC_BEGIN_SECTION, tag, profileName, cookie, duration) // // Enablement check macro for JS_ASYNC_END_SECTION @@ -738,10 +733,10 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // Event write macros for JS_ASYNC_END_SECTION // #define EventWriteJS_ASYNC_END_SECTION(tag, profileName, cookie, duration) \ - MCGEN_EVENT_ENABLED(JS_ASYNC_END_SECTION) \ - ? McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &JS_ASYNC_END_SECTION, tag, profileName, cookie, duration) : 0 + MCGEN_EVENT_ENABLED(JS_ASYNC_END_SECTION) \ + ? McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &JS_ASYNC_END_SECTION, tag, profileName, cookie, duration) : 0 #define EventWriteJS_ASYNC_END_SECTION_AssumeEnabled(tag, profileName, cookie, duration) \ - McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &JS_ASYNC_END_SECTION, tag, profileName, cookie, duration) + McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &JS_ASYNC_END_SECTION, tag, profileName, cookie, duration) // // Enablement check macro for JS_ASYNC_BEGIN_FLOW @@ -752,10 +747,10 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // Event write macros for JS_ASYNC_BEGIN_FLOW // #define EventWriteJS_ASYNC_BEGIN_FLOW(tag, profileName, cookie, duration) \ - MCGEN_EVENT_ENABLED(JS_ASYNC_BEGIN_FLOW) \ - ? McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &JS_ASYNC_BEGIN_FLOW, tag, profileName, cookie, duration) : 0 + MCGEN_EVENT_ENABLED(JS_ASYNC_BEGIN_FLOW) \ + ? McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &JS_ASYNC_BEGIN_FLOW, tag, profileName, cookie, duration) : 0 #define EventWriteJS_ASYNC_BEGIN_FLOW_AssumeEnabled(tag, profileName, cookie, duration) \ - McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &JS_ASYNC_BEGIN_FLOW, tag, profileName, cookie, duration) + McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &JS_ASYNC_BEGIN_FLOW, tag, profileName, cookie, duration) // // Enablement check macro for JS_ASYNC_END_FLOW @@ -766,10 +761,10 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // Event write macros for JS_ASYNC_END_FLOW // #define EventWriteJS_ASYNC_END_FLOW(tag, profileName, cookie, duration) \ - MCGEN_EVENT_ENABLED(JS_ASYNC_END_FLOW) \ - ? McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &JS_ASYNC_END_FLOW, tag, profileName, cookie, duration) : 0 + MCGEN_EVENT_ENABLED(JS_ASYNC_END_FLOW) \ + ? McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &JS_ASYNC_END_FLOW, tag, profileName, cookie, duration) : 0 #define EventWriteJS_ASYNC_END_FLOW_AssumeEnabled(tag, profileName, cookie, duration) \ - McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &JS_ASYNC_END_FLOW, tag, profileName, cookie, duration) + McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &JS_ASYNC_END_FLOW, tag, profileName, cookie, duration) // // Enablement check macro for JS_COUNTER @@ -780,10 +775,10 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // Event write macros for JS_COUNTER // #define EventWriteJS_COUNTER(tag, profileName, value) \ - MCGEN_EVENT_ENABLED(JS_COUNTER) \ - ? McTemplateU0xsd(&REACT_NATIVE_WINDOWS_Context, &JS_COUNTER, tag, profileName, value) : 0 + MCGEN_EVENT_ENABLED(JS_COUNTER) \ + ? McTemplateU0xsd(&REACT_NATIVE_WINDOWS_Context, &JS_COUNTER, tag, profileName, value) : 0 #define EventWriteJS_COUNTER_AssumeEnabled(tag, profileName, value) \ - McTemplateU0xsd(&REACT_NATIVE_WINDOWS_Context, &JS_COUNTER, tag, profileName, value) + McTemplateU0xsd(&REACT_NATIVE_WINDOWS_Context, &JS_COUNTER, tag, profileName, value) // // Enablement check macro for EVALUATE_SCRIPT_BEGIN @@ -793,37 +788,11 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // // Event write macros for EVALUATE_SCRIPT_BEGIN // -#define EventWriteEVALUATE_SCRIPT_BEGIN(tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ - MCGEN_EVENT_ENABLED(EVALUATE_SCRIPT_BEGIN) \ - ? McTemplateU0xsssssssss( \ - &REACT_NATIVE_WINDOWS_Context, \ - &EVALUATE_SCRIPT_BEGIN, \ - tag, \ - profileName, \ - arg0, \ - arg1, \ - arg2, \ - arg3, \ - arg4, \ - arg5, \ - arg6, \ - arg7) \ - : 0 -#define EventWriteEVALUATE_SCRIPT_BEGIN_AssumeEnabled( \ - tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ - McTemplateU0xsssssssss( \ - &REACT_NATIVE_WINDOWS_Context, \ - &EVALUATE_SCRIPT_BEGIN, \ - tag, \ - profileName, \ - arg0, \ - arg1, \ - arg2, \ - arg3, \ - arg4, \ - arg5, \ - arg6, \ - arg7) +#define EventWriteEVALUATE_SCRIPT_BEGIN(id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ + MCGEN_EVENT_ENABLED(EVALUATE_SCRIPT_BEGIN) \ + ? McTemplateU0xxsssssssss(&REACT_NATIVE_WINDOWS_Context, &EVALUATE_SCRIPT_BEGIN, id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) : 0 +#define EventWriteEVALUATE_SCRIPT_BEGIN_AssumeEnabled(id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ + McTemplateU0xxsssssssss(&REACT_NATIVE_WINDOWS_Context, &EVALUATE_SCRIPT_BEGIN, id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) // // Enablement check macro for EVALUATE_SCRIPT_END @@ -833,11 +802,11 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // // Event write macros for EVALUATE_SCRIPT_END // -#define EventWriteEVALUATE_SCRIPT_END(tag, profileName, duration) \ - MCGEN_EVENT_ENABLED(EVALUATE_SCRIPT_END) \ - ? McTemplateU0xsg(&REACT_NATIVE_WINDOWS_Context, &EVALUATE_SCRIPT_END, tag, profileName, duration) : 0 -#define EventWriteEVALUATE_SCRIPT_END_AssumeEnabled(tag, profileName, duration) \ - McTemplateU0xsg(&REACT_NATIVE_WINDOWS_Context, &EVALUATE_SCRIPT_END, tag, profileName, duration) +#define EventWriteEVALUATE_SCRIPT_END(id, tag, profileName, duration) \ + MCGEN_EVENT_ENABLED(EVALUATE_SCRIPT_END) \ + ? McTemplateU0xxsg(&REACT_NATIVE_WINDOWS_Context, &EVALUATE_SCRIPT_END, id, tag, profileName, duration) : 0 +#define EventWriteEVALUATE_SCRIPT_END_AssumeEnabled(id, tag, profileName, duration) \ + McTemplateU0xxsg(&REACT_NATIVE_WINDOWS_Context, &EVALUATE_SCRIPT_END, id, tag, profileName, duration) // // Enablement check macro for CALL_JSFUNCTION_BEGIN @@ -847,37 +816,11 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // // Event write macros for CALL_JSFUNCTION_BEGIN // -#define EventWriteCALL_JSFUNCTION_BEGIN(tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ - MCGEN_EVENT_ENABLED(CALL_JSFUNCTION_BEGIN) \ - ? McTemplateU0xsssssssss( \ - &REACT_NATIVE_WINDOWS_Context, \ - &CALL_JSFUNCTION_BEGIN, \ - tag, \ - profileName, \ - arg0, \ - arg1, \ - arg2, \ - arg3, \ - arg4, \ - arg5, \ - arg6, \ - arg7) \ - : 0 -#define EventWriteCALL_JSFUNCTION_BEGIN_AssumeEnabled( \ - tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ - McTemplateU0xsssssssss( \ - &REACT_NATIVE_WINDOWS_Context, \ - &CALL_JSFUNCTION_BEGIN, \ - tag, \ - profileName, \ - arg0, \ - arg1, \ - arg2, \ - arg3, \ - arg4, \ - arg5, \ - arg6, \ - arg7) +#define EventWriteCALL_JSFUNCTION_BEGIN(id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ + MCGEN_EVENT_ENABLED(CALL_JSFUNCTION_BEGIN) \ + ? McTemplateU0xxsssssssss(&REACT_NATIVE_WINDOWS_Context, &CALL_JSFUNCTION_BEGIN, id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) : 0 +#define EventWriteCALL_JSFUNCTION_BEGIN_AssumeEnabled(id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ + McTemplateU0xxsssssssss(&REACT_NATIVE_WINDOWS_Context, &CALL_JSFUNCTION_BEGIN, id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) // // Enablement check macro for CALL_JSFUNCTION_END @@ -887,11 +830,11 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // // Event write macros for CALL_JSFUNCTION_END // -#define EventWriteCALL_JSFUNCTION_END(tag, profileName, duration) \ - MCGEN_EVENT_ENABLED(CALL_JSFUNCTION_END) \ - ? McTemplateU0xsg(&REACT_NATIVE_WINDOWS_Context, &CALL_JSFUNCTION_END, tag, profileName, duration) : 0 -#define EventWriteCALL_JSFUNCTION_END_AssumeEnabled(tag, profileName, duration) \ - McTemplateU0xsg(&REACT_NATIVE_WINDOWS_Context, &CALL_JSFUNCTION_END, tag, profileName, duration) +#define EventWriteCALL_JSFUNCTION_END(id, tag, profileName, duration) \ + MCGEN_EVENT_ENABLED(CALL_JSFUNCTION_END) \ + ? McTemplateU0xxsg(&REACT_NATIVE_WINDOWS_Context, &CALL_JSFUNCTION_END, id, tag, profileName, duration) : 0 +#define EventWriteCALL_JSFUNCTION_END_AssumeEnabled(id, tag, profileName, duration) \ + McTemplateU0xxsg(&REACT_NATIVE_WINDOWS_Context, &CALL_JSFUNCTION_END, id, tag, profileName, duration) // // Enablement check macro for CALL_NATIVEMODULES_BEGIN @@ -901,37 +844,11 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // // Event write macros for CALL_NATIVEMODULES_BEGIN // -#define EventWriteCALL_NATIVEMODULES_BEGIN(tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ - MCGEN_EVENT_ENABLED(CALL_NATIVEMODULES_BEGIN) \ - ? McTemplateU0xsssssssss( \ - &REACT_NATIVE_WINDOWS_Context, \ - &CALL_NATIVEMODULES_BEGIN, \ - tag, \ - profileName, \ - arg0, \ - arg1, \ - arg2, \ - arg3, \ - arg4, \ - arg5, \ - arg6, \ - arg7) \ - : 0 -#define EventWriteCALL_NATIVEMODULES_BEGIN_AssumeEnabled( \ - tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ - McTemplateU0xsssssssss( \ - &REACT_NATIVE_WINDOWS_Context, \ - &CALL_NATIVEMODULES_BEGIN, \ - tag, \ - profileName, \ - arg0, \ - arg1, \ - arg2, \ - arg3, \ - arg4, \ - arg5, \ - arg6, \ - arg7) +#define EventWriteCALL_NATIVEMODULES_BEGIN(id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ + MCGEN_EVENT_ENABLED(CALL_NATIVEMODULES_BEGIN) \ + ? McTemplateU0xxsssssssss(&REACT_NATIVE_WINDOWS_Context, &CALL_NATIVEMODULES_BEGIN, id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) : 0 +#define EventWriteCALL_NATIVEMODULES_BEGIN_AssumeEnabled(id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ + McTemplateU0xxsssssssss(&REACT_NATIVE_WINDOWS_Context, &CALL_NATIVEMODULES_BEGIN, id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) // // Enablement check macro for CALL_NATIVEMODULES_END @@ -941,11 +858,11 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // // Event write macros for CALL_NATIVEMODULES_END // -#define EventWriteCALL_NATIVEMODULES_END(tag, profileName, duration) \ - MCGEN_EVENT_ENABLED(CALL_NATIVEMODULES_END) \ - ? McTemplateU0xsg(&REACT_NATIVE_WINDOWS_Context, &CALL_NATIVEMODULES_END, tag, profileName, duration) : 0 -#define EventWriteCALL_NATIVEMODULES_END_AssumeEnabled(tag, profileName, duration) \ - McTemplateU0xsg(&REACT_NATIVE_WINDOWS_Context, &CALL_NATIVEMODULES_END, tag, profileName, duration) +#define EventWriteCALL_NATIVEMODULES_END(id, tag, profileName, duration) \ + MCGEN_EVENT_ENABLED(CALL_NATIVEMODULES_END) \ + ? McTemplateU0xxsg(&REACT_NATIVE_WINDOWS_Context, &CALL_NATIVEMODULES_END, id, tag, profileName, duration) : 0 +#define EventWriteCALL_NATIVEMODULES_END_AssumeEnabled(id, tag, profileName, duration) \ + McTemplateU0xxsg(&REACT_NATIVE_WINDOWS_Context, &CALL_NATIVEMODULES_END, id, tag, profileName, duration) // // Enablement check macro for NATIVE_BEGIN_SECTION @@ -955,36 +872,11 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // // Event write macros for NATIVE_BEGIN_SECTION // -#define EventWriteNATIVE_BEGIN_SECTION(tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ - MCGEN_EVENT_ENABLED(NATIVE_BEGIN_SECTION) \ - ? McTemplateU0xsssssssss( \ - &REACT_NATIVE_WINDOWS_Context, \ - &NATIVE_BEGIN_SECTION, \ - tag, \ - profileName, \ - arg0, \ - arg1, \ - arg2, \ - arg3, \ - arg4, \ - arg5, \ - arg6, \ - arg7) \ - : 0 -#define EventWriteNATIVE_BEGIN_SECTION_AssumeEnabled(tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ - McTemplateU0xsssssssss( \ - &REACT_NATIVE_WINDOWS_Context, \ - &NATIVE_BEGIN_SECTION, \ - tag, \ - profileName, \ - arg0, \ - arg1, \ - arg2, \ - arg3, \ - arg4, \ - arg5, \ - arg6, \ - arg7) +#define EventWriteNATIVE_BEGIN_SECTION(id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ + MCGEN_EVENT_ENABLED(NATIVE_BEGIN_SECTION) \ + ? McTemplateU0xxsssssssss(&REACT_NATIVE_WINDOWS_Context, &NATIVE_BEGIN_SECTION, id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) : 0 +#define EventWriteNATIVE_BEGIN_SECTION_AssumeEnabled(id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ + McTemplateU0xxsssssssss(&REACT_NATIVE_WINDOWS_Context, &NATIVE_BEGIN_SECTION, id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) // // Enablement check macro for NATIVE_END_SECTION @@ -994,11 +886,11 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // // Event write macros for NATIVE_END_SECTION // -#define EventWriteNATIVE_END_SECTION(tag, profileName, duration) \ - MCGEN_EVENT_ENABLED(NATIVE_END_SECTION) \ - ? McTemplateU0xsg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_END_SECTION, tag, profileName, duration) : 0 -#define EventWriteNATIVE_END_SECTION_AssumeEnabled(tag, profileName, duration) \ - McTemplateU0xsg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_END_SECTION, tag, profileName, duration) +#define EventWriteNATIVE_END_SECTION(id, tag, profileName, duration) \ + MCGEN_EVENT_ENABLED(NATIVE_END_SECTION) \ + ? McTemplateU0xxsg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_END_SECTION, id, tag, profileName, duration) : 0 +#define EventWriteNATIVE_END_SECTION_AssumeEnabled(id, tag, profileName, duration) \ + McTemplateU0xxsg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_END_SECTION, id, tag, profileName, duration) // // Enablement check macro for NATIVE_ASYNC_BEGIN_SECTION @@ -1009,10 +901,10 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // Event write macros for NATIVE_ASYNC_BEGIN_SECTION // #define EventWriteNATIVE_ASYNC_BEGIN_SECTION(tag, profileName, cookie, duration) \ - MCGEN_EVENT_ENABLED(NATIVE_ASYNC_BEGIN_SECTION) \ - ? McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_ASYNC_BEGIN_SECTION, tag, profileName, cookie, duration) : 0 + MCGEN_EVENT_ENABLED(NATIVE_ASYNC_BEGIN_SECTION) \ + ? McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_ASYNC_BEGIN_SECTION, tag, profileName, cookie, duration) : 0 #define EventWriteNATIVE_ASYNC_BEGIN_SECTION_AssumeEnabled(tag, profileName, cookie, duration) \ - McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_ASYNC_BEGIN_SECTION, tag, profileName, cookie, duration) + McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_ASYNC_BEGIN_SECTION, tag, profileName, cookie, duration) // // Enablement check macro for NATIVE_ASYNC_END_SECTION @@ -1023,10 +915,10 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // Event write macros for NATIVE_ASYNC_END_SECTION // #define EventWriteNATIVE_ASYNC_END_SECTION(tag, profileName, cookie, duration) \ - MCGEN_EVENT_ENABLED(NATIVE_ASYNC_END_SECTION) \ - ? McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_ASYNC_END_SECTION, tag, profileName, cookie, duration) : 0 + MCGEN_EVENT_ENABLED(NATIVE_ASYNC_END_SECTION) \ + ? McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_ASYNC_END_SECTION, tag, profileName, cookie, duration) : 0 #define EventWriteNATIVE_ASYNC_END_SECTION_AssumeEnabled(tag, profileName, cookie, duration) \ - McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_ASYNC_END_SECTION, tag, profileName, cookie, duration) + McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_ASYNC_END_SECTION, tag, profileName, cookie, duration) // // Enablement check macro for NATIVE_ASYNC_BEGIN_FLOW @@ -1037,10 +929,10 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // Event write macros for NATIVE_ASYNC_BEGIN_FLOW // #define EventWriteNATIVE_ASYNC_BEGIN_FLOW(tag, profileName, cookie, duration) \ - MCGEN_EVENT_ENABLED(NATIVE_ASYNC_BEGIN_FLOW) \ - ? McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_ASYNC_BEGIN_FLOW, tag, profileName, cookie, duration) : 0 + MCGEN_EVENT_ENABLED(NATIVE_ASYNC_BEGIN_FLOW) \ + ? McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_ASYNC_BEGIN_FLOW, tag, profileName, cookie, duration) : 0 #define EventWriteNATIVE_ASYNC_BEGIN_FLOW_AssumeEnabled(tag, profileName, cookie, duration) \ - McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_ASYNC_BEGIN_FLOW, tag, profileName, cookie, duration) + McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_ASYNC_BEGIN_FLOW, tag, profileName, cookie, duration) // // Enablement check macro for NATIVE_ASYNC_END_FLOW @@ -1051,10 +943,10 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // Event write macros for NATIVE_ASYNC_END_FLOW // #define EventWriteNATIVE_ASYNC_END_FLOW(tag, profileName, cookie, duration) \ - MCGEN_EVENT_ENABLED(NATIVE_ASYNC_END_FLOW) \ - ? McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_ASYNC_END_FLOW, tag, profileName, cookie, duration) : 0 + MCGEN_EVENT_ENABLED(NATIVE_ASYNC_END_FLOW) \ + ? McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_ASYNC_END_FLOW, tag, profileName, cookie, duration) : 0 #define EventWriteNATIVE_ASYNC_END_FLOW_AssumeEnabled(tag, profileName, cookie, duration) \ - McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_ASYNC_END_FLOW, tag, profileName, cookie, duration) + McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_ASYNC_END_FLOW, tag, profileName, cookie, duration) // // Enablement check macro for NATIVE_COUNTER @@ -1065,10 +957,10 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // Event write macros for NATIVE_COUNTER // #define EventWriteNATIVE_COUNTER(tag, profileName, value) \ - MCGEN_EVENT_ENABLED(NATIVE_COUNTER) \ - ? McTemplateU0xsd(&REACT_NATIVE_WINDOWS_Context, &NATIVE_COUNTER, tag, profileName, value) : 0 + MCGEN_EVENT_ENABLED(NATIVE_COUNTER) \ + ? McTemplateU0xsd(&REACT_NATIVE_WINDOWS_Context, &NATIVE_COUNTER, tag, profileName, value) : 0 #define EventWriteNATIVE_COUNTER_AssumeEnabled(tag, profileName, value) \ - McTemplateU0xsd(&REACT_NATIVE_WINDOWS_Context, &NATIVE_COUNTER, tag, profileName, value) + McTemplateU0xsd(&REACT_NATIVE_WINDOWS_Context, &NATIVE_COUNTER, tag, profileName, value) #endif // MCGEN_DISABLE_PROVIDER_CODE_GENERATION @@ -1083,7 +975,7 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // Template Functions // // -// Template from manifest : tidCounter +//Template from manifest : tidCounter // #ifndef McTemplateU0xsd_def #define McTemplateU0xsd_def @@ -1092,28 +984,29 @@ ULONG McTemplateU0xsd( _In_ PMCGEN_TRACE_CONTEXT Context, _In_ PCEVENT_DESCRIPTOR Descriptor, - _In_ const unsigned __int64 _Arg0, - _In_opt_ PCSTR _Arg1, - _In_ const signed int _Arg2) { + _In_ const unsigned __int64 _Arg0, + _In_opt_ PCSTR _Arg1, + _In_ const signed int _Arg2 + ) +{ #define McTemplateU0xsd_ARGCOUNT 3 - EVENT_DATA_DESCRIPTOR EventData[McTemplateU0xsd_ARGCOUNT + 1]; + EVENT_DATA_DESCRIPTOR EventData[McTemplateU0xsd_ARGCOUNT + 1]; - EventDataDescCreate(&EventData[1], &_Arg0, sizeof(const unsigned __int64)); + EventDataDescCreate(&EventData[1],&_Arg0, sizeof(const unsigned __int64) ); - EventDataDescCreate( - &EventData[2], - (_Arg1 != NULL) ? _Arg1 : "NULL", - (_Arg1 != NULL) ? (ULONG)((strlen(_Arg1) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); + EventDataDescCreate(&EventData[2], + (_Arg1 != NULL) ? _Arg1 : "NULL", + (_Arg1 != NULL) ? (ULONG)((strlen(_Arg1) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); - EventDataDescCreate(&EventData[3], &_Arg2, sizeof(const signed int)); + EventDataDescCreate(&EventData[3],&_Arg2, sizeof(const signed int) ); - return McGenEventWrite(Context, Descriptor, NULL, McTemplateU0xsd_ARGCOUNT + 1, EventData); + return McGenEventWrite(Context, Descriptor, NULL, McTemplateU0xsd_ARGCOUNT + 1, EventData); } #endif // McTemplateU0xsd_def // -// Template from manifest : tidAsyncSection +//Template from manifest : tidAsyncSection // #ifndef McTemplateU0xsdg_def #define McTemplateU0xsdg_def @@ -1122,133 +1015,134 @@ ULONG McTemplateU0xsdg( _In_ PMCGEN_TRACE_CONTEXT Context, _In_ PCEVENT_DESCRIPTOR Descriptor, - _In_ const unsigned __int64 _Arg0, - _In_opt_ PCSTR _Arg1, - _In_ const signed int _Arg2, - _In_ const double _Arg3) { + _In_ const unsigned __int64 _Arg0, + _In_opt_ PCSTR _Arg1, + _In_ const signed int _Arg2, + _In_ const double _Arg3 + ) +{ #define McTemplateU0xsdg_ARGCOUNT 4 - EVENT_DATA_DESCRIPTOR EventData[McTemplateU0xsdg_ARGCOUNT + 1]; + EVENT_DATA_DESCRIPTOR EventData[McTemplateU0xsdg_ARGCOUNT + 1]; - EventDataDescCreate(&EventData[1], &_Arg0, sizeof(const unsigned __int64)); + EventDataDescCreate(&EventData[1],&_Arg0, sizeof(const unsigned __int64) ); - EventDataDescCreate( - &EventData[2], - (_Arg1 != NULL) ? _Arg1 : "NULL", - (_Arg1 != NULL) ? (ULONG)((strlen(_Arg1) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); + EventDataDescCreate(&EventData[2], + (_Arg1 != NULL) ? _Arg1 : "NULL", + (_Arg1 != NULL) ? (ULONG)((strlen(_Arg1) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); - EventDataDescCreate(&EventData[3], &_Arg2, sizeof(const signed int)); + EventDataDescCreate(&EventData[3],&_Arg2, sizeof(const signed int) ); - EventDataDescCreate(&EventData[4], &_Arg3, sizeof(const double)); + EventDataDescCreate(&EventData[4],&_Arg3, sizeof(const double) ); - return McGenEventWrite(Context, Descriptor, NULL, McTemplateU0xsdg_ARGCOUNT + 1, EventData); + return McGenEventWrite(Context, Descriptor, NULL, McTemplateU0xsdg_ARGCOUNT + 1, EventData); } #endif // McTemplateU0xsdg_def // -// Template from manifest : tidEndSection +//Template from manifest : tidEndSection // -#ifndef McTemplateU0xsg_def -#define McTemplateU0xsg_def +#ifndef McTemplateU0xxsg_def +#define McTemplateU0xxsg_def ETW_INLINE ULONG -McTemplateU0xsg( +McTemplateU0xxsg( _In_ PMCGEN_TRACE_CONTEXT Context, _In_ PCEVENT_DESCRIPTOR Descriptor, - _In_ const unsigned __int64 _Arg0, - _In_opt_ PCSTR _Arg1, - _In_ const double _Arg2) { -#define McTemplateU0xsg_ARGCOUNT 3 + _In_ const unsigned __int64 _Arg0, + _In_ const unsigned __int64 _Arg1, + _In_opt_ PCSTR _Arg2, + _In_ const double _Arg3 + ) +{ +#define McTemplateU0xxsg_ARGCOUNT 4 + + EVENT_DATA_DESCRIPTOR EventData[McTemplateU0xxsg_ARGCOUNT + 1]; - EVENT_DATA_DESCRIPTOR EventData[McTemplateU0xsg_ARGCOUNT + 1]; + EventDataDescCreate(&EventData[1],&_Arg0, sizeof(const unsigned __int64) ); - EventDataDescCreate(&EventData[1], &_Arg0, sizeof(const unsigned __int64)); + EventDataDescCreate(&EventData[2],&_Arg1, sizeof(const unsigned __int64) ); - EventDataDescCreate( - &EventData[2], - (_Arg1 != NULL) ? _Arg1 : "NULL", - (_Arg1 != NULL) ? (ULONG)((strlen(_Arg1) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); + EventDataDescCreate(&EventData[3], + (_Arg2 != NULL) ? _Arg2 : "NULL", + (_Arg2 != NULL) ? (ULONG)((strlen(_Arg2) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); - EventDataDescCreate(&EventData[3], &_Arg2, sizeof(const double)); + EventDataDescCreate(&EventData[4],&_Arg3, sizeof(const double) ); - return McGenEventWrite(Context, Descriptor, NULL, McTemplateU0xsg_ARGCOUNT + 1, EventData); + return McGenEventWrite(Context, Descriptor, NULL, McTemplateU0xxsg_ARGCOUNT + 1, EventData); } -#endif // McTemplateU0xsg_def +#endif // McTemplateU0xxsg_def // -// Template from manifest : tidBeginSection +//Template from manifest : tidBeginSection // -#ifndef McTemplateU0xsssssssss_def -#define McTemplateU0xsssssssss_def +#ifndef McTemplateU0xxsssssssss_def +#define McTemplateU0xxsssssssss_def ETW_INLINE ULONG -McTemplateU0xsssssssss( +McTemplateU0xxsssssssss( _In_ PMCGEN_TRACE_CONTEXT Context, _In_ PCEVENT_DESCRIPTOR Descriptor, - _In_ const unsigned __int64 _Arg0, - _In_opt_ PCSTR _Arg1, - _In_opt_ PCSTR _Arg2, - _In_opt_ PCSTR _Arg3, - _In_opt_ PCSTR _Arg4, - _In_opt_ PCSTR _Arg5, - _In_opt_ PCSTR _Arg6, - _In_opt_ PCSTR _Arg7, - _In_opt_ PCSTR _Arg8, - _In_opt_ PCSTR _Arg9) { -#define McTemplateU0xsssssssss_ARGCOUNT 10 - - EVENT_DATA_DESCRIPTOR EventData[McTemplateU0xsssssssss_ARGCOUNT + 1]; - - EventDataDescCreate(&EventData[1], &_Arg0, sizeof(const unsigned __int64)); - - EventDataDescCreate( - &EventData[2], - (_Arg1 != NULL) ? _Arg1 : "NULL", - (_Arg1 != NULL) ? (ULONG)((strlen(_Arg1) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); - - EventDataDescCreate( - &EventData[3], - (_Arg2 != NULL) ? _Arg2 : "NULL", - (_Arg2 != NULL) ? (ULONG)((strlen(_Arg2) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); - - EventDataDescCreate( - &EventData[4], - (_Arg3 != NULL) ? _Arg3 : "NULL", - (_Arg3 != NULL) ? (ULONG)((strlen(_Arg3) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); - - EventDataDescCreate( - &EventData[5], - (_Arg4 != NULL) ? _Arg4 : "NULL", - (_Arg4 != NULL) ? (ULONG)((strlen(_Arg4) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); - - EventDataDescCreate( - &EventData[6], - (_Arg5 != NULL) ? _Arg5 : "NULL", - (_Arg5 != NULL) ? (ULONG)((strlen(_Arg5) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); - - EventDataDescCreate( - &EventData[7], - (_Arg6 != NULL) ? _Arg6 : "NULL", - (_Arg6 != NULL) ? (ULONG)((strlen(_Arg6) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); - - EventDataDescCreate( - &EventData[8], - (_Arg7 != NULL) ? _Arg7 : "NULL", - (_Arg7 != NULL) ? (ULONG)((strlen(_Arg7) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); - - EventDataDescCreate( - &EventData[9], - (_Arg8 != NULL) ? _Arg8 : "NULL", - (_Arg8 != NULL) ? (ULONG)((strlen(_Arg8) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); - - EventDataDescCreate( - &EventData[10], - (_Arg9 != NULL) ? _Arg9 : "NULL", - (_Arg9 != NULL) ? (ULONG)((strlen(_Arg9) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); - - return McGenEventWrite(Context, Descriptor, NULL, McTemplateU0xsssssssss_ARGCOUNT + 1, EventData); + _In_ const unsigned __int64 _Arg0, + _In_ const unsigned __int64 _Arg1, + _In_opt_ PCSTR _Arg2, + _In_opt_ PCSTR _Arg3, + _In_opt_ PCSTR _Arg4, + _In_opt_ PCSTR _Arg5, + _In_opt_ PCSTR _Arg6, + _In_opt_ PCSTR _Arg7, + _In_opt_ PCSTR _Arg8, + _In_opt_ PCSTR _Arg9, + _In_opt_ PCSTR _Arg10 + ) +{ +#define McTemplateU0xxsssssssss_ARGCOUNT 11 + + EVENT_DATA_DESCRIPTOR EventData[McTemplateU0xxsssssssss_ARGCOUNT + 1]; + + EventDataDescCreate(&EventData[1],&_Arg0, sizeof(const unsigned __int64) ); + + EventDataDescCreate(&EventData[2],&_Arg1, sizeof(const unsigned __int64) ); + + EventDataDescCreate(&EventData[3], + (_Arg2 != NULL) ? _Arg2 : "NULL", + (_Arg2 != NULL) ? (ULONG)((strlen(_Arg2) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); + + EventDataDescCreate(&EventData[4], + (_Arg3 != NULL) ? _Arg3 : "NULL", + (_Arg3 != NULL) ? (ULONG)((strlen(_Arg3) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); + + EventDataDescCreate(&EventData[5], + (_Arg4 != NULL) ? _Arg4 : "NULL", + (_Arg4 != NULL) ? (ULONG)((strlen(_Arg4) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); + + EventDataDescCreate(&EventData[6], + (_Arg5 != NULL) ? _Arg5 : "NULL", + (_Arg5 != NULL) ? (ULONG)((strlen(_Arg5) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); + + EventDataDescCreate(&EventData[7], + (_Arg6 != NULL) ? _Arg6 : "NULL", + (_Arg6 != NULL) ? (ULONG)((strlen(_Arg6) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); + + EventDataDescCreate(&EventData[8], + (_Arg7 != NULL) ? _Arg7 : "NULL", + (_Arg7 != NULL) ? (ULONG)((strlen(_Arg7) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); + + EventDataDescCreate(&EventData[9], + (_Arg8 != NULL) ? _Arg8 : "NULL", + (_Arg8 != NULL) ? (ULONG)((strlen(_Arg8) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); + + EventDataDescCreate(&EventData[10], + (_Arg9 != NULL) ? _Arg9 : "NULL", + (_Arg9 != NULL) ? (ULONG)((strlen(_Arg9) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); + + EventDataDescCreate(&EventData[11], + (_Arg10 != NULL) ? _Arg10 : "NULL", + (_Arg10 != NULL) ? (ULONG)((strlen(_Arg10) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); + + return McGenEventWrite(Context, Descriptor, NULL, McTemplateU0xxsssssssss_ARGCOUNT + 1, EventData); } -#endif // McTemplateU0xsssssssss_def +#endif // McTemplateU0xxsssssssss_def #endif // MCGEN_DISABLE_PROVIDER_CODE_GENERATION @@ -1256,4 +1150,4 @@ McTemplateU0xsssssssss( }; #endif -#define MSG_level_Informational 0x50000004L +#define MSG_level_Informational 0x50000004L diff --git a/vnext/ReactWindowsCore/etw/react_native_windows.man b/vnext/ReactWindowsCore/etw/react_native_windows.man index 6bcd9e9f176..775c5b3169d 100644 --- a/vnext/ReactWindowsCore/etw/react_native_windows.man +++ b/vnext/ReactWindowsCore/etw/react_native_windows.man @@ -1,89 +1,86 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vnext/ReactWindowsCore/tracing/fbsystrace.h b/vnext/ReactWindowsCore/tracing/fbsystrace.h index 5376324be71..6c5cf4a6db0 100644 --- a/vnext/ReactWindowsCore/tracing/fbsystrace.h +++ b/vnext/ReactWindowsCore/tracing/fbsystrace.h @@ -9,7 +9,7 @@ #include #define TRACE_TAG_REACT_CXX_BRIDGE 1 << 10 -#define TRACE_TAG_REACT_APPS 1 << 17 +#define TRACE_TAG_REACT_APPS 1 << 11 // Assuming maximum 8 arguments. // TODO :: We assume this magic number "8" at a couple of other places without @@ -20,16 +20,14 @@ namespace facebook { namespace react { namespace tracing { -enum class TraceTask : uint16_t { EvaluateScript, CallJSFunction, CallNativeModules, Unknown }; - void trace_begin_section( + uint64_t id, uint64_t tag, const std::string &profile_name, std::array &&args, - uint8_t size, - TraceTask task); + uint8_t size); -void trace_end_section(uint64_t tag, const std::string &profile_name, double duration, TraceTask task); +void trace_end_section(uint64_t id, uint64_t tag, const std::string &profile_name, double duration); } // namespace tracing } // namespace react } // namespace facebook @@ -41,16 +39,16 @@ namespace fbsystrace { class FbSystraceSection { public: void begin_section() { - facebook::react::tracing::trace_begin_section(tag_, profile_name_, std::move(args_), index_, task_); + facebook::react::tracing::trace_begin_section(id_, tag_, profile_name_, std::move(args_), index_); } void end_section() { facebook::react::tracing::trace_end_section( + id_, tag_, profile_name_, std::chrono::duration_cast>(std::chrono::high_resolution_clock::now() - start_) - .count(), - task_); + .count()); } void init(std::string &&v) { @@ -82,20 +80,7 @@ class FbSystraceSection { template FbSystraceSection(uint64_t tag, std::string &&v, ConvertsToStringPiece &&... rest) : tag_(tag), profile_name_(std::move(v)) { -// This post processing helps in analysing the trace when profiling, but it adds -// some overhead even when the traces are not being captured (i.e. ETW provider -// not enabled.) Hence, the post processing is disabled by default. -#ifdef ENABLE_TRACE_POSTPROCESSING - // Note : We don't want to add any fuzzy text search here as they are - // usually a lot more expensive .. - if (profile_name_.compare("JSIExecutor::loadApplicationScript") == 0) { - task_ = facebook::react::tracing::TraceTask::EvaluateScript; - } else if (profile_name_.compare("JSIExecutor::callFunction") == 0) { - task_ = facebook::react::tracing::TraceTask::CallJSFunction; - } else if (profile_name_.compare("JSIExecutor::callNativeModules") == 0) { - task_ = facebook::react::tracing::TraceTask::CallNativeModules; - } -#endif + id_ = s_id_counter++; init(std::forward(rest)...); } @@ -106,10 +91,13 @@ class FbSystraceSection { private: std::array args_; uint64_t tag_{0}; + + static uint64_t s_id_counter; + uint64_t id_; + std::string profile_name_; uint8_t index_{0}; - facebook::react::tracing::TraceTask task_{facebook::react::tracing::TraceTask::Unknown}; - + std::chrono::high_resolution_clock::time_point start_{std::chrono::high_resolution_clock::now()}; }; diff --git a/vnext/ReactWindowsCore/tracing/tracing.cpp b/vnext/ReactWindowsCore/tracing/tracing.cpp index ac2cfa674a5..259bffed3e9 100644 --- a/vnext/ReactWindowsCore/tracing/tracing.cpp +++ b/vnext/ReactWindowsCore/tracing/tracing.cpp @@ -17,6 +17,8 @@ using namespace facebook; namespace fbsystrace { +/*static */ uint64_t FbSystraceSection::s_id_counter = 0; + /*static */ std::unordered_map FbSystraceAsyncFlow::s_tracker_; /*static */ std::mutex FbSystraceAsyncFlow::s_tracker_mutex_; @@ -58,99 +60,36 @@ namespace react { namespace tracing { void trace_begin_section( + uint64_t id, uint64_t tag, const std::string &profile_name, std::array &&args, - uint8_t size, - TraceTask task) { - switch (task) { - case TraceTask::EvaluateScript: - EventWriteEVALUATE_SCRIPT_BEGIN( - tag, - profile_name.c_str(), - args[0].c_str(), - args[1].c_str(), - args[2].c_str(), - args[3].c_str(), - args[4].c_str(), - args[5].c_str(), - args[6].c_str(), - args[7].c_str()); - break; - - case TraceTask::CallJSFunction: - EventWriteCALL_JSFUNCTION_BEGIN( - tag, - profile_name.c_str(), - args[0].c_str(), - args[1].c_str(), - args[2].c_str(), - args[3].c_str(), - args[4].c_str(), - args[5].c_str(), - args[6].c_str(), - args[7].c_str()); - break; - - case TraceTask::CallNativeModules: - EventWriteCALL_NATIVEMODULES_BEGIN( - tag, - profile_name.c_str(), - args[0].c_str(), - args[1].c_str(), - args[2].c_str(), - args[3].c_str(), - args[4].c_str(), - args[5].c_str(), - args[6].c_str(), - args[7].c_str()); - break; - - case TraceTask::Unknown: - default: - EventWriteNATIVE_BEGIN_SECTION( - tag, - profile_name.c_str(), - args[0].c_str(), - args[1].c_str(), - args[2].c_str(), - args[3].c_str(), - args[4].c_str(), - args[5].c_str(), - args[6].c_str(), - args[7].c_str()); - break; - } + uint8_t size) { + EventWriteNATIVE_BEGIN_SECTION( + id, + tag, + profile_name.c_str(), + args[0].c_str(), + args[1].c_str(), + args[2].c_str(), + args[3].c_str(), + args[4].c_str(), + args[5].c_str(), + args[6].c_str(), + args[7].c_str()); } -void trace_end_section(uint64_t tag, const std::string &profile_name, double duration, TraceTask task) { - switch (task) { - case TraceTask::EvaluateScript: - EventWriteEVALUATE_SCRIPT_END(tag, profile_name.c_str(), duration); - break; - - case TraceTask::CallJSFunction: - EventWriteCALL_JSFUNCTION_END(tag, profile_name.c_str(), duration); - break; - - case TraceTask::CallNativeModules: - EventWriteCALL_NATIVEMODULES_END(tag, profile_name.c_str(), duration); - break; - - case TraceTask::Unknown: - default: - EventWriteNATIVE_END_SECTION(tag, profile_name.c_str(), duration); - break; - } +void trace_end_section(uint64_t id, uint64_t tag, const std::string &profile_name, double duration) { + EventWriteNATIVE_END_SECTION(id, tag, profile_name.c_str(), duration); } void syncSectionBeginJSHook(uint64_t tag, const std::string &profile_name, const std::string &args) { EventWriteJS_BEGIN_SECTION( - tag, profile_name.c_str(), args.c_str(), nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr); + 0, tag, profile_name.c_str(), args.c_str(), nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr); } void syncSectionEndJSHook(uint64_t tag) { - EventWriteJS_END_SECTION(tag, "", 0); + EventWriteJS_END_SECTION(0, tag, "", 0); } void asyncSectionBeginJSHook(uint64_t tag, const std::string &profile_name, int cookie) { diff --git a/vnext/Shared/OInstance.cpp b/vnext/Shared/OInstance.cpp index 28236e29c5d..a450c701b0e 100644 --- a/vnext/Shared/OInstance.cpp +++ b/vnext/Shared/OInstance.cpp @@ -157,7 +157,7 @@ namespace react { namespace { void runtimeInstaller(jsi::Runtime &runtime) { -#ifdef ENABLE_JS_SYSTRACE +#ifdef ENABLE_JS_SYSTRACE_TO_ETW facebook::react::tracing::initializeJSHooks(runtime); #endif } @@ -362,7 +362,7 @@ InstanceImpl::InstanceImpl( // Temp set the logmarker here facebook::react::ReactMarker::logTaggedMarker = logMarker; -#ifdef ENABLE_TRACING +#ifdef ENABLE_ETW_TRACING // TODO :: Find a better place to initialize ETW once per process. facebook::react::tracing::initializeETW(); #endif From 18f03ad2d22015f9f48c4db0f74d9a18125866e1 Mon Sep 17 00:00:00 2001 From: Anandraj Govindan Date: Mon, 9 Dec 2019 14:40:25 -0800 Subject: [PATCH 2/4] Miscellaneous fixes in ETW tracing and Systrace - Adding missing files --- .../etw/react_native_windows.h | 862 ++++++++++-------- vnext/ReactWindowsCore/tracing/fbsystrace.h | 2 +- 2 files changed, 493 insertions(+), 371 deletions(-) diff --git a/vnext/ReactWindowsCore/etw/react_native_windows.h b/vnext/ReactWindowsCore/etw/react_native_windows.h index 9c674957305..a7b8f8b6422 100644 --- a/vnext/ReactWindowsCore/etw/react_native_windows.h +++ b/vnext/ReactWindowsCore/etw/react_native_windows.h @@ -50,9 +50,9 @@ // //***************************************************************************** -#include -#include #include +#include +#include #if !defined(ETW_INLINE) #define ETW_INLINE DECLSPEC_NOINLINE __inline @@ -79,11 +79,11 @@ extern "C" { // MCGEN_EVENTWRITETRANSFER or MCGEN_EVENTREGISTER macros. // #ifndef MCGEN_USE_KERNEL_MODE_APIS - #ifdef _ETW_KM_ - #define MCGEN_USE_KERNEL_MODE_APIS 1 - #else - #define MCGEN_USE_KERNEL_MODE_APIS 0 - #endif +#ifdef _ETW_KM_ +#define MCGEN_USE_KERNEL_MODE_APIS 1 +#else +#define MCGEN_USE_KERNEL_MODE_APIS 0 +#endif #endif // MCGEN_USE_KERNEL_MODE_APIS // @@ -104,21 +104,21 @@ extern "C" { // or more provider in a manifest has provider traits. // #ifndef MCGEN_HAVE_EVENTSETINFORMATION - #ifdef MCGEN_EVENTSETINFORMATION // if MCGEN_EVENTSETINFORMATION has been customized, - #define MCGEN_HAVE_EVENTSETINFORMATION 1 // directly invoke MCGEN_EVENTSETINFORMATION(...). - #elif MCGEN_USE_KERNEL_MODE_APIS // else if using kernel-mode APIs, - #if NTDDI_VERSION >= 0x06040000 // if target OS is Windows 10 or later, - #define MCGEN_HAVE_EVENTSETINFORMATION 1 // directly invoke MCGEN_EVENTSETINFORMATION(...). - #else // else - #define MCGEN_HAVE_EVENTSETINFORMATION 2 // find "EtwSetInformation" via MmGetSystemRoutineAddress. - #endif // else (using user-mode APIs) - #else // if target OS and SDK is Windows 8 or later, - #if WINVER >= 0x0602 && defined(EVENT_FILTER_TYPE_SCHEMATIZED) - #define MCGEN_HAVE_EVENTSETINFORMATION 1 // directly invoke MCGEN_EVENTSETINFORMATION(...). - #else // else - #define MCGEN_HAVE_EVENTSETINFORMATION 2 // find "EventSetInformation" via GetModuleHandleExW/GetProcAddress. - #endif - #endif +#ifdef MCGEN_EVENTSETINFORMATION // if MCGEN_EVENTSETINFORMATION has been customized, +#define MCGEN_HAVE_EVENTSETINFORMATION 1 // directly invoke MCGEN_EVENTSETINFORMATION(...). +#elif MCGEN_USE_KERNEL_MODE_APIS // else if using kernel-mode APIs, +#if NTDDI_VERSION >= 0x06040000 // if target OS is Windows 10 or later, +#define MCGEN_HAVE_EVENTSETINFORMATION 1 // directly invoke MCGEN_EVENTSETINFORMATION(...). +#else // else +#define MCGEN_HAVE_EVENTSETINFORMATION 2 // find "EtwSetInformation" via MmGetSystemRoutineAddress. +#endif // else (using user-mode APIs) +#else // if target OS and SDK is Windows 8 or later, +#if WINVER >= 0x0602 && defined(EVENT_FILTER_TYPE_SCHEMATIZED) +#define MCGEN_HAVE_EVENTSETINFORMATION 1 // directly invoke MCGEN_EVENTSETINFORMATION(...). +#else // else +#define MCGEN_HAVE_EVENTSETINFORMATION 2 // find "EventSetInformation" via GetModuleHandleExW/GetProcAddress. +#endif +#endif #endif // MCGEN_HAVE_EVENTSETINFORMATION // @@ -126,11 +126,11 @@ extern "C" { // Override to use a custom API. // #ifndef MCGEN_EVENTWRITETRANSFER - #if MCGEN_USE_KERNEL_MODE_APIS - #define MCGEN_EVENTWRITETRANSFER EtwWriteTransfer - #else - #define MCGEN_EVENTWRITETRANSFER EventWriteTransfer - #endif +#if MCGEN_USE_KERNEL_MODE_APIS +#define MCGEN_EVENTWRITETRANSFER EtwWriteTransfer +#else +#define MCGEN_EVENTWRITETRANSFER EventWriteTransfer +#endif #endif // MCGEN_EVENTWRITETRANSFER // @@ -138,11 +138,11 @@ extern "C" { // Override to use a custom API. // #ifndef MCGEN_EVENTREGISTER - #if MCGEN_USE_KERNEL_MODE_APIS - #define MCGEN_EVENTREGISTER EtwRegister - #else - #define MCGEN_EVENTREGISTER EventRegister - #endif +#if MCGEN_USE_KERNEL_MODE_APIS +#define MCGEN_EVENTREGISTER EtwRegister +#else +#define MCGEN_EVENTREGISTER EventRegister +#endif #endif // MCGEN_EVENTREGISTER // @@ -151,11 +151,11 @@ extern "C" { // (McGenEventSetInformation also affected by MCGEN_HAVE_EVENTSETINFORMATION.) // #ifndef MCGEN_EVENTSETINFORMATION - #if MCGEN_USE_KERNEL_MODE_APIS - #define MCGEN_EVENTSETINFORMATION EtwSetInformation - #else - #define MCGEN_EVENTSETINFORMATION EventSetInformation - #endif +#if MCGEN_USE_KERNEL_MODE_APIS +#define MCGEN_EVENTSETINFORMATION EtwSetInformation +#else +#define MCGEN_EVENTSETINFORMATION EventSetInformation +#endif #endif // MCGEN_EVENTSETINFORMATION // @@ -163,11 +163,11 @@ extern "C" { // Override to use a custom API. // #ifndef MCGEN_EVENTUNREGISTER - #if MCGEN_USE_KERNEL_MODE_APIS - #define MCGEN_EVENTUNREGISTER EtwUnregister - #else - #define MCGEN_EVENTUNREGISTER EventUnregister - #endif +#if MCGEN_USE_KERNEL_MODE_APIS +#define MCGEN_EVENTUNREGISTER EtwUnregister +#else +#define MCGEN_EVENTUNREGISTER EventUnregister +#endif #endif // MCGEN_EVENTUNREGISTER // @@ -176,11 +176,11 @@ extern "C" { // (Should match the type used by MCGEN_EVENTREGISTER.) // #ifndef MCGEN_PENABLECALLBACK - #if MCGEN_USE_KERNEL_MODE_APIS - #define MCGEN_PENABLECALLBACK PETWENABLECALLBACK - #else - #define MCGEN_PENABLECALLBACK PENABLECALLBACK - #endif +#if MCGEN_USE_KERNEL_MODE_APIS +#define MCGEN_PENABLECALLBACK PETWENABLECALLBACK +#else +#define MCGEN_PENABLECALLBACK PENABLECALLBACK +#endif #endif // MCGEN_PENABLECALLBACK // @@ -188,11 +188,11 @@ extern "C" { // Override to use a custom API. // #ifndef MCGEN_GETLENGTHSID - #if MCGEN_USE_KERNEL_MODE_APIS - #define MCGEN_GETLENGTHSID(p) RtlLengthSid((PSID)(p)) - #else - #define MCGEN_GETLENGTHSID(p) GetLengthSid((PSID)(p)) - #endif +#if MCGEN_USE_KERNEL_MODE_APIS +#define MCGEN_GETLENGTHSID(p) RtlLengthSid((PSID)(p)) +#else +#define MCGEN_GETLENGTHSID(p) GetLengthSid((PSID)(p)) +#endif #endif // MCGEN_GETLENGTHSID // @@ -210,11 +210,12 @@ extern "C" { // Implements testing a bit in an array of ULONG, optimized for CPU type. // #ifndef MCGEN_EVENT_BIT_SET -# if defined(_M_IX86) || defined(_M_X64) -# define MCGEN_EVENT_BIT_SET(EnableBits, BitPosition) ((((const unsigned char*)EnableBits)[BitPosition >> 3] & (1u << (BitPosition & 7))) != 0) -# else -# define MCGEN_EVENT_BIT_SET(EnableBits, BitPosition) ((EnableBits[BitPosition >> 5] & (1u << (BitPosition & 31))) != 0) -# endif +#if defined(_M_IX86) || defined(_M_X64) +#define MCGEN_EVENT_BIT_SET(EnableBits, BitPosition) \ + ((((const unsigned char *)EnableBits)[BitPosition >> 3] & (1u << (BitPosition & 7))) != 0) +#else +#define MCGEN_EVENT_BIT_SET(EnableBits, BitPosition) ((EnableBits[BitPosition >> 5] & (1u << (BitPosition & 31))) != 0) +#endif #endif // MCGEN_EVENT_BIT_SET // @@ -229,20 +230,19 @@ extern "C" { #if !defined(MCGEN_TRACE_CONTEXT_DEF) #define MCGEN_TRACE_CONTEXT_DEF -typedef struct _MCGEN_TRACE_CONTEXT -{ - TRACEHANDLE RegistrationHandle; - TRACEHANDLE Logger; // Used as pointer to provider traits. - ULONGLONG MatchAnyKeyword; - ULONGLONG MatchAllKeyword; - ULONG Flags; - ULONG IsEnabled; - UCHAR Level; - UCHAR Reserve; - USHORT EnableBitsCount; - PULONG EnableBitMask; - const ULONGLONG* EnableKeyWords; - const UCHAR* EnableLevel; +typedef struct _MCGEN_TRACE_CONTEXT { + TRACEHANDLE RegistrationHandle; + TRACEHANDLE Logger; // Used as pointer to provider traits. + 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 // MCGEN_TRACE_CONTEXT_DEF @@ -256,34 +256,28 @@ typedef struct _MCGEN_TRACE_CONTEXT // FORCEINLINE BOOLEAN -McGenLevelKeywordEnabled( - _In_ PMCGEN_TRACE_CONTEXT EnableInfo, - _In_ UCHAR Level, - _In_ ULONGLONG Keyword - ) -{ +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 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. + // Check if Keyword is 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; - } + if ((Keyword == (ULONGLONG)0) || + ((Keyword & EnableInfo->MatchAnyKeyword) && + ((Keyword & EnableInfo->MatchAllKeyword) == EnableInfo->MatchAllKeyword))) { + return TRUE; } + } - return FALSE; + return FALSE; } #endif // MCGEN_LEVEL_KEYWORD_ENABLED_DEF @@ -296,30 +290,22 @@ McGenLevelKeywordEnabled( // FORCEINLINE BOOLEAN -McGenEventEnabled( - _In_ PMCGEN_TRACE_CONTEXT EnableInfo, - _In_ PCEVENT_DESCRIPTOR EventDescriptor - ) -{ - return McGenLevelKeywordEnabled(EnableInfo, EventDescriptor->Level, EventDescriptor->Keyword); +McGenEventEnabled(_In_ PMCGEN_TRACE_CONTEXT EnableInfo, _In_ PCEVENT_DESCRIPTOR EventDescriptor) { + return McGenLevelKeywordEnabled(EnableInfo, EventDescriptor->Level, EventDescriptor->Keyword); } #endif // MCGEN_EVENT_ENABLED_DEF #if !defined(MCGEN_CONTROL_CALLBACK) #define MCGEN_CONTROL_CALLBACK -DECLSPEC_NOINLINE __inline -VOID -__stdcall -McGenControlCallbackV2( +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 - ) + _Inout_opt_ PVOID CallbackContext) /*++ Routine Description: @@ -352,104 +338,86 @@ Routine Description: --*/ { - PMCGEN_TRACE_CONTEXT Ctx = (PMCGEN_TRACE_CONTEXT)CallbackContext; - ULONG Ix; + PMCGEN_TRACE_CONTEXT Ctx = (PMCGEN_TRACE_CONTEXT)CallbackContext; + ULONG Ix; #ifndef MCGEN_PRIVATE_ENABLE_CALLBACK_V2 - UNREFERENCED_PARAMETER(SourceId); - UNREFERENCED_PARAMETER(FilterData); + 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; - } + 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 - ); + // + // Call user defined callback + // + MCGEN_PRIVATE_ENABLE_CALLBACK_V2( + SourceId, ControlCode, Level, MatchAnyKeyword, MatchAllKeyword, FilterData, CallbackContext); #endif // MCGEN_PRIVATE_ENABLE_CALLBACK_V2 - return; + return; } #endif // MCGEN_CONTROL_CALLBACK #ifndef McGenEventWrite_def #define McGenEventWrite_def -DECLSPEC_NOINLINE __inline -ULONG __stdcall -McGenEventWrite( +DECLSPEC_NOINLINE __inline ULONG __stdcall McGenEventWrite( _In_ PMCGEN_TRACE_CONTEXT Context, _In_ PCEVENT_DESCRIPTOR Descriptor, _In_opt_ LPCGUID ActivityId, _In_range_(1, 128) ULONG EventDataCount, - _Inout_updates_(EventDataCount) EVENT_DATA_DESCRIPTOR* EventData - ) -{ - const USHORT UNALIGNED* Traits; + _Inout_updates_(EventDataCount) EVENT_DATA_DESCRIPTOR *EventData) { + const USHORT UNALIGNED *Traits; - // Some customized MCGEN_EVENTWRITETRANSFER macros might ignore ActivityId. - UNREFERENCED_PARAMETER(ActivityId); + // Some customized MCGEN_EVENTWRITETRANSFER macros might ignore ActivityId. + UNREFERENCED_PARAMETER(ActivityId); - Traits = (const USHORT UNALIGNED*)(UINT_PTR)Context->Logger; + Traits = (const USHORT UNALIGNED *)(UINT_PTR)Context->Logger; - if (Traits == NULL) { - EventData[0].Ptr = 0; - EventData[0].Size = 0; - EventData[0].Reserved = 0; - } else { - EventData[0].Ptr = (ULONG_PTR)Traits; - EventData[0].Size = *Traits; - EventData[0].Reserved = 2; // EVENT_DATA_DESCRIPTOR_TYPE_PROVIDER_METADATA - } + if (Traits == NULL) { + EventData[0].Ptr = 0; + EventData[0].Size = 0; + EventData[0].Reserved = 0; + } else { + EventData[0].Ptr = (ULONG_PTR)Traits; + EventData[0].Size = *Traits; + EventData[0].Reserved = 2; // EVENT_DATA_DESCRIPTOR_TYPE_PROVIDER_METADATA + } - return MCGEN_EVENTWRITETRANSFER( - Context->RegistrationHandle, - Descriptor, - ActivityId, - NULL, - EventDataCount, - EventData); + return MCGEN_EVENTWRITETRANSFER(Context->RegistrationHandle, Descriptor, ActivityId, NULL, EventDataCount, EventData); } #endif // McGenEventWrite_def @@ -457,15 +425,12 @@ McGenEventWrite( #define McGenEventRegisterUnregister #pragma warning(push) -#pragma warning(disable:6103) -DECLSPEC_NOINLINE __inline -ULONG __stdcall -McGenEventRegister( +#pragma warning(disable : 6103) +DECLSPEC_NOINLINE __inline ULONG __stdcall McGenEventRegister( _In_ LPCGUID ProviderId, _In_opt_ MCGEN_PENABLECALLBACK EnableCallback, _In_opt_ PVOID CallbackContext, - _Inout_ PREGHANDLE RegHandle - ) + _Inout_ PREGHANDLE RegHandle) /*++ Routine Description: @@ -491,24 +456,19 @@ Routine Description: --*/ { - ULONG Error; + ULONG Error; - if (*RegHandle != 0) - { - Error = 0; // ERROR_SUCCESS - } - else - { - Error = MCGEN_EVENTREGISTER(ProviderId, EnableCallback, CallbackContext, RegHandle); - } + if (*RegHandle != 0) { + Error = 0; // ERROR_SUCCESS + } else { + Error = MCGEN_EVENTREGISTER(ProviderId, EnableCallback, CallbackContext, RegHandle); + } - return Error; + return Error; } #pragma warning(pop) -DECLSPEC_NOINLINE __inline -ULONG __stdcall -McGenEventUnregister(_Inout_ PREGHANDLE RegHandle) +DECLSPEC_NOINLINE __inline ULONG __stdcall McGenEventUnregister(_Inout_ PREGHANDLE RegHandle) /*++ Routine Description: @@ -527,19 +487,16 @@ Routine Description: --*/ { - ULONG Error; + ULONG Error; - if(*RegHandle == 0) - { - Error = 0; // ERROR_SUCCESS - } - else - { - Error = MCGEN_EVENTUNREGISTER(*RegHandle); - *RegHandle = (REGHANDLE)0; - } + if (*RegHandle == 0) { + Error = 0; // ERROR_SUCCESS + } else { + Error = MCGEN_EVENTUNREGISTER(*RegHandle); + *RegHandle = (REGHANDLE)0; + } - return Error; + return Error; } #endif // McGenEventRegisterUnregister @@ -551,7 +508,10 @@ Routine Description: //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // Provider GUID = cec49226-329e-4ea2-a16a-c37c6c0b2cd7 -EXTERN_C __declspec(selectany) const GUID REACT_NATIVE_WINDOWS = {0xcec49226, 0x329e, 0x4ea2, {0xa1, 0x6a, 0xc3, 0x7c, 0x6c, 0x0b, 0x2c, 0xd7}}; +EXTERN_C __declspec(selectany) const GUID REACT_NATIVE_WINDOWS = {0xcec49226, + 0x329e, + 0x4ea2, + {0xa1, 0x6a, 0xc3, 0x7c, 0x6c, 0x0b, 0x2c, 0xd7}}; #ifndef REACT_NATIVE_WINDOWS_Traits #define REACT_NATIVE_WINDOWS_Traits NULL @@ -636,7 +596,19 @@ EXTERN_C __declspec(selectany) const unsigned char React_Native_Windows_Provider // // Provider context // -EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context = {0, (ULONG_PTR)REACT_NATIVE_WINDOWS_Traits, 0, 0, 0, 0, 0, 0, 1, React_Native_Windows_ProviderEnableBits, React_Native_Windows_ProviderKeywords, React_Native_Windows_ProviderLevels}; +EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context = { + 0, + (ULONG_PTR)REACT_NATIVE_WINDOWS_Traits, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + React_Native_Windows_ProviderEnableBits, + React_Native_Windows_ProviderKeywords, + React_Native_Windows_ProviderLevels}; // // Provider REGHANDLE @@ -659,7 +631,12 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // EventUnregister macros (they will be no-ops if EventRegister failed). // #ifndef EventRegisterReact_Native_Windows_Provider -#define EventRegisterReact_Native_Windows_Provider() McGenEventRegister(&REACT_NATIVE_WINDOWS, McGenControlCallbackV2, &REACT_NATIVE_WINDOWS_Context, &React_Native_Windows_ProviderHandle) +#define EventRegisterReact_Native_Windows_Provider() \ + McGenEventRegister( \ + &REACT_NATIVE_WINDOWS, \ + McGenControlCallbackV2, \ + &REACT_NATIVE_WINDOWS_Context, \ + &React_Native_Windows_ProviderHandle) #endif // @@ -667,7 +644,9 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // is specified in the manifest). Advanced scenarios only. // #ifndef EventRegisterByGuidReact_Native_Windows_Provider -#define EventRegisterByGuidReact_Native_Windows_Provider(Guid) McGenEventRegister(&(Guid), McGenControlCallbackV2, &REACT_NATIVE_WINDOWS_Context, &React_Native_Windows_ProviderHandle) +#define EventRegisterByGuidReact_Native_Windows_Provider(Guid) \ + McGenEventRegister( \ + &(Guid), McGenControlCallbackV2, &REACT_NATIVE_WINDOWS_Context, &React_Native_Windows_ProviderHandle) #endif // @@ -691,10 +670,37 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // Event write macros for JS_BEGIN_SECTION // #define EventWriteJS_BEGIN_SECTION(id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ - MCGEN_EVENT_ENABLED(JS_BEGIN_SECTION) \ - ? McTemplateU0xxsssssssss(&REACT_NATIVE_WINDOWS_Context, &JS_BEGIN_SECTION, id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) : 0 + MCGEN_EVENT_ENABLED(JS_BEGIN_SECTION) \ + ? McTemplateU0xxsssssssss( \ + &REACT_NATIVE_WINDOWS_Context, \ + &JS_BEGIN_SECTION, \ + id, \ + tag, \ + profileName, \ + arg0, \ + arg1, \ + arg2, \ + arg3, \ + arg4, \ + arg5, \ + arg6, \ + arg7) \ + : 0 #define EventWriteJS_BEGIN_SECTION_AssumeEnabled(id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ - McTemplateU0xxsssssssss(&REACT_NATIVE_WINDOWS_Context, &JS_BEGIN_SECTION, id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) + McTemplateU0xxsssssssss( \ + &REACT_NATIVE_WINDOWS_Context, \ + &JS_BEGIN_SECTION, \ + id, \ + tag, \ + profileName, \ + arg0, \ + arg1, \ + arg2, \ + arg3, \ + arg4, \ + arg5, \ + arg6, \ + arg7) // // Enablement check macro for JS_END_SECTION @@ -705,10 +711,10 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // Event write macros for JS_END_SECTION // #define EventWriteJS_END_SECTION(id, tag, profileName, duration) \ - MCGEN_EVENT_ENABLED(JS_END_SECTION) \ - ? McTemplateU0xxsg(&REACT_NATIVE_WINDOWS_Context, &JS_END_SECTION, id, tag, profileName, duration) : 0 + MCGEN_EVENT_ENABLED(JS_END_SECTION) \ + ? McTemplateU0xxsg(&REACT_NATIVE_WINDOWS_Context, &JS_END_SECTION, id, tag, profileName, duration) : 0 #define EventWriteJS_END_SECTION_AssumeEnabled(id, tag, profileName, duration) \ - McTemplateU0xxsg(&REACT_NATIVE_WINDOWS_Context, &JS_END_SECTION, id, tag, profileName, duration) + McTemplateU0xxsg(&REACT_NATIVE_WINDOWS_Context, &JS_END_SECTION, id, tag, profileName, duration) // // Enablement check macro for JS_ASYNC_BEGIN_SECTION @@ -719,10 +725,10 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // Event write macros for JS_ASYNC_BEGIN_SECTION // #define EventWriteJS_ASYNC_BEGIN_SECTION(tag, profileName, cookie, duration) \ - MCGEN_EVENT_ENABLED(JS_ASYNC_BEGIN_SECTION) \ - ? McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &JS_ASYNC_BEGIN_SECTION, tag, profileName, cookie, duration) : 0 + MCGEN_EVENT_ENABLED(JS_ASYNC_BEGIN_SECTION) \ + ? McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &JS_ASYNC_BEGIN_SECTION, tag, profileName, cookie, duration) : 0 #define EventWriteJS_ASYNC_BEGIN_SECTION_AssumeEnabled(tag, profileName, cookie, duration) \ - McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &JS_ASYNC_BEGIN_SECTION, tag, profileName, cookie, duration) + McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &JS_ASYNC_BEGIN_SECTION, tag, profileName, cookie, duration) // // Enablement check macro for JS_ASYNC_END_SECTION @@ -733,10 +739,10 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // Event write macros for JS_ASYNC_END_SECTION // #define EventWriteJS_ASYNC_END_SECTION(tag, profileName, cookie, duration) \ - MCGEN_EVENT_ENABLED(JS_ASYNC_END_SECTION) \ - ? McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &JS_ASYNC_END_SECTION, tag, profileName, cookie, duration) : 0 + MCGEN_EVENT_ENABLED(JS_ASYNC_END_SECTION) \ + ? McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &JS_ASYNC_END_SECTION, tag, profileName, cookie, duration) : 0 #define EventWriteJS_ASYNC_END_SECTION_AssumeEnabled(tag, profileName, cookie, duration) \ - McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &JS_ASYNC_END_SECTION, tag, profileName, cookie, duration) + McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &JS_ASYNC_END_SECTION, tag, profileName, cookie, duration) // // Enablement check macro for JS_ASYNC_BEGIN_FLOW @@ -747,10 +753,10 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // Event write macros for JS_ASYNC_BEGIN_FLOW // #define EventWriteJS_ASYNC_BEGIN_FLOW(tag, profileName, cookie, duration) \ - MCGEN_EVENT_ENABLED(JS_ASYNC_BEGIN_FLOW) \ - ? McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &JS_ASYNC_BEGIN_FLOW, tag, profileName, cookie, duration) : 0 + MCGEN_EVENT_ENABLED(JS_ASYNC_BEGIN_FLOW) \ + ? McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &JS_ASYNC_BEGIN_FLOW, tag, profileName, cookie, duration) : 0 #define EventWriteJS_ASYNC_BEGIN_FLOW_AssumeEnabled(tag, profileName, cookie, duration) \ - McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &JS_ASYNC_BEGIN_FLOW, tag, profileName, cookie, duration) + McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &JS_ASYNC_BEGIN_FLOW, tag, profileName, cookie, duration) // // Enablement check macro for JS_ASYNC_END_FLOW @@ -761,10 +767,10 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // Event write macros for JS_ASYNC_END_FLOW // #define EventWriteJS_ASYNC_END_FLOW(tag, profileName, cookie, duration) \ - MCGEN_EVENT_ENABLED(JS_ASYNC_END_FLOW) \ - ? McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &JS_ASYNC_END_FLOW, tag, profileName, cookie, duration) : 0 + MCGEN_EVENT_ENABLED(JS_ASYNC_END_FLOW) \ + ? McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &JS_ASYNC_END_FLOW, tag, profileName, cookie, duration) : 0 #define EventWriteJS_ASYNC_END_FLOW_AssumeEnabled(tag, profileName, cookie, duration) \ - McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &JS_ASYNC_END_FLOW, tag, profileName, cookie, duration) + McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &JS_ASYNC_END_FLOW, tag, profileName, cookie, duration) // // Enablement check macro for JS_COUNTER @@ -775,10 +781,10 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // Event write macros for JS_COUNTER // #define EventWriteJS_COUNTER(tag, profileName, value) \ - MCGEN_EVENT_ENABLED(JS_COUNTER) \ - ? McTemplateU0xsd(&REACT_NATIVE_WINDOWS_Context, &JS_COUNTER, tag, profileName, value) : 0 + MCGEN_EVENT_ENABLED(JS_COUNTER) \ + ? McTemplateU0xsd(&REACT_NATIVE_WINDOWS_Context, &JS_COUNTER, tag, profileName, value) : 0 #define EventWriteJS_COUNTER_AssumeEnabled(tag, profileName, value) \ - McTemplateU0xsd(&REACT_NATIVE_WINDOWS_Context, &JS_COUNTER, tag, profileName, value) + McTemplateU0xsd(&REACT_NATIVE_WINDOWS_Context, &JS_COUNTER, tag, profileName, value) // // Enablement check macro for EVALUATE_SCRIPT_BEGIN @@ -789,10 +795,38 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // Event write macros for EVALUATE_SCRIPT_BEGIN // #define EventWriteEVALUATE_SCRIPT_BEGIN(id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ - MCGEN_EVENT_ENABLED(EVALUATE_SCRIPT_BEGIN) \ - ? McTemplateU0xxsssssssss(&REACT_NATIVE_WINDOWS_Context, &EVALUATE_SCRIPT_BEGIN, id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) : 0 -#define EventWriteEVALUATE_SCRIPT_BEGIN_AssumeEnabled(id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ - McTemplateU0xxsssssssss(&REACT_NATIVE_WINDOWS_Context, &EVALUATE_SCRIPT_BEGIN, id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) + MCGEN_EVENT_ENABLED(EVALUATE_SCRIPT_BEGIN) \ + ? McTemplateU0xxsssssssss( \ + &REACT_NATIVE_WINDOWS_Context, \ + &EVALUATE_SCRIPT_BEGIN, \ + id, \ + tag, \ + profileName, \ + arg0, \ + arg1, \ + arg2, \ + arg3, \ + arg4, \ + arg5, \ + arg6, \ + arg7) \ + : 0 +#define EventWriteEVALUATE_SCRIPT_BEGIN_AssumeEnabled( \ + id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ + McTemplateU0xxsssssssss( \ + &REACT_NATIVE_WINDOWS_Context, \ + &EVALUATE_SCRIPT_BEGIN, \ + id, \ + tag, \ + profileName, \ + arg0, \ + arg1, \ + arg2, \ + arg3, \ + arg4, \ + arg5, \ + arg6, \ + arg7) // // Enablement check macro for EVALUATE_SCRIPT_END @@ -803,10 +837,10 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // Event write macros for EVALUATE_SCRIPT_END // #define EventWriteEVALUATE_SCRIPT_END(id, tag, profileName, duration) \ - MCGEN_EVENT_ENABLED(EVALUATE_SCRIPT_END) \ - ? McTemplateU0xxsg(&REACT_NATIVE_WINDOWS_Context, &EVALUATE_SCRIPT_END, id, tag, profileName, duration) : 0 + MCGEN_EVENT_ENABLED(EVALUATE_SCRIPT_END) \ + ? McTemplateU0xxsg(&REACT_NATIVE_WINDOWS_Context, &EVALUATE_SCRIPT_END, id, tag, profileName, duration) : 0 #define EventWriteEVALUATE_SCRIPT_END_AssumeEnabled(id, tag, profileName, duration) \ - McTemplateU0xxsg(&REACT_NATIVE_WINDOWS_Context, &EVALUATE_SCRIPT_END, id, tag, profileName, duration) + McTemplateU0xxsg(&REACT_NATIVE_WINDOWS_Context, &EVALUATE_SCRIPT_END, id, tag, profileName, duration) // // Enablement check macro for CALL_JSFUNCTION_BEGIN @@ -817,10 +851,38 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // Event write macros for CALL_JSFUNCTION_BEGIN // #define EventWriteCALL_JSFUNCTION_BEGIN(id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ - MCGEN_EVENT_ENABLED(CALL_JSFUNCTION_BEGIN) \ - ? McTemplateU0xxsssssssss(&REACT_NATIVE_WINDOWS_Context, &CALL_JSFUNCTION_BEGIN, id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) : 0 -#define EventWriteCALL_JSFUNCTION_BEGIN_AssumeEnabled(id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ - McTemplateU0xxsssssssss(&REACT_NATIVE_WINDOWS_Context, &CALL_JSFUNCTION_BEGIN, id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) + MCGEN_EVENT_ENABLED(CALL_JSFUNCTION_BEGIN) \ + ? McTemplateU0xxsssssssss( \ + &REACT_NATIVE_WINDOWS_Context, \ + &CALL_JSFUNCTION_BEGIN, \ + id, \ + tag, \ + profileName, \ + arg0, \ + arg1, \ + arg2, \ + arg3, \ + arg4, \ + arg5, \ + arg6, \ + arg7) \ + : 0 +#define EventWriteCALL_JSFUNCTION_BEGIN_AssumeEnabled( \ + id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ + McTemplateU0xxsssssssss( \ + &REACT_NATIVE_WINDOWS_Context, \ + &CALL_JSFUNCTION_BEGIN, \ + id, \ + tag, \ + profileName, \ + arg0, \ + arg1, \ + arg2, \ + arg3, \ + arg4, \ + arg5, \ + arg6, \ + arg7) // // Enablement check macro for CALL_JSFUNCTION_END @@ -831,10 +893,10 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // Event write macros for CALL_JSFUNCTION_END // #define EventWriteCALL_JSFUNCTION_END(id, tag, profileName, duration) \ - MCGEN_EVENT_ENABLED(CALL_JSFUNCTION_END) \ - ? McTemplateU0xxsg(&REACT_NATIVE_WINDOWS_Context, &CALL_JSFUNCTION_END, id, tag, profileName, duration) : 0 + MCGEN_EVENT_ENABLED(CALL_JSFUNCTION_END) \ + ? McTemplateU0xxsg(&REACT_NATIVE_WINDOWS_Context, &CALL_JSFUNCTION_END, id, tag, profileName, duration) : 0 #define EventWriteCALL_JSFUNCTION_END_AssumeEnabled(id, tag, profileName, duration) \ - McTemplateU0xxsg(&REACT_NATIVE_WINDOWS_Context, &CALL_JSFUNCTION_END, id, tag, profileName, duration) + McTemplateU0xxsg(&REACT_NATIVE_WINDOWS_Context, &CALL_JSFUNCTION_END, id, tag, profileName, duration) // // Enablement check macro for CALL_NATIVEMODULES_BEGIN @@ -845,10 +907,38 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // Event write macros for CALL_NATIVEMODULES_BEGIN // #define EventWriteCALL_NATIVEMODULES_BEGIN(id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ - MCGEN_EVENT_ENABLED(CALL_NATIVEMODULES_BEGIN) \ - ? McTemplateU0xxsssssssss(&REACT_NATIVE_WINDOWS_Context, &CALL_NATIVEMODULES_BEGIN, id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) : 0 -#define EventWriteCALL_NATIVEMODULES_BEGIN_AssumeEnabled(id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ - McTemplateU0xxsssssssss(&REACT_NATIVE_WINDOWS_Context, &CALL_NATIVEMODULES_BEGIN, id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) + MCGEN_EVENT_ENABLED(CALL_NATIVEMODULES_BEGIN) \ + ? McTemplateU0xxsssssssss( \ + &REACT_NATIVE_WINDOWS_Context, \ + &CALL_NATIVEMODULES_BEGIN, \ + id, \ + tag, \ + profileName, \ + arg0, \ + arg1, \ + arg2, \ + arg3, \ + arg4, \ + arg5, \ + arg6, \ + arg7) \ + : 0 +#define EventWriteCALL_NATIVEMODULES_BEGIN_AssumeEnabled( \ + id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ + McTemplateU0xxsssssssss( \ + &REACT_NATIVE_WINDOWS_Context, \ + &CALL_NATIVEMODULES_BEGIN, \ + id, \ + tag, \ + profileName, \ + arg0, \ + arg1, \ + arg2, \ + arg3, \ + arg4, \ + arg5, \ + arg6, \ + arg7) // // Enablement check macro for CALL_NATIVEMODULES_END @@ -859,10 +949,10 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // Event write macros for CALL_NATIVEMODULES_END // #define EventWriteCALL_NATIVEMODULES_END(id, tag, profileName, duration) \ - MCGEN_EVENT_ENABLED(CALL_NATIVEMODULES_END) \ - ? McTemplateU0xxsg(&REACT_NATIVE_WINDOWS_Context, &CALL_NATIVEMODULES_END, id, tag, profileName, duration) : 0 + MCGEN_EVENT_ENABLED(CALL_NATIVEMODULES_END) \ + ? McTemplateU0xxsg(&REACT_NATIVE_WINDOWS_Context, &CALL_NATIVEMODULES_END, id, tag, profileName, duration) : 0 #define EventWriteCALL_NATIVEMODULES_END_AssumeEnabled(id, tag, profileName, duration) \ - McTemplateU0xxsg(&REACT_NATIVE_WINDOWS_Context, &CALL_NATIVEMODULES_END, id, tag, profileName, duration) + McTemplateU0xxsg(&REACT_NATIVE_WINDOWS_Context, &CALL_NATIVEMODULES_END, id, tag, profileName, duration) // // Enablement check macro for NATIVE_BEGIN_SECTION @@ -873,10 +963,38 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // Event write macros for NATIVE_BEGIN_SECTION // #define EventWriteNATIVE_BEGIN_SECTION(id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ - MCGEN_EVENT_ENABLED(NATIVE_BEGIN_SECTION) \ - ? McTemplateU0xxsssssssss(&REACT_NATIVE_WINDOWS_Context, &NATIVE_BEGIN_SECTION, id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) : 0 -#define EventWriteNATIVE_BEGIN_SECTION_AssumeEnabled(id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ - McTemplateU0xxsssssssss(&REACT_NATIVE_WINDOWS_Context, &NATIVE_BEGIN_SECTION, id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) + MCGEN_EVENT_ENABLED(NATIVE_BEGIN_SECTION) \ + ? McTemplateU0xxsssssssss( \ + &REACT_NATIVE_WINDOWS_Context, \ + &NATIVE_BEGIN_SECTION, \ + id, \ + tag, \ + profileName, \ + arg0, \ + arg1, \ + arg2, \ + arg3, \ + arg4, \ + arg5, \ + arg6, \ + arg7) \ + : 0 +#define EventWriteNATIVE_BEGIN_SECTION_AssumeEnabled( \ + id, tag, profileName, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ + McTemplateU0xxsssssssss( \ + &REACT_NATIVE_WINDOWS_Context, \ + &NATIVE_BEGIN_SECTION, \ + id, \ + tag, \ + profileName, \ + arg0, \ + arg1, \ + arg2, \ + arg3, \ + arg4, \ + arg5, \ + arg6, \ + arg7) // // Enablement check macro for NATIVE_END_SECTION @@ -887,10 +1005,10 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // Event write macros for NATIVE_END_SECTION // #define EventWriteNATIVE_END_SECTION(id, tag, profileName, duration) \ - MCGEN_EVENT_ENABLED(NATIVE_END_SECTION) \ - ? McTemplateU0xxsg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_END_SECTION, id, tag, profileName, duration) : 0 + MCGEN_EVENT_ENABLED(NATIVE_END_SECTION) \ + ? McTemplateU0xxsg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_END_SECTION, id, tag, profileName, duration) : 0 #define EventWriteNATIVE_END_SECTION_AssumeEnabled(id, tag, profileName, duration) \ - McTemplateU0xxsg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_END_SECTION, id, tag, profileName, duration) + McTemplateU0xxsg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_END_SECTION, id, tag, profileName, duration) // // Enablement check macro for NATIVE_ASYNC_BEGIN_SECTION @@ -901,10 +1019,10 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // Event write macros for NATIVE_ASYNC_BEGIN_SECTION // #define EventWriteNATIVE_ASYNC_BEGIN_SECTION(tag, profileName, cookie, duration) \ - MCGEN_EVENT_ENABLED(NATIVE_ASYNC_BEGIN_SECTION) \ - ? McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_ASYNC_BEGIN_SECTION, tag, profileName, cookie, duration) : 0 + MCGEN_EVENT_ENABLED(NATIVE_ASYNC_BEGIN_SECTION) \ + ? McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_ASYNC_BEGIN_SECTION, tag, profileName, cookie, duration) : 0 #define EventWriteNATIVE_ASYNC_BEGIN_SECTION_AssumeEnabled(tag, profileName, cookie, duration) \ - McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_ASYNC_BEGIN_SECTION, tag, profileName, cookie, duration) + McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_ASYNC_BEGIN_SECTION, tag, profileName, cookie, duration) // // Enablement check macro for NATIVE_ASYNC_END_SECTION @@ -915,10 +1033,10 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // Event write macros for NATIVE_ASYNC_END_SECTION // #define EventWriteNATIVE_ASYNC_END_SECTION(tag, profileName, cookie, duration) \ - MCGEN_EVENT_ENABLED(NATIVE_ASYNC_END_SECTION) \ - ? McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_ASYNC_END_SECTION, tag, profileName, cookie, duration) : 0 + MCGEN_EVENT_ENABLED(NATIVE_ASYNC_END_SECTION) \ + ? McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_ASYNC_END_SECTION, tag, profileName, cookie, duration) : 0 #define EventWriteNATIVE_ASYNC_END_SECTION_AssumeEnabled(tag, profileName, cookie, duration) \ - McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_ASYNC_END_SECTION, tag, profileName, cookie, duration) + McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_ASYNC_END_SECTION, tag, profileName, cookie, duration) // // Enablement check macro for NATIVE_ASYNC_BEGIN_FLOW @@ -929,10 +1047,10 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // Event write macros for NATIVE_ASYNC_BEGIN_FLOW // #define EventWriteNATIVE_ASYNC_BEGIN_FLOW(tag, profileName, cookie, duration) \ - MCGEN_EVENT_ENABLED(NATIVE_ASYNC_BEGIN_FLOW) \ - ? McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_ASYNC_BEGIN_FLOW, tag, profileName, cookie, duration) : 0 + MCGEN_EVENT_ENABLED(NATIVE_ASYNC_BEGIN_FLOW) \ + ? McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_ASYNC_BEGIN_FLOW, tag, profileName, cookie, duration) : 0 #define EventWriteNATIVE_ASYNC_BEGIN_FLOW_AssumeEnabled(tag, profileName, cookie, duration) \ - McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_ASYNC_BEGIN_FLOW, tag, profileName, cookie, duration) + McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_ASYNC_BEGIN_FLOW, tag, profileName, cookie, duration) // // Enablement check macro for NATIVE_ASYNC_END_FLOW @@ -943,10 +1061,10 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // Event write macros for NATIVE_ASYNC_END_FLOW // #define EventWriteNATIVE_ASYNC_END_FLOW(tag, profileName, cookie, duration) \ - MCGEN_EVENT_ENABLED(NATIVE_ASYNC_END_FLOW) \ - ? McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_ASYNC_END_FLOW, tag, profileName, cookie, duration) : 0 + MCGEN_EVENT_ENABLED(NATIVE_ASYNC_END_FLOW) \ + ? McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_ASYNC_END_FLOW, tag, profileName, cookie, duration) : 0 #define EventWriteNATIVE_ASYNC_END_FLOW_AssumeEnabled(tag, profileName, cookie, duration) \ - McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_ASYNC_END_FLOW, tag, profileName, cookie, duration) + McTemplateU0xsdg(&REACT_NATIVE_WINDOWS_Context, &NATIVE_ASYNC_END_FLOW, tag, profileName, cookie, duration) // // Enablement check macro for NATIVE_COUNTER @@ -957,10 +1075,10 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // Event write macros for NATIVE_COUNTER // #define EventWriteNATIVE_COUNTER(tag, profileName, value) \ - MCGEN_EVENT_ENABLED(NATIVE_COUNTER) \ - ? McTemplateU0xsd(&REACT_NATIVE_WINDOWS_Context, &NATIVE_COUNTER, tag, profileName, value) : 0 + MCGEN_EVENT_ENABLED(NATIVE_COUNTER) \ + ? McTemplateU0xsd(&REACT_NATIVE_WINDOWS_Context, &NATIVE_COUNTER, tag, profileName, value) : 0 #define EventWriteNATIVE_COUNTER_AssumeEnabled(tag, profileName, value) \ - McTemplateU0xsd(&REACT_NATIVE_WINDOWS_Context, &NATIVE_COUNTER, tag, profileName, value) + McTemplateU0xsd(&REACT_NATIVE_WINDOWS_Context, &NATIVE_COUNTER, tag, profileName, value) #endif // MCGEN_DISABLE_PROVIDER_CODE_GENERATION @@ -975,7 +1093,7 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT REACT_NATIVE_WINDOWS_Context // Template Functions // // -//Template from manifest : tidCounter +// Template from manifest : tidCounter // #ifndef McTemplateU0xsd_def #define McTemplateU0xsd_def @@ -984,29 +1102,28 @@ ULONG McTemplateU0xsd( _In_ PMCGEN_TRACE_CONTEXT Context, _In_ PCEVENT_DESCRIPTOR Descriptor, - _In_ const unsigned __int64 _Arg0, - _In_opt_ PCSTR _Arg1, - _In_ const signed int _Arg2 - ) -{ + _In_ const unsigned __int64 _Arg0, + _In_opt_ PCSTR _Arg1, + _In_ const signed int _Arg2) { #define McTemplateU0xsd_ARGCOUNT 3 - EVENT_DATA_DESCRIPTOR EventData[McTemplateU0xsd_ARGCOUNT + 1]; + EVENT_DATA_DESCRIPTOR EventData[McTemplateU0xsd_ARGCOUNT + 1]; - EventDataDescCreate(&EventData[1],&_Arg0, sizeof(const unsigned __int64) ); + EventDataDescCreate(&EventData[1], &_Arg0, sizeof(const unsigned __int64)); - EventDataDescCreate(&EventData[2], - (_Arg1 != NULL) ? _Arg1 : "NULL", - (_Arg1 != NULL) ? (ULONG)((strlen(_Arg1) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); + EventDataDescCreate( + &EventData[2], + (_Arg1 != NULL) ? _Arg1 : "NULL", + (_Arg1 != NULL) ? (ULONG)((strlen(_Arg1) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); - EventDataDescCreate(&EventData[3],&_Arg2, sizeof(const signed int) ); + EventDataDescCreate(&EventData[3], &_Arg2, sizeof(const signed int)); - return McGenEventWrite(Context, Descriptor, NULL, McTemplateU0xsd_ARGCOUNT + 1, EventData); + return McGenEventWrite(Context, Descriptor, NULL, McTemplateU0xsd_ARGCOUNT + 1, EventData); } #endif // McTemplateU0xsd_def // -//Template from manifest : tidAsyncSection +// Template from manifest : tidAsyncSection // #ifndef McTemplateU0xsdg_def #define McTemplateU0xsdg_def @@ -1015,32 +1132,31 @@ ULONG McTemplateU0xsdg( _In_ PMCGEN_TRACE_CONTEXT Context, _In_ PCEVENT_DESCRIPTOR Descriptor, - _In_ const unsigned __int64 _Arg0, - _In_opt_ PCSTR _Arg1, - _In_ const signed int _Arg2, - _In_ const double _Arg3 - ) -{ + _In_ const unsigned __int64 _Arg0, + _In_opt_ PCSTR _Arg1, + _In_ const signed int _Arg2, + _In_ const double _Arg3) { #define McTemplateU0xsdg_ARGCOUNT 4 - EVENT_DATA_DESCRIPTOR EventData[McTemplateU0xsdg_ARGCOUNT + 1]; + EVENT_DATA_DESCRIPTOR EventData[McTemplateU0xsdg_ARGCOUNT + 1]; - EventDataDescCreate(&EventData[1],&_Arg0, sizeof(const unsigned __int64) ); + EventDataDescCreate(&EventData[1], &_Arg0, sizeof(const unsigned __int64)); - EventDataDescCreate(&EventData[2], - (_Arg1 != NULL) ? _Arg1 : "NULL", - (_Arg1 != NULL) ? (ULONG)((strlen(_Arg1) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); + EventDataDescCreate( + &EventData[2], + (_Arg1 != NULL) ? _Arg1 : "NULL", + (_Arg1 != NULL) ? (ULONG)((strlen(_Arg1) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); - EventDataDescCreate(&EventData[3],&_Arg2, sizeof(const signed int) ); + EventDataDescCreate(&EventData[3], &_Arg2, sizeof(const signed int)); - EventDataDescCreate(&EventData[4],&_Arg3, sizeof(const double) ); + EventDataDescCreate(&EventData[4], &_Arg3, sizeof(const double)); - return McGenEventWrite(Context, Descriptor, NULL, McTemplateU0xsdg_ARGCOUNT + 1, EventData); + return McGenEventWrite(Context, Descriptor, NULL, McTemplateU0xsdg_ARGCOUNT + 1, EventData); } #endif // McTemplateU0xsdg_def // -//Template from manifest : tidEndSection +// Template from manifest : tidEndSection // #ifndef McTemplateU0xxsg_def #define McTemplateU0xxsg_def @@ -1049,32 +1165,31 @@ ULONG McTemplateU0xxsg( _In_ PMCGEN_TRACE_CONTEXT Context, _In_ PCEVENT_DESCRIPTOR Descriptor, - _In_ const unsigned __int64 _Arg0, - _In_ const unsigned __int64 _Arg1, - _In_opt_ PCSTR _Arg2, - _In_ const double _Arg3 - ) -{ + _In_ const unsigned __int64 _Arg0, + _In_ const unsigned __int64 _Arg1, + _In_opt_ PCSTR _Arg2, + _In_ const double _Arg3) { #define McTemplateU0xxsg_ARGCOUNT 4 - EVENT_DATA_DESCRIPTOR EventData[McTemplateU0xxsg_ARGCOUNT + 1]; + EVENT_DATA_DESCRIPTOR EventData[McTemplateU0xxsg_ARGCOUNT + 1]; - EventDataDescCreate(&EventData[1],&_Arg0, sizeof(const unsigned __int64) ); + EventDataDescCreate(&EventData[1], &_Arg0, sizeof(const unsigned __int64)); - EventDataDescCreate(&EventData[2],&_Arg1, sizeof(const unsigned __int64) ); + EventDataDescCreate(&EventData[2], &_Arg1, sizeof(const unsigned __int64)); - EventDataDescCreate(&EventData[3], - (_Arg2 != NULL) ? _Arg2 : "NULL", - (_Arg2 != NULL) ? (ULONG)((strlen(_Arg2) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); + EventDataDescCreate( + &EventData[3], + (_Arg2 != NULL) ? _Arg2 : "NULL", + (_Arg2 != NULL) ? (ULONG)((strlen(_Arg2) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); - EventDataDescCreate(&EventData[4],&_Arg3, sizeof(const double) ); + EventDataDescCreate(&EventData[4], &_Arg3, sizeof(const double)); - return McGenEventWrite(Context, Descriptor, NULL, McTemplateU0xxsg_ARGCOUNT + 1, EventData); + return McGenEventWrite(Context, Descriptor, NULL, McTemplateU0xxsg_ARGCOUNT + 1, EventData); } #endif // McTemplateU0xxsg_def // -//Template from manifest : tidBeginSection +// Template from manifest : tidBeginSection // #ifndef McTemplateU0xxsssssssss_def #define McTemplateU0xxsssssssss_def @@ -1083,64 +1198,71 @@ ULONG McTemplateU0xxsssssssss( _In_ PMCGEN_TRACE_CONTEXT Context, _In_ PCEVENT_DESCRIPTOR Descriptor, - _In_ const unsigned __int64 _Arg0, - _In_ const unsigned __int64 _Arg1, - _In_opt_ PCSTR _Arg2, - _In_opt_ PCSTR _Arg3, - _In_opt_ PCSTR _Arg4, - _In_opt_ PCSTR _Arg5, - _In_opt_ PCSTR _Arg6, - _In_opt_ PCSTR _Arg7, - _In_opt_ PCSTR _Arg8, - _In_opt_ PCSTR _Arg9, - _In_opt_ PCSTR _Arg10 - ) -{ + _In_ const unsigned __int64 _Arg0, + _In_ const unsigned __int64 _Arg1, + _In_opt_ PCSTR _Arg2, + _In_opt_ PCSTR _Arg3, + _In_opt_ PCSTR _Arg4, + _In_opt_ PCSTR _Arg5, + _In_opt_ PCSTR _Arg6, + _In_opt_ PCSTR _Arg7, + _In_opt_ PCSTR _Arg8, + _In_opt_ PCSTR _Arg9, + _In_opt_ PCSTR _Arg10) { #define McTemplateU0xxsssssssss_ARGCOUNT 11 - EVENT_DATA_DESCRIPTOR EventData[McTemplateU0xxsssssssss_ARGCOUNT + 1]; + EVENT_DATA_DESCRIPTOR EventData[McTemplateU0xxsssssssss_ARGCOUNT + 1]; - EventDataDescCreate(&EventData[1],&_Arg0, sizeof(const unsigned __int64) ); + EventDataDescCreate(&EventData[1], &_Arg0, sizeof(const unsigned __int64)); - EventDataDescCreate(&EventData[2],&_Arg1, sizeof(const unsigned __int64) ); + EventDataDescCreate(&EventData[2], &_Arg1, sizeof(const unsigned __int64)); - EventDataDescCreate(&EventData[3], - (_Arg2 != NULL) ? _Arg2 : "NULL", - (_Arg2 != NULL) ? (ULONG)((strlen(_Arg2) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); + EventDataDescCreate( + &EventData[3], + (_Arg2 != NULL) ? _Arg2 : "NULL", + (_Arg2 != NULL) ? (ULONG)((strlen(_Arg2) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); - EventDataDescCreate(&EventData[4], - (_Arg3 != NULL) ? _Arg3 : "NULL", - (_Arg3 != NULL) ? (ULONG)((strlen(_Arg3) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); + EventDataDescCreate( + &EventData[4], + (_Arg3 != NULL) ? _Arg3 : "NULL", + (_Arg3 != NULL) ? (ULONG)((strlen(_Arg3) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); - EventDataDescCreate(&EventData[5], - (_Arg4 != NULL) ? _Arg4 : "NULL", - (_Arg4 != NULL) ? (ULONG)((strlen(_Arg4) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); + EventDataDescCreate( + &EventData[5], + (_Arg4 != NULL) ? _Arg4 : "NULL", + (_Arg4 != NULL) ? (ULONG)((strlen(_Arg4) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); - EventDataDescCreate(&EventData[6], - (_Arg5 != NULL) ? _Arg5 : "NULL", - (_Arg5 != NULL) ? (ULONG)((strlen(_Arg5) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); + EventDataDescCreate( + &EventData[6], + (_Arg5 != NULL) ? _Arg5 : "NULL", + (_Arg5 != NULL) ? (ULONG)((strlen(_Arg5) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); - EventDataDescCreate(&EventData[7], - (_Arg6 != NULL) ? _Arg6 : "NULL", - (_Arg6 != NULL) ? (ULONG)((strlen(_Arg6) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); + EventDataDescCreate( + &EventData[7], + (_Arg6 != NULL) ? _Arg6 : "NULL", + (_Arg6 != NULL) ? (ULONG)((strlen(_Arg6) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); - EventDataDescCreate(&EventData[8], - (_Arg7 != NULL) ? _Arg7 : "NULL", - (_Arg7 != NULL) ? (ULONG)((strlen(_Arg7) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); + EventDataDescCreate( + &EventData[8], + (_Arg7 != NULL) ? _Arg7 : "NULL", + (_Arg7 != NULL) ? (ULONG)((strlen(_Arg7) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); - EventDataDescCreate(&EventData[9], - (_Arg8 != NULL) ? _Arg8 : "NULL", - (_Arg8 != NULL) ? (ULONG)((strlen(_Arg8) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); + EventDataDescCreate( + &EventData[9], + (_Arg8 != NULL) ? _Arg8 : "NULL", + (_Arg8 != NULL) ? (ULONG)((strlen(_Arg8) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); - EventDataDescCreate(&EventData[10], - (_Arg9 != NULL) ? _Arg9 : "NULL", - (_Arg9 != NULL) ? (ULONG)((strlen(_Arg9) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); + EventDataDescCreate( + &EventData[10], + (_Arg9 != NULL) ? _Arg9 : "NULL", + (_Arg9 != NULL) ? (ULONG)((strlen(_Arg9) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); - EventDataDescCreate(&EventData[11], - (_Arg10 != NULL) ? _Arg10 : "NULL", - (_Arg10 != NULL) ? (ULONG)((strlen(_Arg10) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); + EventDataDescCreate( + &EventData[11], + (_Arg10 != NULL) ? _Arg10 : "NULL", + (_Arg10 != NULL) ? (ULONG)((strlen(_Arg10) + 1) * sizeof(char)) : (ULONG)sizeof("NULL")); - return McGenEventWrite(Context, Descriptor, NULL, McTemplateU0xxsssssssss_ARGCOUNT + 1, EventData); + return McGenEventWrite(Context, Descriptor, NULL, McTemplateU0xxsssssssss_ARGCOUNT + 1, EventData); } #endif // McTemplateU0xxsssssssss_def @@ -1150,4 +1272,4 @@ McTemplateU0xxsssssssss( }; #endif -#define MSG_level_Informational 0x50000004L +#define MSG_level_Informational 0x50000004L diff --git a/vnext/ReactWindowsCore/tracing/fbsystrace.h b/vnext/ReactWindowsCore/tracing/fbsystrace.h index 6c5cf4a6db0..256ea90d209 100644 --- a/vnext/ReactWindowsCore/tracing/fbsystrace.h +++ b/vnext/ReactWindowsCore/tracing/fbsystrace.h @@ -97,7 +97,7 @@ class FbSystraceSection { std::string profile_name_; uint8_t index_{0}; - + std::chrono::high_resolution_clock::time_point start_{std::chrono::high_resolution_clock::now()}; }; From cc3682e642cb6ee446d6183dd60f126767d4e936 Mon Sep 17 00:00:00 2001 From: Anandraj Govindan Date: Mon, 9 Dec 2019 17:59:05 -0800 Subject: [PATCH 3/4] Submitting the ETW schema resouce dll and the register script --- .../etw/react_native_windows_etw_res.dll | Bin 0 -> 5632 bytes vnext/ReactWindowsCore/etw/register.bat | 3 +++ 2 files changed, 3 insertions(+) create mode 100644 vnext/ReactWindowsCore/etw/react_native_windows_etw_res.dll create mode 100644 vnext/ReactWindowsCore/etw/register.bat diff --git a/vnext/ReactWindowsCore/etw/react_native_windows_etw_res.dll b/vnext/ReactWindowsCore/etw/react_native_windows_etw_res.dll new file mode 100644 index 0000000000000000000000000000000000000000..e440233d86365fb90292f08a473a1df944f84774 GIT binary patch literal 5632 zcmeHLU1(fY5T4!M{OxYG=?}DOq_=gE3N}sCv=#LsYqHpwpRUQ8sQ8m@Hcg_*CTuoo z8~U(HDODl{!G}VqRYdZjAS8wQ^ANBPJ~Vj|R79wPAOwYiL3{|T-*@i4>Akym(`H2! z?T~ZNIdf*_%$b=pXEtrmPRk|{(a^G4kt^s44eGo8XBNxBU7rSJzG89r6;JEp?%2TK zm_C{s=}*On_1<_gIg-|o_vxweq&}F`n~rtr!y}2ln#xLF$P~T!*`wEA`>tckYTM>M znmUj9wz=pV>^lZ~2e=lEh$PN=<=6+mK5uDtL-y!?Z?H1;FTVb8cbG~KVQQbOx9NyDK}Xyl%vO5wFB|jCN-%(_OH9=n~-4c;5#N3N$5oyEjtrAval2IRsin1XzMF*x?l5#>uBqhTV zm$VFGoP;DF)*CyT+p4f%3Fyds|65m=F4n!*{_aa(oEh>z_)Q47?nqbcmmu?DHd}@{ z+YlP>M?Hk_YMiAoz$qAta;~6f9*qTzYu1B47JIDq%L-#2i?l@(P?C0KYXvd+4z2$F zPWP5?qhEP?M*k?S&TRHTuWa@b_Go&w0tcRuJ}94-CUulJSiIqEc0c;pM>HFD2QZ~A zZ)?&H!eKDsj2(@@oX7Wo8=oIpDFs`fz^+5k zz|zE9=@l>cKbR-y9yd7}c28mdT4=DTD9!`m)QaM)17}H5oCm>KS`=qJILnISJOs}2 zqBswOv!W=@BjEIb6TuAdnfHL>y#~sGt2c382D=FjF1Y7ha6>M*GcLF(7u<{s?n4*c z=PtNwz~TC;yF-;ZHg1IRmb*u}@f=%`OFrf!W3HY<+uV2xZ?5xV*y-zY=7)0ThjZpf z)SNlyC)k-sVhf?zq1kVQE?k~}TF^rJdl<)sQ0T;}x5atI7=@ zKV3I`d3?G3sl@h+%RlQAv!;*lzJ-rB{34hyNf@d)t-Qe(!DHke2Ch@iE@1M!RVuxB zS4QMz+{r%VAFq`0J^34a-2;0P?0y|Gab+w7OgL}i?7p4>?sjtpf3DciM6v7nJOf9v zzF=EGO@XP*9ruObKljNCv8CqUGS`3HVfy@QEUkC1|7o8ynK^xaFEDvNFG1-OM;$S~ z=5aGsJKmR7*n(j9SGoBn+5Hs)?sk2{ynJ(S6qX%b;V5vlIa<|G$m)Prad?#w%(ZP~)8} z7EyV!7Hv@Dpc*GI-iwt^IgQ_56rw!>xwCJ>XhLg%-4;QH083V|B;m(#B^sK!pgZ4n@fK|xj zy4zX^&gU5)hnK*6>_6cB&-yiGKv9h&1F47WtrrS~^($yaO7)s#h zg93G4AHN1rw^JBS!^dZ#?^QHAP=C$ur2ihqnkhife4quK^b2@%W(&|O+oP_xfclVr zz5qRAbR+Wl1Zo?Q&y=bKo%+lpk1iC@hj!I`w2}e2_WU8op8RR4`JME3d*;&f?rQ-j uz1^O<^jk=e_sD`=d*;%sf5U7*{z4 literal 0 HcmV?d00001 diff --git a/vnext/ReactWindowsCore/etw/register.bat b/vnext/ReactWindowsCore/etw/register.bat new file mode 100644 index 00000000000..438a42cf71e --- /dev/null +++ b/vnext/ReactWindowsCore/etw/register.bat @@ -0,0 +1,3 @@ +@echo off +wevtutil um %~dp0\react_native_windows.man +wevtutil im react_native_windows.man /rf:"%~dp0\react_native_windows_etw_res.dll " /mf:"%~dp0\react_native_windows_etw_res.dll" \ No newline at end of file From 8fca6c52cc38f900e5ca1d43469e9db28a5eebc4 Mon Sep 17 00:00:00 2001 From: Anandraj Govindan Date: Mon, 9 Dec 2019 21:30:05 -0800 Subject: [PATCH 4/4] Change files --- ...ative-windows-2019-12-09-21-30-05-TRACING_CURRENT.json | 8 ++++++++ vnext/ReactWindowsCore/etw/build.bat | 4 ++++ 2 files changed, 12 insertions(+) create mode 100644 change/react-native-windows-2019-12-09-21-30-05-TRACING_CURRENT.json create mode 100644 vnext/ReactWindowsCore/etw/build.bat diff --git a/change/react-native-windows-2019-12-09-21-30-05-TRACING_CURRENT.json b/change/react-native-windows-2019-12-09-21-30-05-TRACING_CURRENT.json new file mode 100644 index 00000000000..be4db4e072a --- /dev/null +++ b/change/react-native-windows-2019-12-09-21-30-05-TRACING_CURRENT.json @@ -0,0 +1,8 @@ +{ + "type": "prerelease", + "comment": "Submitting the ETW schema resouce dll and the register script", + "packageName": "react-native-windows", + "email": "anandrag@microsoft.com", + "commit": "cc3682e642cb6ee446d6183dd60f126767d4e936", + "date": "2019-12-10T05:30:05.029Z" +} \ No newline at end of file diff --git a/vnext/ReactWindowsCore/etw/build.bat b/vnext/ReactWindowsCore/etw/build.bat new file mode 100644 index 00000000000..5c2c0ffb61e --- /dev/null +++ b/vnext/ReactWindowsCore/etw/build.bat @@ -0,0 +1,4 @@ +@echo off +mc -um react_native_windows.man +rc.exe react_native_windows.rc +link.exe /dll /noentry /machine:x64 react_native_windows.res /OUT:react_native_windows_etw_res.dll \ No newline at end of file