diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mscorlib/shared/System/Diagnostics/Tracing/EventProvider.cs | 24 | ||||
-rw-r--r-- | src/mscorlib/shared/System/Diagnostics/Tracing/EventSource.cs | 2 | ||||
-rw-r--r-- | src/mscorlib/shared/System/Diagnostics/Tracing/IEventProvider.cs | 2 | ||||
-rw-r--r-- | src/mscorlib/src/System/Diagnostics/Eventing/EventPipe.cs | 2 | ||||
-rw-r--r-- | src/mscorlib/src/System/Diagnostics/Eventing/EventPipeEventProvider.cs | 4 | ||||
-rw-r--r-- | src/scripts/genEventPipe.py | 37 | ||||
-rw-r--r-- | src/vm/eventpipe.cpp | 8 | ||||
-rw-r--r-- | src/vm/eventpipe.h | 4 | ||||
-rw-r--r-- | src/vm/eventpipeconfiguration.cpp | 42 | ||||
-rw-r--r-- | src/vm/eventpipeconfiguration.h | 8 | ||||
-rw-r--r-- | src/vm/eventpipeeventinstance.cpp | 12 | ||||
-rw-r--r-- | src/vm/eventpipefile.cpp | 3 | ||||
-rw-r--r-- | src/vm/eventpipeprovider.cpp | 11 | ||||
-rw-r--r-- | src/vm/eventpipeprovider.h | 9 | ||||
-rw-r--r-- | src/vm/fastserializableobject.h | 35 | ||||
-rw-r--r-- | src/vm/fastserializer.cpp | 4 | ||||
-rw-r--r-- | src/vm/sampleprofiler.cpp | 4 | ||||
-rw-r--r-- | src/vm/sampleprofiler.h | 2 |
18 files changed, 112 insertions, 101 deletions
diff --git a/src/mscorlib/shared/System/Diagnostics/Tracing/EventProvider.cs b/src/mscorlib/shared/System/Diagnostics/Tracing/EventProvider.cs index 5b40b10114..2ea12dd042 100644 --- a/src/mscorlib/shared/System/Diagnostics/Tracing/EventProvider.cs +++ b/src/mscorlib/shared/System/Diagnostics/Tracing/EventProvider.cs @@ -87,7 +87,8 @@ namespace System.Diagnostics.Tracing private long m_allKeywordMask; // Match all keyword private List<SessionInfo> m_liveSessions; // current live sessions (Tuple<sessionIdBit, etwSessionId>) private bool m_enabled; // Enabled flag from Trace callback - private Guid m_providerId; // Control Guid + private string m_providerName; // Control name + private Guid m_providerId; // Control Guid internal bool m_disposed; // when true provider has unregistered [ThreadStatic] @@ -140,13 +141,12 @@ namespace System.Diagnostics.Tracing // <SatisfiesLinkDemand Name="Win32Exception..ctor(System.Int32)" /> // <ReferencesCritical Name="Method: EtwEnableCallBack(Guid&, Int32, Byte, Int64, Int64, Void*, Void*):Void" Ring="1" /> // </SecurityKernel> - internal unsafe void Register(Guid providerGuid) + internal unsafe void Register(EventSource eventSource) { - m_providerId = providerGuid; uint status; m_etwCallback = new UnsafeNativeMethods.ManifestEtw.EtwEnableCallback(EtwEnableCallBack); - status = EventRegister(ref m_providerId, m_etwCallback); + status = EventRegister(eventSource, m_etwCallback); if (status != 0) { throw new ArgumentException(Interop.Kernel32.GetMessage(unchecked((int)status))); @@ -488,7 +488,7 @@ namespace System.Diagnostics.Tracing // at least some of the time. // Determine our session from what is in the registry. - string regKey = @"\Microsoft\Windows\CurrentVersion\Winevt\Publishers\{" + m_providerId + "}"; + string regKey = @"\Microsoft\Windows\CurrentVersion\Winevt\Publishers\{" + m_providerName + "}"; if (System.Runtime.InteropServices.Marshal.SizeOf(typeof(IntPtr)) == 8) regKey = @"Software" + @"\Wow6432Node" + regKey; else @@ -563,7 +563,7 @@ namespace System.Diagnostics.Tracing if (filterData == null) { #if (!ES_BUILD_PCL && !ES_BUILD_PN && PLATFORM_WINDOWS) - string regKey = @"\Microsoft\Windows\CurrentVersion\Winevt\Publishers\{" + m_providerId + "}"; + string regKey = @"\Microsoft\Windows\CurrentVersion\Winevt\Publishers\{" + m_providerName + "}"; if (System.Runtime.InteropServices.Marshal.SizeOf(typeof(IntPtr)) == 8) regKey = @"HKEY_LOCAL_MACHINE\Software" + @"\Wow6432Node" + regKey; else @@ -1184,11 +1184,12 @@ namespace System.Diagnostics.Tracing // These are look-alikes to the Manifest based ETW OS APIs that have been shimmed to work // either with Manifest ETW or Classic ETW (if Manifest based ETW is not available). - private unsafe uint EventRegister(ref Guid providerId, UnsafeNativeMethods.ManifestEtw.EtwEnableCallback enableCallback) + private unsafe uint EventRegister(EventSource eventSource, UnsafeNativeMethods.ManifestEtw.EtwEnableCallback enableCallback) { - m_providerId = providerId; + m_providerName = eventSource.Name; + m_providerId = eventSource.Guid; m_etwCallback = enableCallback; - return m_eventProvider.EventRegister(ref providerId, enableCallback, null, ref m_regHandle); + return m_eventProvider.EventRegister(eventSource, enableCallback, null, ref m_regHandle); } private uint EventUnregister(long registrationHandle) @@ -1221,11 +1222,12 @@ namespace System.Diagnostics.Tracing { // Register an event provider. unsafe uint IEventProvider.EventRegister( - ref Guid providerId, + EventSource eventSource, UnsafeNativeMethods.ManifestEtw.EtwEnableCallback enableCallback, void* callbackContext, ref long registrationHandle) { + Guid providerId = eventSource.Guid; return UnsafeNativeMethods.ManifestEtw.EventRegister( ref providerId, enableCallback, @@ -1278,7 +1280,7 @@ namespace System.Diagnostics.Tracing internal sealed class NoOpEventProvider : IEventProvider { unsafe uint IEventProvider.EventRegister( - ref Guid providerId, + EventSource eventSource, UnsafeNativeMethods.ManifestEtw.EtwEnableCallback enableCallback, void* callbackContext, ref long registrationHandle) diff --git a/src/mscorlib/shared/System/Diagnostics/Tracing/EventSource.cs b/src/mscorlib/shared/System/Diagnostics/Tracing/EventSource.cs index 6e8554e0e7..a3acb4891a 100644 --- a/src/mscorlib/shared/System/Diagnostics/Tracing/EventSource.cs +++ b/src/mscorlib/shared/System/Diagnostics/Tracing/EventSource.cs @@ -1560,7 +1560,7 @@ namespace System.Diagnostics.Tracing // Register the provider with ETW var provider = new OverideEventProvider(this); - provider.Register(eventSourceGuid); + provider.Register(this); #endif // Add the eventSource to the global (weak) list. // This also sets m_id, which is the index in the list. diff --git a/src/mscorlib/shared/System/Diagnostics/Tracing/IEventProvider.cs b/src/mscorlib/shared/System/Diagnostics/Tracing/IEventProvider.cs index 71a2fe4d44..966dac2fef 100644 --- a/src/mscorlib/shared/System/Diagnostics/Tracing/IEventProvider.cs +++ b/src/mscorlib/shared/System/Diagnostics/Tracing/IEventProvider.cs @@ -15,7 +15,7 @@ namespace System.Diagnostics.Tracing { // Register an event provider. unsafe uint EventRegister( - ref Guid providerId, + EventSource eventSource, UnsafeNativeMethods.ManifestEtw.EtwEnableCallback enableCallback, void* callbackContext, ref long registrationHandle); diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/EventPipe.cs b/src/mscorlib/src/System/Diagnostics/Eventing/EventPipe.cs index 0d216c38ab..d166bf8140 100644 --- a/src/mscorlib/src/System/Diagnostics/Eventing/EventPipe.cs +++ b/src/mscorlib/src/System/Diagnostics/Eventing/EventPipe.cs @@ -158,7 +158,7 @@ namespace System.Diagnostics.Tracing // [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] - internal static extern IntPtr CreateProvider(Guid providerID, UnsafeNativeMethods.ManifestEtw.EtwEnableCallback callbackFunc); + internal static extern IntPtr CreateProvider(string providerName, UnsafeNativeMethods.ManifestEtw.EtwEnableCallback callbackFunc); [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/EventPipeEventProvider.cs b/src/mscorlib/src/System/Diagnostics/Eventing/EventPipeEventProvider.cs index 1c521bbafc..a8789f5692 100644 --- a/src/mscorlib/src/System/Diagnostics/Eventing/EventPipeEventProvider.cs +++ b/src/mscorlib/src/System/Diagnostics/Eventing/EventPipeEventProvider.cs @@ -18,13 +18,13 @@ namespace System.Diagnostics.Tracing // Register an event provider. unsafe uint IEventProvider.EventRegister( - ref Guid providerId, + EventSource eventSource, UnsafeNativeMethods.ManifestEtw.EtwEnableCallback enableCallback, void* callbackContext, ref long registrationHandle) { uint returnStatus = 0; - m_provHandle = EventPipeInternal.CreateProvider(providerId, enableCallback); + m_provHandle = EventPipeInternal.CreateProvider(eventSource.Name, enableCallback); if(m_provHandle != IntPtr.Zero) { // Fixed registration handle because a new EventPipeEventProvider diff --git a/src/scripts/genEventPipe.py b/src/scripts/genEventPipe.py index d5785d2799..3caa2071fc 100644 --- a/src/scripts/genEventPipe.py +++ b/src/scripts/genEventPipe.py @@ -122,9 +122,9 @@ def generateClrEventPipeWriteEventsImpl( WriteEventImpl.append( " EventPipeProvider" + providerPrettyName + - " = EventPipe::CreateProvider(" + + " = EventPipe::CreateProvider(SL(" + providerPrettyName + - "GUID);\n") + "Name));\n") for eventNode in eventNodes: eventName = eventNode.getAttribute('symbol') templateName = eventNode.getAttribute('template') @@ -207,23 +207,9 @@ def generateWriteEventBody(template, providerName, eventName): return header + code + checking + body + footer -providerGUIDMap = {} -providerGUIDMap[ - "{e13c0d23-ccbc-4e12-931b-d9cc2eee27e4}"] = "{0xe13c0d23,0xccbc,0x4e12,{0x93,0x1b,0xd9,0xcc,0x2e,0xee,0x27,0xe4}}" -providerGUIDMap[ - "{A669021C-C450-4609-A035-5AF59AF4DF18}"] = "{0xA669021C,0xC450,0x4609,{0xA0,0x35,0x5A,0xF5,0x9A,0xF4,0xDF,0x18}}" -providerGUIDMap[ - "{CC2BCBBA-16B6-4cf3-8990-D74C2E8AF500}"] = "{0xCC2BCBBA,0x16B6,0x4cf3,{0x89,0x90,0xD7,0x4C,0x2E,0x8A,0xF5,0x00}}" -providerGUIDMap[ - "{763FD754-7086-4dfe-95EB-C01A46FAF4CA}"] = "{0x763FD754,0x7086,0x4dfe,{0x95,0xEB,0xC0,0x1A,0x46,0xFA,0xF4,0xCA}}" - - -def generateGUID(tmpGUID): - return providerGUIDMap[tmpGUID] keywordMap = {} - def generateEventKeywords(eventKeywords): mask = 0 # split keywords if there are multiple @@ -375,8 +361,6 @@ def generateEventPipeImplFiles( tree = DOM.parse(etwmanifest) coreclrRoot = os.getcwd() for providerNode in tree.getElementsByTagName('provider'): - providerGUID = providerNode.getAttribute('guid') - providerGUID = generateGUID(providerGUID) providerName = providerNode.getAttribute('name') providerPrettyName = providerName.replace("Windows-", '') @@ -417,15 +401,16 @@ bool WriteToBuffer(const T &value, char *&buffer, unsigned int& offset, unsigned eventpipeImpl.write(header) eventpipeImpl.write( - "GUID const " + - providerPrettyName + - "GUID = " + - providerGUID + - ";\n") + "const WCHAR* %sName = W(\"%s\");\n" % ( + providerPrettyName, + providerName + ) + ) eventpipeImpl.write( - "EventPipeProvider *EventPipeProvider" + - providerPrettyName + - " = nullptr;\n") + "EventPipeProvider *EventPipeProvider%s = nullptr;\n" % ( + providerPrettyName, + ) + ) templateNodes = providerNode.getElementsByTagName('template') allTemplates = parseTemplateNodes(templateNodes) eventNodes = providerNode.getElementsByTagName('event') diff --git a/src/vm/eventpipe.cpp b/src/vm/eventpipe.cpp index d8d3791d59..b170d4356e 100644 --- a/src/vm/eventpipe.cpp +++ b/src/vm/eventpipe.cpp @@ -380,7 +380,7 @@ bool EventPipe::Enabled() return enabled; } -EventPipeProvider* EventPipe::CreateProvider(const GUID &providerID, EventPipeCallback pCallbackFunction, void *pCallbackData) +EventPipeProvider* EventPipe::CreateProvider(const SString &providerName, EventPipeCallback pCallbackFunction, void *pCallbackData) { CONTRACTL { @@ -390,7 +390,7 @@ EventPipeProvider* EventPipe::CreateProvider(const GUID &providerID, EventPipeCa } CONTRACTL_END; - return new EventPipeProvider(providerID, pCallbackFunction, pCallbackData); + return new EventPipeProvider(providerName, pCallbackFunction, pCallbackData); } void EventPipe::DeleteProvider(EventPipeProvider *pProvider) @@ -700,7 +700,7 @@ void QCALLTYPE EventPipeInternal::Disable() } INT_PTR QCALLTYPE EventPipeInternal::CreateProvider( - GUID providerID, + __in_z LPCWSTR providerName, EventPipeCallback pCallbackFunc) { QCALL_CONTRACT; @@ -709,7 +709,7 @@ INT_PTR QCALLTYPE EventPipeInternal::CreateProvider( BEGIN_QCALL; - pProvider = EventPipe::CreateProvider(providerID, pCallbackFunc, NULL); + pProvider = EventPipe::CreateProvider(SL(providerName), pCallbackFunc, NULL); END_QCALL; diff --git a/src/vm/eventpipe.h b/src/vm/eventpipe.h index 6ea29ac63b..bac7be6ac8 100644 --- a/src/vm/eventpipe.h +++ b/src/vm/eventpipe.h @@ -244,7 +244,7 @@ class EventPipe static bool Enabled(); // Create a provider. - static EventPipeProvider* CreateProvider(const GUID &providerID, EventPipeCallback pCallbackFunction = NULL, void *pCallbackData = NULL); + static EventPipeProvider* CreateProvider(const SString &providerName, EventPipeCallback pCallbackFunction = NULL, void *pCallbackData = NULL); // Delete a provider. static void DeleteProvider(EventPipeProvider *pProvider); @@ -358,7 +358,7 @@ public: static void QCALLTYPE Disable(); static INT_PTR QCALLTYPE CreateProvider( - GUID providerID, + __in_z LPCWSTR providerName, EventPipeCallback pCallbackFunc); static INT_PTR QCALLTYPE DefineEvent( diff --git a/src/vm/eventpipeconfiguration.cpp b/src/vm/eventpipeconfiguration.cpp index ee2c3820bf..80c4878782 100644 --- a/src/vm/eventpipeconfiguration.cpp +++ b/src/vm/eventpipeconfiguration.cpp @@ -10,9 +10,7 @@ #ifdef FEATURE_PERFTRACING -// {5291C09C-2660-4D6A-83A3-C383FD020DEC} -const GUID EventPipeConfiguration::s_configurationProviderID = - { 0x5291c09c, 0x2660, 0x4d6a, { 0x83, 0xa3, 0xc3, 0x83, 0xfd, 0x2, 0xd, 0xec } }; +const WCHAR* EventPipeConfiguration::s_configurationProviderName = W("Microsoft-DotNETCore-EventPipeConfiguration"); EventPipeConfiguration::EventPipeConfiguration() { @@ -74,7 +72,7 @@ void EventPipeConfiguration::Initialize() CONTRACTL_END; // Create the configuration provider. - m_pConfigProvider = EventPipe::CreateProvider(s_configurationProviderID); + m_pConfigProvider = EventPipe::CreateProvider(SL(s_configurationProviderName)); // Create the metadata event. m_pMetadataEvent = m_pConfigProvider->AddEvent( @@ -99,7 +97,7 @@ bool EventPipeConfiguration::RegisterProvider(EventPipeProvider &provider) CrstHolder _crst(EventPipe::GetLock()); // See if we've already registered this provider. - EventPipeProvider *pExistingProvider = GetProviderNoLock(provider.GetProviderID()); + EventPipeProvider *pExistingProvider = GetProviderNoLock(provider.GetProviderName()); if(pExistingProvider != NULL) { return false; @@ -162,7 +160,7 @@ bool EventPipeConfiguration::UnregisterProvider(EventPipeProvider &provider) return false; } -EventPipeProvider* EventPipeConfiguration::GetProvider(const GUID &providerID) +EventPipeProvider* EventPipeConfiguration::GetProvider(const SString &providerName) { CONTRACTL { @@ -176,10 +174,10 @@ EventPipeProvider* EventPipeConfiguration::GetProvider(const GUID &providerID) // modify the list. CrstHolder _crst(EventPipe::GetLock()); - return GetProviderNoLock(providerID); + return GetProviderNoLock(providerName); } -EventPipeProvider* EventPipeConfiguration::GetProviderNoLock(const GUID &providerID) +EventPipeProvider* EventPipeConfiguration::GetProviderNoLock(const SString &providerName) { CONTRACTL { @@ -194,7 +192,7 @@ EventPipeProvider* EventPipeConfiguration::GetProviderNoLock(const GUID &provide while(pElem != NULL) { EventPipeProvider *pProvider = pElem->GetValue(); - if(pProvider->GetProviderID() == providerID) + if(pProvider->GetProviderName().Equals(providerName)) { return pProvider; } @@ -321,8 +319,8 @@ void EventPipeConfiguration::EnableRundown() _ASSERTE(m_pEnabledProviderList == NULL); const unsigned int numRundownProviders = 2; EventPipeProviderConfiguration rundownProviders[numRundownProviders]; - rundownProviders[0] = EventPipeProviderConfiguration(W("e13c0d23-ccbc-4e12-931b-d9cc2eee27e4"), 0x80020138, static_cast<unsigned int>(EventPipeEventLevel::Verbose)); // Public provider. - rundownProviders[1] = EventPipeProviderConfiguration(W("a669021c-c450-4609-a035-5af59af4df18"), 0x80020138, static_cast<unsigned int>(EventPipeEventLevel::Verbose)); // Rundown provider. + rundownProviders[0] = EventPipeProviderConfiguration(W("Microsoft-Windows-DotNETRuntime"), 0x80020138, static_cast<unsigned int>(EventPipeEventLevel::Verbose)); // Public provider. + rundownProviders[1] = EventPipeProviderConfiguration(W("Microsoft-Windows-DotNETRuntimeRundown"), 0x80020138, static_cast<unsigned int>(EventPipeEventLevel::Verbose)); // Rundown provider. // Enable rundown. m_rundownEnabled = true; @@ -349,12 +347,13 @@ EventPipeEventInstance* EventPipeConfiguration::BuildEventMetadataEvent(EventPip // Calculate the size of the event. EventPipeEvent &sourceEvent = *sourceInstance.GetEvent(); - const GUID &providerID = sourceEvent.GetProvider()->GetProviderID(); + const SString &providerName = sourceEvent.GetProvider()->GetProviderName(); unsigned int eventID = sourceEvent.GetEventID(); unsigned int eventVersion = sourceEvent.GetEventVersion(); BYTE *pPayloadData = sourceEvent.GetMetadata(); unsigned int payloadLength = sourceEvent.GetMetadataLength(); - unsigned int instancePayloadSize = sizeof(providerID) + sizeof(eventID) + sizeof(eventVersion) + sizeof(payloadLength) + payloadLength; + unsigned int providerNameLength = (providerName.GetCount() + 1) * sizeof(WCHAR); + unsigned int instancePayloadSize = providerNameLength + sizeof(eventID) + sizeof(eventVersion) + sizeof(payloadLength) + payloadLength; // Allocate the payload. BYTE *pInstancePayload = new BYTE[instancePayloadSize]; @@ -363,10 +362,10 @@ EventPipeEventInstance* EventPipeConfiguration::BuildEventMetadataEvent(EventPip BYTE *currentPtr = pInstancePayload; // Write the provider ID. - memcpy(currentPtr, (BYTE*)&providerID, sizeof(providerID)); - currentPtr += sizeof(providerID); + memcpy(currentPtr, (BYTE*)providerName.GetUnicode(), providerNameLength); + currentPtr += providerNameLength; - // Write the event ID. + // Write the event name as null-terminated unicode. memcpy(currentPtr, &eventID, sizeof(eventID)); currentPtr += sizeof(eventID); @@ -515,16 +514,7 @@ EventPipeEnabledProvider* EventPipeEnabledProviderList::GetEnabledProvider( return NULL; } - // TEMPORARY: Convert the provider GUID to a string. - const unsigned int guidSize = 39; - WCHAR wszProviderID[guidSize]; - if(!StringFromGUID2(pProvider->GetProviderID(), wszProviderID, guidSize)) - { - wszProviderID[0] = '\0'; - } - - // Strip off the {}. - SString providerNameStr(&wszProviderID[1], guidSize-3); + SString providerNameStr = pProvider->GetProviderName(); LPCWSTR providerName = providerNameStr.GetUnicode(); EventPipeEnabledProvider *pEnabledProvider = NULL; diff --git a/src/vm/eventpipeconfiguration.h b/src/vm/eventpipeconfiguration.h index aac9bd6065..1d161367b2 100644 --- a/src/vm/eventpipeconfiguration.h +++ b/src/vm/eventpipeconfiguration.h @@ -42,7 +42,7 @@ public: bool UnregisterProvider(EventPipeProvider &provider); // Get the provider with the specified provider ID if it exists. - EventPipeProvider* GetProvider(const GUID &providerID); + EventPipeProvider* GetProvider(const SString &providerID); // Get the configured size of the circular buffer. size_t GetCircularBufferSize() const; @@ -77,7 +77,7 @@ public: private: // Get the provider without taking the lock. - EventPipeProvider* GetProviderNoLock(const GUID &providerID); + EventPipeProvider* GetProviderNoLock(const SString &providerID); // Determines whether or not the event pipe is enabled. Volatile<bool> m_enabled; @@ -98,9 +98,9 @@ private: // The event used to write event information to the event stream. EventPipeEvent *m_pMetadataEvent; - // The provider ID for the configuration event pipe provider. + // The provider name for the configuration event pipe provider. // This provider is used to emit configuration events. - static const GUID s_configurationProviderID; + const static WCHAR* s_configurationProviderName; // True if rundown is enabled. Volatile<bool> m_rundownEnabled; diff --git a/src/vm/eventpipeeventinstance.cpp b/src/vm/eventpipeeventinstance.cpp index afde2c0547..305b6dac04 100644 --- a/src/vm/eventpipeeventinstance.cpp +++ b/src/vm/eventpipeeventinstance.cpp @@ -182,19 +182,11 @@ void EventPipeEventInstance::SerializeToJsonFile(EventPipeJsonFile *pFile) EX_TRY { - const unsigned int guidSize = 39; - WCHAR wszProviderID[guidSize]; - if(!StringFromGUID2(m_pEvent->GetProvider()->GetProviderID(), wszProviderID, guidSize)) - { - wszProviderID[0] = '\0'; - } - - // Strip off the {}. StackScratchBuffer scratch; - SString guidStr(&wszProviderID[1], guidSize-3); + SString providerName = m_pEvent->GetProvider()->GetProviderName(); SString message; - message.Printf("Provider=%s/EventID=%d/Version=%d", guidStr.GetANSI(scratch), m_pEvent->GetEventID(), m_pEvent->GetEventVersion()); + message.Printf("Provider=%s/EventID=%d/Version=%d", providerName.GetANSI(scratch), m_pEvent->GetEventID(), m_pEvent->GetEventVersion()); pFile->WriteEvent(m_timeStamp, m_threadID, message, m_stackContents); } EX_CATCH{} EX_END_CATCH(SwallowAllExceptions); diff --git a/src/vm/eventpipefile.cpp b/src/vm/eventpipefile.cpp index f574814586..26e04480ee 100644 --- a/src/vm/eventpipefile.cpp +++ b/src/vm/eventpipefile.cpp @@ -25,6 +25,9 @@ EventPipeFile::EventPipeFile( } CONTRACTL_END; + SetObjectVersion(2); + SetMinReaderVersion(0); + m_pSerializer = new FastSerializer(outputFilePath, *this); m_serializationLock.Init(LOCK_TYPE_DEFAULT); m_pMetadataLabels = new MapSHashWithRemove<EventPipeEvent*, StreamLabel>(); diff --git a/src/vm/eventpipeprovider.cpp b/src/vm/eventpipeprovider.cpp index f4ddd19b78..7361541e77 100644 --- a/src/vm/eventpipeprovider.cpp +++ b/src/vm/eventpipeprovider.cpp @@ -7,10 +7,11 @@ #include "eventpipeconfiguration.h" #include "eventpipeevent.h" #include "eventpipeprovider.h" +#include "sha1.h" #ifdef FEATURE_PERFTRACING -EventPipeProvider::EventPipeProvider(const GUID &providerID, EventPipeCallback pCallbackFunction, void *pCallbackData) +EventPipeProvider::EventPipeProvider(const SString &providerName, EventPipeCallback pCallbackFunction, void *pCallbackData) { CONTRACTL { @@ -20,7 +21,7 @@ EventPipeProvider::EventPipeProvider(const GUID &providerID, EventPipeCallback p } CONTRACTL_END; - m_providerID = providerID; + m_providerName = providerName; m_enabled = false; m_keywords = 0; m_providerLevel = EventPipeEventLevel::Critical; @@ -75,11 +76,11 @@ EventPipeProvider::~EventPipeProvider() } } -const GUID& EventPipeProvider::GetProviderID() const +const SString& EventPipeProvider::GetProviderName() const { LIMITED_METHOD_CONTRACT; - return m_providerID; + return m_providerName; } bool EventPipeProvider::Enabled() const @@ -200,7 +201,7 @@ void EventPipeProvider::InvokeCallback() if(m_pCallbackFunction != NULL && !g_fEEShutDown) { (*m_pCallbackFunction)( - &m_providerID, + NULL, /* providerId */ m_enabled, (UCHAR) m_providerLevel, m_keywords, diff --git a/src/vm/eventpipeprovider.h b/src/vm/eventpipeprovider.h index d2c459ef32..7b92faca72 100644 --- a/src/vm/eventpipeprovider.h +++ b/src/vm/eventpipeprovider.h @@ -34,6 +34,9 @@ private: // The GUID of the provider. GUID m_providerID; + // The name of the provider. + SString m_providerName; + // True if the provider is enabled. bool m_enabled; @@ -61,14 +64,14 @@ private: bool m_deleteDeferred; // Private constructor because all providers are created through EventPipe::CreateProvider. - EventPipeProvider(const GUID &providerID, EventPipeCallback pCallbackFunction = NULL, void *pCallbackData = NULL); + EventPipeProvider(const SString &providerName, EventPipeCallback pCallbackFunction = NULL, void *pCallbackData = NULL); public: ~EventPipeProvider(); - // Get the provider ID. - const GUID& GetProviderID() const; + // Get the provider Name. + const SString& GetProviderName() const; // Determine if the provider is enabled. bool Enabled() const; diff --git a/src/vm/fastserializableobject.h b/src/vm/fastserializableobject.h index cbfcfc9f0e..ec162e3cc3 100644 --- a/src/vm/fastserializableobject.h +++ b/src/vm/fastserializableobject.h @@ -25,6 +25,41 @@ public: // Get the type name for the current object. virtual const char* GetTypeName() = 0; + + int GetObjectVersion() const + { + LIMITED_METHOD_CONTRACT; + + return m_objectVersion; + } + + int GetMinReaderVersion() const + { + LIMITED_METHOD_CONTRACT; + + return m_minReaderVersion; + } + +protected: + + void SetObjectVersion(int version) + { + LIMITED_METHOD_CONTRACT; + + m_objectVersion = version; + } + + void SetMinReaderVersion(int version) + { + LIMITED_METHOD_CONTRACT; + + m_minReaderVersion = version; + } + +private: + + int m_objectVersion = 1; + int m_minReaderVersion = 0; }; #endif // FEATURE_PERFTRACING diff --git a/src/vm/fastserializer.cpp b/src/vm/fastserializer.cpp index 7f9b4e20a6..8e0e0ad768 100644 --- a/src/vm/fastserializer.cpp +++ b/src/vm/fastserializer.cpp @@ -226,8 +226,8 @@ void FastSerializer::WriteSerializationType(FastSerializableObject *pObject) // Write the SerializationType version fields. int serializationType[2]; - serializationType[0] = 1; // Object Version. - serializationType[1] = 0; // Minimum Reader Version. + serializationType[0] = pObject->GetObjectVersion(); + serializationType[1] = pObject->GetMinReaderVersion(); WriteBuffer((BYTE*) &serializationType, sizeof(serializationType)); // Write the SerializationType TypeName field. diff --git a/src/vm/sampleprofiler.cpp b/src/vm/sampleprofiler.cpp index e4721577ae..4a858e9b4a 100644 --- a/src/vm/sampleprofiler.cpp +++ b/src/vm/sampleprofiler.cpp @@ -13,7 +13,7 @@ Volatile<BOOL> SampleProfiler::s_profilingEnabled = false; Thread* SampleProfiler::s_pSamplingThread = NULL; -const GUID SampleProfiler::s_providerID = {0x3c530d44,0x97ae,0x513a,{0x1e,0x6d,0x78,0x3e,0x8f,0x8e,0x03,0xa9}}; // {3c530d44-97ae-513a-1e6d-783e8f8e03a9} +const WCHAR* SampleProfiler::s_providerName = W("Microsoft-DotNETCore-SampleProfiler"); EventPipeProvider* SampleProfiler::s_pEventPipeProvider = NULL; EventPipeEvent* SampleProfiler::s_pThreadTimeEvent = NULL; BYTE* SampleProfiler::s_pPayloadExternal = NULL; @@ -36,7 +36,7 @@ void SampleProfiler::Enable() if(s_pEventPipeProvider == NULL) { - s_pEventPipeProvider = EventPipe::CreateProvider(s_providerID); + s_pEventPipeProvider = EventPipe::CreateProvider(SL(s_providerName)); s_pThreadTimeEvent = s_pEventPipeProvider->AddEvent( 0, /* eventID */ 0, /* keywords */ diff --git a/src/vm/sampleprofiler.h b/src/vm/sampleprofiler.h index 02eb6b39cd..51290b4d9c 100644 --- a/src/vm/sampleprofiler.h +++ b/src/vm/sampleprofiler.h @@ -50,7 +50,7 @@ class SampleProfiler static Thread *s_pSamplingThread; // The provider and event emitted by the profiler. - static const GUID s_providerID; + static const WCHAR* s_providerName; static EventPipeProvider *s_pEventPipeProvider; static EventPipeEvent *s_pThreadTimeEvent; |