Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -359,11 +359,12 @@ REM Find python and set it to the variable PYTHON
echo import sys; sys.stdout.write(sys.executable) | (py -3 || py -2 || python3 || python2 || python) > %TEMP%\pythonlocation.txt 2> NUL
set /p PYTHON=<%TEMP%\pythonlocation.txt

if NOT DEFINED PYTHON (
echo %__MsgPrefix%Error: Could not find a python installation
exit /b 1
)

if /i "%__BuildNative%"=="1" (
if NOT DEFINED PYTHON (
echo %__MsgPrefix%Error: Could not find a python installation
exit /b 1
)

echo %__MsgPrefix%Laying out dynamically generated files consumed by the native build system
echo %__MsgPrefix%Laying out dynamically generated Event test files and etmdummy stub functions
Expand All @@ -376,6 +377,12 @@ if /i "%__BuildNative%"=="1" (
"!PYTHON!" -B -Wall %__SourceDir%\scripts\genEtwProvider.py --man %__SourceDir%\vm\ClrEtwAll.man --intermediate %__IntermediatesIncDir% --exc %__SourceDir%\vm\ClrEtwAllMeta.lst || exit /b 1
)

if /i "%__BuildCoreLib%"=="1" (

echo %__MsgPrefix%Laying out dynamically generated EventSource classes
"!PYTHON!" -B -Wall %__SourceDir%\scripts\genRuntimeEventSources.py --man %__SourceDir%\vm\ClrEtwAll.man --intermediate %__IntermediatesEventingDir% || exit /b 1
)

if /i "%__DoCrossArchBuild%"=="1" (
if NOT DEFINED PYTHON (
echo %__MsgPrefix%Error: Could not find a python installation
Expand All @@ -392,6 +399,9 @@ if /i "%__DoCrossArchBuild%"=="1" (
echo %__MsgPrefix%Laying out dynamically generated EventPipe Implementation
"!PYTHON!" -B -Wall %__SourceDir%\scripts\genEventPipe.py --man %__SourceDir%\vm\ClrEtwAll.man --intermediate !__CrossCompIntermediatesEventingDir!\eventpipe --nonextern || exit /b 1

echo %__MsgPrefix%Laying out dynamically generated EventSource classes
"!PYTHON!" -B -Wall %__SourceDir%\scripts\genRuntimeEventSources.py --man %__SourceDir%\vm\ClrEtwAll.man --intermediate !__CrossCompIntermediatesEventingDir! || exit /b 1

echo %__MsgPrefix%Laying out ETW event logging interface
"!PYTHON!" -B -Wall %__SourceDir%\scripts\genEtwProvider.py --man %__SourceDir%\vm\ClrEtwAll.man --intermediate !__CrossCompIntermediatesIncDir! --exc %__SourceDir%\vm\ClrEtwAllMeta.lst || exit /b 1
)
Expand Down
5 changes: 4 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@ generate_event_logging_sources()
echo "Laying out dynamically generated EventPipe Implementation"
$PYTHON -B $__PythonWarningFlags "$__ProjectRoot/src/scripts/genEventPipe.py" --man "$__ProjectRoot/src/vm/ClrEtwAll.man" --intermediate "$__OutputEventingDir/eventpipe"

echo "Laying out dynamically generated EventSource classes"
$PYTHON -B $__PythonWarningFlags "$__ProjectRoot/src/scripts/genRuntimeEventSources.py" --man "$__ProjectRoot/src/vm/ClrEtwAll.man" --intermediate "$__OutputEventingDir"

# determine the logging system
case $__BuildOS in
Linux|FreeBSD)
Expand All @@ -242,7 +245,7 @@ generate_event_logging_sources()
generate_event_logging()
{
# Event Logging Infrastructure
if [[ $__SkipCoreCLR == 0 || $__ConfigureOnly == 1 ]]; then
if [[ $__SkipCoreCLR == 0 || $__SkipMSCorLib == 0 || $__ConfigureOnly == 1 ]]; then
generate_event_logging_sources "$__IntermediatesDir" "the native build system"
fi

Expand Down
3 changes: 1 addition & 2 deletions clr.coreclr.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<FeatureICastable>true</FeatureICastable>
<FeatureManagedEtwChannels>true</FeatureManagedEtwChannels>
<FeatureManagedEtw>true</FeatureManagedEtw>

<FeaturePerfTracing>true</FeaturePerfTracing>
<ProfilingSupportedBuild>true</ProfilingSupportedBuild>
</PropertyGroup>

Expand All @@ -17,7 +17,6 @@
<FeatureStubsAsIL>true</FeatureStubsAsIL>

<FeatureCoreFxGlobalization>true</FeatureCoreFxGlobalization>
<FeaturePerfTracing>true</FeaturePerfTracing>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetsWindows)' == 'true'">
Expand Down
2 changes: 2 additions & 0 deletions src/mscorlib/ILLinkTrim.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,7 @@
</type>
<!-- Accessed via private reflection by tracing controller. -->
<type fullname="System.Diagnostics.Tracing.EventPipe*" />
<!-- Accessed via private reflection and by native code. -->
<type fullname="System.Diagnostics.Tracing.RuntimeEventSource" />
</assembly>
</linker>
6 changes: 5 additions & 1 deletion src/mscorlib/System.Private.CoreLib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -523,9 +523,13 @@
<Compile Include="$(BclSourcesRoot)\System\Diagnostics\Eventing\EventSource_CoreCLR.cs" />
<Compile Condition="'$(FeatureXplatEventSource)' == 'true'" Include="$(BclSourcesRoot)\System\Diagnostics\Eventing\XplatEventLogger.cs" />
<Compile Include="$(BclSourcesRoot)\System\Diagnostics\Eventing\FrameworkEventSource.cs" />
<Compile Include="$(IntermediateOutputPath)..\eventing\DotNETRuntimeEventSource.cs" />
<Compile Include="$(BclSourcesRoot)\System\Diagnostics\Eventing\DotNETRuntimeEventSource.cs" />
<Compile Include="$(BclSourcesRoot)\System\Diagnostics\Eventing\EventPipe.cs" />
<Compile Include="$(BclSourcesRoot)\System\Diagnostics\Eventing\EventPipeEventDispatcher.cs" />
<Compile Include="$(BclSourcesRoot)\System\Diagnostics\Eventing\EventPipeEventProvider.cs" />
<Compile Include="$(BclSourcesRoot)\System\Diagnostics\Eventing\EventPipeMetadataGenerator.cs" />
<Compile Include="$(BclSourcesRoot)\System\Diagnostics\Eventing\EventPipePayloadDecoder.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="$(BclSourcesRoot)\System\Diagnostics\Contracts\Contracts.cs" />
Expand Down Expand Up @@ -670,4 +674,4 @@
</ItemGroup>
<Import Project="ILLink.targets" />
<Import Project="GenerateCompilerResponseFile.targets" />
</Project>
</Project>
39 changes: 28 additions & 11 deletions src/mscorlib/shared/System/Diagnostics/Tracing/EventProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ namespace Microsoft.Diagnostics.Tracing
namespace System.Diagnostics.Tracing
#endif
{
internal enum EventProviderType
{
None = 0,
ETW,
EventPipe
};

// New in CLR4.0
internal enum ControllerCommand
{
Expand Down Expand Up @@ -120,15 +127,28 @@ public enum WriteEventErrorCode : int
// it registers a callback from native code you MUST dispose it BEFORE shutdown, otherwise
// you may get native callbacks during shutdown when we have destroyed the delegate.
// EventSource has special logic to do this, no one else should be calling EventProvider.
internal EventProvider()
internal EventProvider(EventProviderType providerType)
{
switch (providerType)
{
case EventProviderType.ETW:
#if PLATFORM_WINDOWS
m_eventProvider = new EtwEventProvider();
#elif FEATURE_PERFTRACING
m_eventProvider = new EventPipeEventProvider();
m_eventProvider = new EtwEventProvider();
#else
m_eventProvider = new NoOpEventProvider();
m_eventProvider = new NoOpEventProvider();
#endif
break;
case EventProviderType.EventPipe:
#if FEATURE_PERFTRACING
m_eventProvider = new EventPipeEventProvider();
#else
m_eventProvider = new NoOpEventProvider();
#endif
break;
default:
m_eventProvider = new NoOpEventProvider();
break;
};
}

/// <summary>
Expand Down Expand Up @@ -475,7 +495,7 @@ private unsafe void GetSessionInfo(SessionInfoCallback action, ref List<SessionI
var structBase = (byte*)providerInstance;
providerInstance = (UnsafeNativeMethods.ManifestEtw.TRACE_PROVIDER_INSTANCE_INFO*)&structBase[providerInstance->NextOffset];
}
#else
#else
#if !ES_BUILD_PCL && PLATFORM_WINDOWS // TODO command arguments don't work on PCL builds...
// This code is only used in the Nuget Package Version of EventSource. because
// the code above is using APIs baned from UWP apps.
Expand Down Expand Up @@ -1276,8 +1296,7 @@ unsafe IntPtr IEventProvider.DefineEventHandle(uint eventID, string eventName, I
}
}

#elif !FEATURE_PERFTRACING

#endif
internal sealed class NoOpEventProvider : IEventProvider
{
unsafe uint IEventProvider.EventRegister(
Expand Down Expand Up @@ -1314,10 +1333,8 @@ int IEventProvider.EventActivityIdControl(UnsafeNativeMethods.ManifestEtw.Activi
// Define an EventPipeEvent handle.
unsafe IntPtr IEventProvider.DefineEventHandle(uint eventID, string eventName, Int64 keywords, uint eventVersion, uint level, byte *pMetadata, uint metadataLength)
{
throw new System.NotSupportedException();
return IntPtr.Zero;
}
}

#endif
}

Loading