diff options
Diffstat (limited to 'src/vm')
-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 |
12 files changed, 83 insertions, 59 deletions
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; |