Re-Factor EventSource to Support Writing to EventPipe (#11435)
[platform/upstream/coreclr.git] / src / mscorlib / shared / System / Diagnostics / Tracing / IEventProvider.cs
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.
4
5 using Microsoft.Win32;
6
7 #if ES_BUILD_STANDALONE
8 namespace Microsoft.Diagnostics.Tracing
9 #else
10 namespace System.Diagnostics.Tracing
11 #endif
12 {
13     // Represents the interface between EventProvider and an external logging mechanism.
14     internal interface IEventProvider
15     {
16         // Register an event provider.
17         unsafe uint EventRegister(
18             ref Guid providerId,
19             UnsafeNativeMethods.ManifestEtw.EtwEnableCallback enableCallback,
20             void* callbackContext,
21             ref long registrationHandle);
22
23         // Unregister an event provider.
24         uint EventUnregister(long registrationHandle);
25
26         // Write an event.
27         unsafe int EventWriteTransferWrapper(
28             long registrationHandle,
29             ref EventDescriptor eventDescriptor,
30             Guid* activityId,
31             Guid* relatedActivityId,
32             int userDataCount,
33             EventProvider.EventData* userData);
34
35         // Get or set the per-thread activity ID.
36         int EventActivityIdControl(UnsafeNativeMethods.ManifestEtw.ActivityControl ControlCode, ref Guid ActivityId);
37     }
38 }