1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
5 #ifndef __EVENTPIPE_PROVIDER_H__
6 #define __EVENTPIPE_PROVIDER_H__
8 #ifdef FEATURE_PERFTRACING
14 // Define the event pipe callback to match the ETW callback signature.
15 typedef void (*EventPipeCallback)(
19 ULONGLONG MatchAnyKeywords,
20 ULONGLONG MatchAllKeywords,
22 void *CallbackContext);
24 enum class EventPipeEventLevel
34 class EventPipeProvider
37 friend class EventPipeConfiguration;
40 // The GUID of the provider.
43 // True if the provider is enabled.
46 // Bit vector containing the currently enabled keywords.
49 // The current verbosity of the provider.
50 EventPipeEventLevel m_providerLevel;
52 // List of every event currently associated with the provider.
53 // New events can be added on-the-fly.
54 SList<SListElem<EventPipeEvent*>> *m_pEventList;
56 // The optional provider callback.
57 EventPipeCallback m_pCallbackFunction;
59 // The optional provider callback data pointer.
60 void *m_pCallbackData;
64 EventPipeProvider(const GUID &providerID, EventPipeCallback pCallbackFunction = NULL, void *pCallbackData = NULL);
67 // Get the provider ID.
68 const GUID& GetProviderID() const;
70 // Determine if the provider is enabled.
73 // Determine if the specified keywords are enabled.
74 bool EventEnabled(INT64 keywords) const;
76 // Determine if the specified keywords and level match the configuration.
77 bool EventEnabled(INT64 keywords, EventPipeEventLevel eventLevel) const;
79 // Create a new event.
80 EventPipeEvent* AddEvent(INT64 keywords, unsigned int eventID, unsigned int eventVersion, EventPipeEventLevel level, bool needStack);
84 // Add an event to the provider.
85 void AddEvent(EventPipeEvent &event);
87 // Set the provider configuration (enable and disable sets of events).
88 // This is called by EventPipeConfiguration.
89 void SetConfiguration(bool providerEnabled, INT64 keywords, EventPipeEventLevel providerLevel);
91 // Refresh the runtime state of all events.
92 void RefreshAllEvents();
94 // Invoke the provider callback.
95 void InvokeCallback();
98 #endif // FEATURE_PERFTRACING
100 #endif // __EVENTPIPE_PROVIDER_H__