Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Enable XplatEventLogger on all non-Windows platforms
Browse files Browse the repository at this point in the history
Ensure that even if FEATURE_EVENTSOURCE_XPLAT is not defined it, the
implementation provides a dummy implementation. This is required because
mscorlib defines FEATURE_EVENTSOURCE_XPLAT even if this is not supported
by the underlying platform. Ensure XplatEventLogger.cs is always included
  • Loading branch information
Manu committed Mar 23, 2016
1 parent 7996012 commit 5296a59
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/inc/eventtracebase.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ extern BOOL g_fEEIJWStartup;
}
};

#endif //defined(FEATURE_EVENT_TRACE)
#endif //defined(FEATURE_EVENT_TRACE) || defined(FEATURE_EVENTSOURCE_XPLAT)

#if defined(FEATURE_EVENT_TRACE)

Expand Down
2 changes: 1 addition & 1 deletion src/mscorlib/mscorlib.shared.sources.props
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@
<DiagnosticsSources Include="$(BclSourcesRoot)\System\Diagnostics\Eventing\EventProvider.cs" />
<DiagnosticsSources Include="$(BclSourcesRoot)\System\Diagnostics\Eventing\EventSource.cs" />
<DiagnosticsSources Include="$(BclSourcesRoot)\System\Diagnostics\Eventing\EventSource_CoreCLR.cs" />
<DiagnosticsSources Condition="'$(FeatureXplatEventSource)' == 'true'" Include="$(BclSourcesRoot)\System\Diagnostics\Eventing\XplatEventLogger.cs" />
<DiagnosticsSources Include="$(BclSourcesRoot)\System\Diagnostics\Eventing\XplatEventLogger.cs" />
<DiagnosticsSources Include="$(BclSourcesRoot)\System\Diagnostics\Eventing\EventSourceException.cs" />
<DiagnosticsSources Include="$(BclSourcesRoot)\System\Diagnostics\Eventing\FrameworkEventSource.cs" />
<DiagnosticsSources Include="$(BclSourcesRoot)\System\Diagnostics\Eventing\StubEnvironment.cs" />
Expand Down
4 changes: 2 additions & 2 deletions src/mscorlib/src/System/Diagnostics/Eventing/EventSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,9 @@ namespace System.Diagnostics.Tracing
public partial class EventSource : IDisposable
{

#if FEATURE_EVENTSOURCE_XPLAT
#if FEATURE_PAL
private static readonly EventListener persistent_Xplat_Listener = XplatEventLogger.InitializePersistentListener();
#endif //FEATURE_EVENTSOURCE_XPLAT
#endif //FEATURE_PAL

/// <summary>
/// The human-friendly name of the eventSource. It defaults to the simple name of the class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

using Contract = System.Diagnostics.Contracts.Contract;

#if FEATURE_EVENTSOURCE_XPLAT
#if FEATURE_PAL

namespace System.Diagnostics.Tracing
{
Expand Down Expand Up @@ -149,4 +149,4 @@ private void LogOnEventWritten(EventWrittenEventArgs eventData)
}
}
}
#endif //FEATURE_EVENTSOURCE_XPLAT
#endif //FEATURE_PAL
8 changes: 4 additions & 4 deletions src/vm/ecalllist.h
Original file line number Diff line number Diff line change
Expand Up @@ -2091,12 +2091,12 @@ FCFuncStart(gWindowsRuntimeBufferHelperFuncs)
FCFuncEnd()
#endif // ifdef FEATURE_COMINTEROP

#if defined(FEATURE_EVENTSOURCE_XPLAT)
#ifdef FEATURE_PAL
FCFuncStart(gEventLogger)
QCFuncElement("IsEventSourceLoggingEnabled", XplatEventSourceLogger::IsEventSourceLoggingEnabled)
QCFuncElement("LogEventSource", XplatEventSourceLogger::LogEventSource)
FCFuncEnd()
#endif // defined(FEATURE_EVENTSOURCE_XPLAT)
#endif //FEATURE_PAL

#ifdef FEATURE_COMINTEROP
FCFuncStart(gRuntimeClassFuncs)
Expand Down Expand Up @@ -2490,9 +2490,9 @@ FCClassElement("WindowsRuntimeMetadata", "System.Runtime.InteropServices.Windows
#ifdef FEATURE_X509
FCClassElement("X509Utils", "System.Security.Cryptography.X509Certificates", gX509CertificateFuncs)
#endif // FEATURE_X509
#if defined(FEATURE_EVENTSOURCE_XPLAT)
#ifdef FEATURE_PAL
FCClassElement("XplatEventLogger", "System.Diagnostics.Tracing", gEventLogger)
#endif //defined(FEATURE_EVENTSOURCE_XPLAT)
#endif //FEATURE_PAL
#ifdef FEATURE_CAS_POLICY
FCClassElement("Zone", "System.Security.Policy", gCOMSecurityZone)
#endif // FEATURE_CAS_POLICY
Expand Down
13 changes: 10 additions & 3 deletions src/vm/eventtracepriv.h
Original file line number Diff line number Diff line change
Expand Up @@ -408,13 +408,20 @@ class BulkStaticsLogger

#endif // __EVENTTRACEPRIV_H__

#if defined(FEATURE_EVENTSOURCE_XPLAT)
#ifdef FEATURE_PAL

class XplatEventSourceLogger
{
public:
#ifdef FEATURE_EVENTSOURCE_XPLAT
static void QCALLTYPE LogEventSource(__in_z int eventID, __in_z LPCWSTR eventName, __in_z LPCWSTR eventSourceName, __in_z LPCWSTR payload);

static BOOL QCALLTYPE IsEventSourceLoggingEnabled();
#else
static void QCALLTYPE LogEventSource(__in_z int eventID, __in_z LPCWSTR eventName, __in_z LPCWSTR eventSourceName, __in_z LPCWSTR payload) {};
static BOOL QCALLTYPE IsEventSourceLoggingEnabled() { return false; };
#endif


};

#endif //defined(FEATURE_EVENTSOURCE_XPLAT)
#endif // FEATURE_PAL
6 changes: 3 additions & 3 deletions src/vm/mscorlib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@
#include "windowsruntimebufferhelper.h"
#endif

#if defined(FEATURE_EVENTSOURCE_XPLAT)

#ifdef FEATURE_PAL
// Only include definition for XplatEventSourceLogger
#define __EVENTTRACEPRIV_H__
#include "eventtracepriv.h"
#undef __EVENTTRACEPRIV_H__
#endif //defined(FEATURE_EVENTSOURCE_XPLAT)
#endif // FEATURE_PAL

#endif // CROSSGEN_MSCORLIB

Expand Down

0 comments on commit 5296a59

Please sign in to comment.