-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Share managed EventSource/EventPipe implementation between CoreCLR an…
…d Mono. First changes needed in order to start sharing managed EventSource/EventPipe code between CoreCLR and Mono runtime. Sharable code has been moved into S.P.C library project and split into runtime specific source files when needed, kept within each runtime specific S.P.C project files. Mono runtime has been extended with a set of icalls needed by EventPipeInternal, just to make sure EventPipe can be initialized, current Mono runtime implementation returns dummy values. Current change also enables ETW provider support on Mono Windows runtime. NOTE, this is just initial changes needed in order to share managed EventSource/EventPipe code between runtimes. Future changes will incrementally add EventPipe native code into Mono runtime.
- Loading branch information
1 parent
7f52377
commit 928542f
Showing
22 changed files
with
364 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
src/coreclr/src/System.Private.CoreLib/src/System/Diagnostics/Eventing/EventPipe.CoreCLR.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// 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. | ||
using System.Collections.Generic; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
using System.Threading; | ||
|
||
#if FEATURE_PERFTRACING | ||
|
||
namespace System.Diagnostics.Tracing | ||
{ | ||
internal static partial class EventPipeInternal | ||
{ | ||
// | ||
// These PInvokes are used by the configuration APIs to interact with EventPipe. | ||
// | ||
[DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)] | ||
private static unsafe extern ulong Enable( | ||
char* outputFile, | ||
EventPipeSerializationFormat format, | ||
uint circularBufferSizeInMB, | ||
EventPipeProviderConfigurationNative* providers, | ||
uint numProviders); | ||
|
||
[DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)] | ||
internal static extern void Disable(ulong sessionID); | ||
|
||
// | ||
// These PInvokes are used by EventSource to interact with the EventPipe. | ||
// | ||
[DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)] | ||
internal static extern IntPtr CreateProvider(string providerName, Interop.Advapi32.EtwEnableCallback callbackFunc); | ||
|
||
[DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)] | ||
internal static extern unsafe IntPtr DefineEvent(IntPtr provHandle, uint eventID, long keywords, uint eventVersion, uint level, void* pMetadata, uint metadataLength); | ||
|
||
[DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)] | ||
internal static extern IntPtr GetProvider(string providerName); | ||
|
||
[DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)] | ||
internal static extern void DeleteProvider(IntPtr provHandle); | ||
|
||
[DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)] | ||
internal static extern int EventActivityIdControl(uint controlCode, ref Guid activityId); | ||
|
||
[DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)] | ||
internal static extern unsafe void WriteEventData(IntPtr eventHandle, EventProvider.EventData* pEventData, uint dataCount, Guid* activityId, Guid* relatedActivityId); | ||
|
||
// | ||
// These PInvokes are used as part of the EventPipeEventDispatcher. | ||
// | ||
[DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)] | ||
internal static extern unsafe bool GetSessionInfo(ulong sessionID, EventPipeSessionInfo* pSessionInfo); | ||
|
||
[DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)] | ||
internal static extern unsafe bool GetNextEvent(ulong sessionID, EventPipeEventInstanceData* pInstance); | ||
|
||
[DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)] | ||
internal static extern unsafe IntPtr GetWaitHandle(ulong sessionID); | ||
} | ||
} | ||
|
||
#endif // FEATURE_PERFTRACING |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.