summaryrefslogtreecommitdiff
path: root/src/vm/eventpipesession.h
diff options
context:
space:
mode:
authorBrian Robbins <brianrob@microsoft.com>2018-01-25 20:29:23 -0800
committerGitHub <noreply@github.com>2018-01-25 20:29:23 -0800
commita118b0571d8ae8bd34c275d02294fa19251345b6 (patch)
tree505de85259c0263f556d7813fd388abf39eaf2c0 /src/vm/eventpipesession.h
parent5c5695fb05c62f42b969cc33119399e6c8fcf04e (diff)
downloadcoreclr-a118b0571d8ae8bd34c275d02294fa19251345b6.tar.gz
coreclr-a118b0571d8ae8bd34c275d02294fa19251345b6.tar.bz2
coreclr-a118b0571d8ae8bd34c275d02294fa19251345b6.zip
Create the concept of EventPipeSession and refactor EventPipe to use it. Also expose COMPlus configuration variables to support session configuration and output file path. (#16018)
Diffstat (limited to 'src/vm/eventpipesession.h')
-rw-r--r--src/vm/eventpipesession.h135
1 files changed, 135 insertions, 0 deletions
diff --git a/src/vm/eventpipesession.h b/src/vm/eventpipesession.h
new file mode 100644
index 0000000000..ba91c60aaa
--- /dev/null
+++ b/src/vm/eventpipesession.h
@@ -0,0 +1,135 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+#ifndef __EVENTPIPE_SESSION_H__
+#define __EVENTPIPE_SESSION_H__
+
+#ifdef FEATURE_PERFTRACING
+
+enum class EventPipeEventLevel;
+struct EventPipeProviderConfiguration;
+class EventPipeSessionProviderList;
+class EventPipeSessionProvider;
+
+class EventPipeSession
+{
+private:
+ // The set of configurations for each provider in the session.
+ EventPipeSessionProviderList *m_pProviderList;
+
+ // The configured size of the circular buffer.
+ size_t m_circularBufferSizeInBytes;
+
+ // True if rundown is enabled.
+ Volatile<bool> m_rundownEnabled;
+
+public:
+
+ // TODO: This needs to be exposed via EventPipe::CreateSession() and EventPipe::DeleteSession() to avoid memory ownership issues.
+ EventPipeSession(
+ unsigned int circularBufferSizeInMB,
+ EventPipeProviderConfiguration *pProviders,
+ unsigned int numProviders);
+
+ ~EventPipeSession();
+
+ // Determine if the session is valid or not. Invalid sessions can be detected before they are enabled.
+ bool IsValid() const;
+
+ // Get the configured size of the circular buffer.
+ size_t GetCircularBufferSize() const
+ {
+ LIMITED_METHOD_CONTRACT;
+ return m_circularBufferSizeInBytes;
+ }
+
+ // Determine if rundown is enabled.
+ bool RundownEnabled() const
+ {
+ LIMITED_METHOD_CONTRACT;
+ return m_rundownEnabled;
+ }
+
+ // Set the rundown enabled flag.
+ void SetRundownEnabled(bool value)
+ {
+ LIMITED_METHOD_CONTRACT;
+ m_rundownEnabled = value;
+ }
+
+ // Enable all events.
+ // This is used for testing and is controlled via COMPLUS_EnableEventPipe.
+ void EnableAllEvents();
+
+ // Add a new provider to the session.
+ void AddSessionProvider(EventPipeSessionProvider *pProvider);
+
+ // Get the session provider for the specified provider if present.
+ EventPipeSessionProvider* GetSessionProvider(EventPipeProvider *pProvider);
+};
+
+class EventPipeSessionProviderList
+{
+
+private:
+
+ // The list of providers.
+ SList<SListElem<EventPipeSessionProvider*>> *m_pProviders;
+
+ // A catch-all provider used when tracing is enabled at start-up
+ // under (COMPlus_PerformanceTracing & 1) == 1.
+ EventPipeSessionProvider *m_pCatchAllProvider;
+
+public:
+
+ // Create a new list based on the input.
+ EventPipeSessionProviderList(EventPipeProviderConfiguration *pConfigs, unsigned int numConfigs);
+ ~EventPipeSessionProviderList();
+
+ // Enable all events.
+ // This is used for testing and is controlled via COMPLUS_EnableEventPipe.
+ void EnableAllEvents();
+
+ // Add a new session provider to the list.
+ void AddSessionProvider(EventPipeSessionProvider *pProvider);
+
+ // Get the session provider for the specified provider.
+ // Return NULL if one doesn't exist.
+ EventPipeSessionProvider* GetSessionProvider(EventPipeProvider *pProvider);
+
+ // Returns true if the list is empty.
+ bool IsEmpty() const;
+};
+
+class EventPipeSessionProvider
+{
+private:
+
+ // The provider name.
+ WCHAR *m_pProviderName;
+
+ // The enabled keywords.
+ UINT64 m_keywords;
+
+ // The loging level.
+ EventPipeEventLevel m_loggingLevel;
+
+public:
+
+ EventPipeSessionProvider(
+ LPCWSTR providerName,
+ UINT64 keywords,
+ EventPipeEventLevel loggingLevel);
+ ~EventPipeSessionProvider();
+
+ LPCWSTR GetProviderName() const;
+
+ UINT64 GetKeywords() const;
+
+ EventPipeEventLevel GetLevel() const;
+};
+
+#endif // FEATURE_PERFTRACING
+
+#endif // __EVENTPIPE_SESSION_H__