// This program uses code hyperlinks available as part of the HyperAddin Visual Studio plug-in.
// It is available from http://www.codeplex.com/hyperAddin
+#if !PLATFORM_UNIX
#define FEATURE_MANAGED_ETW
#if !ES_BUILD_STANDALONE
#define FEATURE_ACTIVITYSAMPLING
#endif
+#endif // PLATFORM_UNIX
#if ES_BUILD_STANDALONE
#define FEATURE_MANAGED_ETW_CHANNELS
{
public partial class EventSource
{
+#if FEATURE_MANAGED_ETW
private byte[] providerMetadata;
+#endif
/// <summary>
/// Construct an EventSource with a given name for non-contract based events (e.g. those using the Write() API).
Guid* childActivityID,
params object[] values)
{
+#if FEATURE_MANAGED_ETW
int identity = 0;
byte level = (options.valuesSet & EventSourceOptions.levelSet) != 0
? options.level
this.WriteCleanup(pins, pinCount);
}
}
-
+#endif // FEATURE_MANAGED_ETW
}
/// <summary>
Guid* childActivityID,
EventData* data)
{
+#if FEATURE_MANAGED_ETW
if (!this.IsEnabled())
{
return;
(IntPtr)descriptors);
}
}
+#endif // FEATURE_MANAGED_ETW
}
[SecuritySafeCritical]
return;
}
+#if FEATURE_MANAGED_ETW
var pinCount = eventTypes.pinCount;
var scratch = stackalloc byte[eventTypes.scratchSize];
var descriptors = stackalloc EventData[eventTypes.dataCount + 3];
descriptors[0].SetMetadata(pMetadata0, this.providerMetadata.Length, 2);
descriptors[1].SetMetadata(pMetadata1, nameInfo.nameMetadata.Length, 1);
descriptors[2].SetMetadata(pMetadata2, eventTypes.typeMetadata.Length, 1);
+#endif // FEATURE_MANAGED_ETW
#if (!ES_BUILD_PCL && !PROJECTN)
System.Runtime.CompilerServices.RuntimeHelpers.PrepareConstrainedRegions();
try
{
+#if FEATURE_MANAGED_ETW
DataCollector.ThreadInstance.Enable(
scratch,
eventTypes.scratchSize,
pRelatedActivityId,
(int)(DataCollector.ThreadInstance.Finish() - descriptors),
(IntPtr)descriptors);
+#endif // FEATURE_MANAGED_ETW
// TODO enable filtering for listeners.
if (m_Dispatchers != null)
else
ThrowEventSourceException(eventName, ex);
}
+#if FEATURE_MANAGED_ETW
finally
{
this.WriteCleanup(pins, pinCount);
}
}
+#endif // FEATURE_MANAGED_ETW
}
}
catch (Exception ex)
private void InitializeProviderMetadata()
{
+#if FEATURE_MANAGED_ETW
if (m_traits != null)
{
List<byte> traitMetaData = new List<byte>(100);
}
else
providerMetadata = Statics.MetadataForString(this.Name, 0, 0, 0);
+#endif //FEATURE_MANAGED_ETW
}
private static int AddValueToMetaData(List<byte> metaData, string value)