diff options
8 files changed, 318 insertions, 0 deletions
diff --git a/clr.coreclr.props b/clr.coreclr.props index ed5dd1a2ec..9211976c39 100644 --- a/clr.coreclr.props +++ b/clr.coreclr.props @@ -50,6 +50,7 @@ <!-- The rejit feature is available only on supported architectures (x86 & x64) --> <FeatureReJIT Condition="('$(TargetArch)' == 'i386') or ('$(TargetArch)' == 'amd64')">true</FeatureReJIT> <FeatureManagedEtw>true</FeatureManagedEtw> + <FeatureManagedEtwChannels>true</FeatureManagedEtwChannels> <BinderDebugLog Condition="'$(_BuildType)'=='dbg'">true</BinderDebugLog> <FeatureAppX>true</FeatureAppX> <FeatureWinMDResilient>true</FeatureWinMDResilient> diff --git a/clr.defines.targets b/clr.defines.targets index c3bb70dbad..689fa06a35 100644 --- a/clr.defines.targets +++ b/clr.defines.targets @@ -40,6 +40,7 @@ <CDefines Condition="'$(FeatureLegacyNetCFDbgHostControl)' == 'true'">$(CDefines);FEATURE_LEGACYNETCF_DBG_HOST_CONTROL</CDefines> <CDefines Condition="'$(FeatureMacl)' == 'true'">$(CDefines);FEATURE_MACL</CDefines> <CDefines Condition="'$(FeatureManagedEtw)' == 'true'">$(CDefines);FEATURE_MANAGED_ETW</CDefines> + <CDefines Condition="'$(FeatureManagedEtwChannels)' == 'true'">$(CDefines);FEATURE_MANAGED_ETW_CHANNELS</CDefines> <CDefines Condition="'$(FeatureMdaSupported)' == 'true'">$(CDefines);MDA_SUPPORTED</CDefines> <CDefines Condition="'$(FeatureMergeCultureSupportAndEngine)' == 'true'">$(CDefines);FEATURE_MERGE_CULTURE_SUPPORT_AND_ENGINE</CDefines> <CDefines Condition="'$(FeatureMergeJitAndEngine)' == 'true'">$(CDefines);FEATURE_MERGE_JIT_AND_ENGINE</CDefines> @@ -117,6 +118,7 @@ <DefineConstants Condition="'$(FeatureIsostoreLight)' == 'true'">$(DefineConstants);FEATURE_ISOSTORE_LIGHT</DefineConstants> <DefineConstants Condition="'$(FeatureMacl)' == 'true'">$(DefineConstants);FEATURE_MACL</DefineConstants> <DefineConstants Condition="'$(FeatureManagedEtw)' == 'true'">$(DefineConstants);FEATURE_MANAGED_ETW</DefineConstants> + <DefineConstants Condition="'$(FeatureManagedEtwChannels)' == 'true'">$(DefineConstants);FEATURE_MANAGED_ETW_CHANNELS</DefineConstants> <DefineConstants Condition="'$(FeatureMultiModuleAssemblies)' == 'true'">$(DefineConstants);FEATURE_MULTIMODULE_ASSEMBLIES</DefineConstants> <DefineConstants Condition="'$(FeatureNongenericCollections)' == 'true'">$(DefineConstants);FEATURE_NONGENERIC_COLLECTIONS</DefineConstants> <DefineConstants Condition="'$(FeaturePal)' == 'true'">$(DefineConstants);FEATURE_PAL</DefineConstants> diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/EventSource.cs b/src/mscorlib/src/System/Diagnostics/Eventing/EventSource.cs index c20e3bdf70..74bd6bb5c7 100644 --- a/src/mscorlib/src/System/Diagnostics/Eventing/EventSource.cs +++ b/src/mscorlib/src/System/Diagnostics/Eventing/EventSource.cs @@ -15,6 +15,7 @@ #endif // !PLATFORM_UNIX #if ES_BUILD_STANDALONE +#define FEATURE_MANAGED_ETW_CHANNELS // #define FEATURE_ADVANCED_MANAGED_ETW_CHANNELS #endif @@ -2346,7 +2347,11 @@ namespace System.Diagnostics.Tracing EventLevel eventLevel = (EventLevel)m_eventData[eventNum].Descriptor.Level; EventKeywords eventKeywords = unchecked((EventKeywords)((ulong)m_eventData[eventNum].Descriptor.Keywords & (~(SessionMask.All.ToEventKeywords())))); +#if FEATURE_MANAGED_ETW_CHANNELS EventChannel channel = unchecked((EventChannel)m_eventData[eventNum].Descriptor.Channel); +#else + EventChannel channel = EventChannel.None; +#endif return IsEnabledCommon(enable, currentLevel, currentMatchAnyKeyword, eventLevel, eventKeywords, channel); } @@ -2364,6 +2369,7 @@ namespace System.Diagnostics.Tracing // if yes, does it pass the keywords test? if (currentMatchAnyKeyword != 0 && eventKeywords != 0) { +#if FEATURE_MANAGED_ETW_CHANNELS // is there a channel with keywords that match currentMatchAnyKeyword? if (eventChannel != EventChannel.None && this.m_channelData != null && this.m_channelData.Length > (int)eventChannel) { @@ -2372,6 +2378,7 @@ namespace System.Diagnostics.Tracing return false; } else +#endif { if ((unchecked((ulong)eventKeywords & (ulong)currentMatchAnyKeyword)) == 0) return false; @@ -3322,7 +3329,11 @@ namespace System.Diagnostics.Tracing } // Collect task, opcode, keyword and channel information +#if FEATURE_MANAGED_ETW_CHANNELS && FEATURE_ADVANCED_MANAGED_ETW_CHANNELS + foreach (var providerEnumKind in new string[] { "Keywords", "Tasks", "Opcodes", "Channels" }) +#else foreach (var providerEnumKind in new string[] { "Keywords", "Tasks", "Opcodes" }) +#endif { Type nestedType = eventSourceType.GetNestedType(providerEnumKind); if (nestedType != null) @@ -3484,6 +3495,7 @@ namespace System.Diagnostics.Tracing // Do checking for user errors (optional, but not a big deal so we do it). DebugCheckEvent(ref eventsByName, eventData, method, eventAttribute, manifest, flags); +#if FEATURE_MANAGED_ETW_CHANNELS // add the channel keyword for Event Viewer channel based filters. This is added for creating the EventDescriptors only // and is not required for the manifest if (eventAttribute.Channel != EventChannel.None) @@ -3493,6 +3505,7 @@ namespace System.Diagnostics.Tracing eventAttribute.Keywords |= (EventKeywords)manifest.GetChannelKeyword(eventAttribute.Channel, (ulong)eventAttribute.Keywords); } } +#endif string eventKey = "event_" + eventName; string msg = manifest.GetLocalizedMessage(eventKey, CultureInfo.CurrentUICulture, etwFormat: false); // overwrite inline message with the localized message @@ -3510,14 +3523,18 @@ namespace System.Diagnostics.Tracing { TrimEventDescriptors(ref eventData); source.m_eventData = eventData; // officially initialize it. We do this at most once (it is racy otherwise). +#if FEATURE_MANAGED_ETW_CHANNELS source.m_channelData = manifest.GetChannelData(); +#endif } // if this is an abstract event source we've already performed all the validation we can if (!eventSourceType.IsAbstract() && (source == null || !source.SelfDescribingEvents)) { bNeedsManifest = (flags & EventManifestOptions.OnlyIfNeededForRegistration) == 0 +#if FEATURE_MANAGED_ETW_CHANNELS || manifest.GetChannelData().Length > 0 +#endif ; // if the manifest is not needed and we're not requested to validate the event source return early @@ -3599,6 +3616,14 @@ namespace System.Diagnostics.Tracing ulong value = unchecked((ulong)(long)staticField.GetRawConstantValue()); manifest.AddKeyword(staticField.Name, value); } +#if FEATURE_MANAGED_ETW_CHANNELS && FEATURE_ADVANCED_MANAGED_ETW_CHANNELS + else if (!reflectionOnly && (staticFieldType == typeof(EventChannel)) || AttributeTypeNamesMatch(staticFieldType, typeof(EventChannel))) + { + if (providerEnumKind != "Channels") goto Error; + var channelAttribute = (EventChannelAttribute)GetCustomAttributeHelper(staticField, typeof(EventChannelAttribute)); + manifest.AddChannel(staticField.Name, (byte)staticField.GetRawConstantValue(), channelAttribute); + } +#endif return; Error: manifest.ManifestError(Resources.GetResourceString("EventSource_EnumKindMismatch", staticField.Name, staticField.FieldType.Name, providerEnumKind)); @@ -3621,7 +3646,11 @@ namespace System.Diagnostics.Tracing eventData[eventAttribute.EventId].Descriptor = new EventDescriptor( eventAttribute.EventId, eventAttribute.Version, +#if FEATURE_MANAGED_ETW_CHANNELS (byte)eventAttribute.Channel, +#else + (byte)0, +#endif (byte)eventAttribute.Level, (byte)eventAttribute.Opcode, (int)eventAttribute.Task, @@ -3881,6 +3910,17 @@ namespace System.Diagnostics.Tracing return -1; } +#if false // This routine is not needed at all, it was used for unit test debugging. + [Conditional("DEBUG")] + private static void OutputDebugString(string msg) + { +#if !ES_BUILD_PCL + msg = msg.TrimEnd('\r', '\n') + + string.Format(CultureInfo.InvariantCulture, ", Thrd({0})" + Environment.NewLine, Thread.CurrentThread.ManagedThreadId); + System.Diagnostics.Debugger.Log(0, null, msg); +#endif + } +#endif /// <summary> /// Sends an error message to the debugger (outputDebugString), as well as the EventListeners @@ -4041,7 +4081,9 @@ namespace System.Diagnostics.Tracing [ThreadStatic] private static bool m_EventSourceInDecodeObject = false; +#if FEATURE_MANAGED_ETW_CHANNELS internal volatile ulong[] m_channelData; +#endif #if FEATURE_ACTIVITYSAMPLING private SessionMask m_curLiveSessions; // the activity-tracing aware sessions' bits @@ -4863,6 +4905,7 @@ namespace System.Diagnostics.Tracing } +#if FEATURE_MANAGED_ETW_CHANNELS /// <summary> /// Gets the channel for the event. /// </summary> @@ -4875,6 +4918,7 @@ namespace System.Diagnostics.Tracing return (EventChannel)m_eventSource.m_eventData[EventId].Descriptor.Channel; } } +#endif /// <summary> /// Gets the version of the event. @@ -5002,8 +5046,10 @@ namespace System.Diagnostics.Tracing /// <summary>Event's task: allows logical grouping of events</summary> public EventTask Task { get; set; } +#if FEATURE_MANAGED_ETW_CHANNELS /// <summary>Event's channel: defines an event log as an additional destination for the event</summary> public EventChannel Channel { get; set; } +#endif /// <summary>Event's version</summary> public byte Version { get; set; } @@ -5046,6 +5092,7 @@ namespace System.Diagnostics.Tracing } // FUTURE we may want to expose this at some point once we have a partner that can help us validate the design. +#if FEATURE_MANAGED_ETW_CHANNELS /// <summary> /// EventChannelAttribute allows customizing channels supported by an EventSource. This attribute must be /// applied to an member of type EventChannel defined in a Channels class nested in the EventSource class: @@ -5061,6 +5108,9 @@ namespace System.Diagnostics.Tracing /// </code> /// </summary> [AttributeUsage(AttributeTargets.Field)] +#if FEATURE_ADVANCED_MANAGED_ETW_CHANNELS + public +#endif class EventChannelAttribute : Attribute { /// <summary> @@ -5073,6 +5123,23 @@ namespace System.Diagnostics.Tracing /// </summary> public EventChannelType EventChannelType { get; set; } +#if FEATURE_ADVANCED_MANAGED_ETW_CHANNELS + /// <summary> + /// Specifies the isolation for the channel + /// </summary> + public EventChannelIsolation Isolation { get; set; } + + /// <summary> + /// Specifies an SDDL access descriptor that controls access to the log file that backs the channel. + /// See MSDN ((http://msdn.microsoft.com/en-us/library/windows/desktop/aa382741.aspx) for details. + /// </summary> + public string Access { get; set; } + + /// <summary> + /// Allows importing channels defined in external manifests + /// </summary> + public string ImportChannel { get; set; } +#endif // TODO: there is a convention that the name is the Provider/Type Should we provide an override? // public string Name { get; set; } @@ -5081,6 +5148,9 @@ namespace System.Diagnostics.Tracing /// <summary> /// Allowed channel types /// </summary> +#if FEATURE_ADVANCED_MANAGED_ETW_CHANNELS + public +#endif enum EventChannelType { /// <summary>The admin channel</summary> @@ -5093,6 +5163,32 @@ namespace System.Diagnostics.Tracing Debug, } +#if FEATURE_ADVANCED_MANAGED_ETW_CHANNELS + /// <summary> + /// Allowed isolation levels. See MSDN (http://msdn.microsoft.com/en-us/library/windows/desktop/aa382741.aspx) + /// for the default permissions associated with each level. EventChannelIsolation and Access allows control over the + /// access permissions for the channel and backing file. + /// </summary> + public + enum EventChannelIsolation + { + /// <summary> + /// This is the default isolation level. All channels that specify Application isolation use the same ETW session + /// </summary> + Application = 1, + /// <summary> + /// All channels that specify System isolation use the same ETW session + /// </summary> + System, + /// <summary> + /// Use sparingly! When specifying Custom isolation, a separate ETW session is created for the channel. + /// Using Custom isolation lets you control the access permissions for the channel and backing file. + /// Because there are only 64 ETW sessions available, you should limit your use of Custom isolation. + /// </summary> + Custom, + } +#endif +#endif /// <summary> /// Describes the pre-defined command (EventCommandEventArgs.Command property) that is passed to the OnEventCommand callback. @@ -5910,7 +6006,9 @@ namespace System.Diagnostics.Tracing public ManifestBuilder(string providerName, Guid providerGuid, string dllName, ResourceManager resources, EventManifestOptions flags) { +#if FEATURE_MANAGED_ETW_CHANNELS this.providerName = providerName; +#endif this.flags = flags; this.resources = resources; @@ -5992,6 +6090,7 @@ namespace System.Diagnostics.Tracing keywordTab[value] = name; } +#if FEATURE_MANAGED_ETW_CHANNELS /// <summary> /// Add a channel. channelAttribute can be null /// </summary> @@ -6061,6 +6160,7 @@ namespace System.Diagnostics.Tracing return channelMask; } +#endif public void StartEvent(string eventName, EventAttribute eventAttribute) { Debug.Assert(numParams == 0); @@ -6086,10 +6186,12 @@ namespace System.Diagnostics.Tracing events.Append(" opcode=\"").Append(GetOpcodeName(eventAttribute.Opcode, eventName)).Append("\""); if (eventAttribute.Task != 0) events.Append(" task=\"").Append(GetTaskName(eventAttribute.Task, eventName)).Append("\""); +#if FEATURE_MANAGED_ETW_CHANNELS if (eventAttribute.Channel != 0) { events.Append(" channel=\"").Append(GetChannelName(eventAttribute.Channel, eventName, eventAttribute.Message)).Append("\""); } +#endif } public void AddEventParameter(Type type, string name) @@ -6155,6 +6257,7 @@ namespace System.Diagnostics.Tracing byteArrArgIndices = null; } +#if FEATURE_MANAGED_ETW_CHANNELS // Channel keywords are generated one per channel to allow channel based filtering in event viewer. These keywords are autogenerated // by mc.exe for compiling a manifest and are based on the order of the channels (fields) in the Channels inner class (when advanced // channel support is enabled), or based on the order the predefined channels appear in the EventAttribute properties (for simple @@ -6194,6 +6297,7 @@ namespace System.Diagnostics.Tracing return channelKeyword; } +#endif public byte[] CreateManifest() { @@ -6221,6 +6325,7 @@ namespace System.Diagnostics.Tracing private string CreateManifestString() { +#if FEATURE_MANAGED_ETW_CHANNELS // Write out the channels if (channelTab != null) { @@ -6237,12 +6342,26 @@ namespace System.Diagnostics.Tracing string elementName = "channel"; bool enabled = false; string fullName = null; +#if FEATURE_ADVANCED_MANAGED_ETW_CHANNELS + string isolation = null; + string access = null; +#endif if (channelInfo.Attribs != null) { var attribs = channelInfo.Attribs; if (Enum.IsDefined(typeof(EventChannelType), attribs.EventChannelType)) channelType = attribs.EventChannelType.ToString(); enabled = attribs.Enabled; +#if FEATURE_ADVANCED_MANAGED_ETW_CHANNELS + if (attribs.ImportChannel != null) + { + fullName = attribs.ImportChannel; + elementName = "importChannel"; + } + if (Enum.IsDefined(typeof(EventChannelIsolation), attribs.Isolation)) + isolation = attribs.Isolation.ToString(); + access = attribs.Access; +#endif } if (fullName == null) fullName = providerName + "/" + channelInfo.Name; @@ -6257,11 +6376,18 @@ namespace System.Diagnostics.Tracing if (channelType != null) sb.Append(" type=\"").Append(channelType).Append("\""); sb.Append(" enabled=\"").Append(enabled.ToString().ToLower()).Append("\""); +#if FEATURE_ADVANCED_MANAGED_ETW_CHANNELS + if (access != null) + sb.Append(" access=\"").Append(access).Append("\""); + if (isolation != null) + sb.Append(" isolation=\"").Append(isolation).Append("\""); +#endif } sb.Append("/>").AppendLine(); } sb.Append(" </channels>").AppendLine(); } +#endif // Write out the tasks if (taskTab != null) @@ -6484,6 +6610,7 @@ namespace System.Diagnostics.Tracing return (((int)level >= 16) ? "" : "win:") + level.ToString(); } +#if FEATURE_MANAGED_ETW_CHANNELS private string GetChannelName(EventChannel channel, string eventName, string eventMessage) { ChannelInfo info = null; @@ -6512,6 +6639,7 @@ namespace System.Diagnostics.Tracing ManifestError(Resources.GetResourceString("EventSource_EventWithAdminChannelMustHaveMessage", eventName, info.Name)); return info.Name; } +#endif private string GetTaskName(EventTask task, string eventName) { if (task == EventTask.None) @@ -6707,21 +6835,26 @@ namespace System.Diagnostics.Tracing return idx + 1; } +#if FEATURE_MANAGED_ETW_CHANNELS class ChannelInfo { public string Name; public ulong Keywords; public EventChannelAttribute Attribs; } +#endif Dictionary<int, string> opcodeTab; Dictionary<int, string> taskTab; +#if FEATURE_MANAGED_ETW_CHANNELS Dictionary<int, ChannelInfo> channelTab; +#endif Dictionary<ulong, string> keywordTab; Dictionary<string, Type> mapsTab; Dictionary<string, string> stringTab; // Maps unlocalized strings to localized ones +#if FEATURE_MANAGED_ETW_CHANNELS // WCF used EventSource to mimic a existing ETW manifest. To support this // in just their case, we allowed them to specify the keywords associated // with their channels explicitly. ValidPredefinedChannelKeywords is @@ -6730,12 +6863,15 @@ namespace System.Diagnostics.Tracing internal const ulong ValidPredefinedChannelKeywords = 0xF000000000000000; ulong nextChannelKeywordBit = 0x8000000000000000; // available Keyword bit to be used for next channel definition, grows down const int MaxCountChannels = 8; // a manifest can defined at most 8 ETW channels +#endif StringBuilder sb; // Holds the provider information. StringBuilder events; // Holds the events. StringBuilder templates; +#if FEATURE_MANAGED_ETW_CHANNELS string providerName; +#endif ResourceManager resources; // Look up localized strings here. EventManifestOptions flags; IList<string> errors; // list of currently encountered errors diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/EventFieldFormat.cs b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/EventFieldFormat.cs index 297b06334d..fd77b07965 100644 --- a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/EventFieldFormat.cs +++ b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/EventFieldFormat.cs @@ -20,6 +20,12 @@ namespace System.Diagnostics.Tracing /// Field receives default formatting based on the field's underlying type. /// </summary> Default = 0, +#if false + /// <summary> + /// Field should not be displayed. + /// </summary> + NoPrint = 1, +#endif /// <summary> /// Field should be formatted as character or string data. /// Typically applied to 8-bit or 16-bit integers. @@ -39,6 +45,40 @@ namespace System.Diagnostics.Tracing /// </summary> Hexadecimal = 4, +#if false + /// <summary> + /// Field should be formatted as a process identifier. Typically applied to + /// 32-bit integer types. + /// </summary> + ProcessId = 5, + + /// <summary> + /// Field should be formatted as a thread identifier. Typically applied to + /// 32-bit integer types. + /// </summary> + ThreadId = 6, + + /// <summary> + /// Field should be formatted as an Internet port. Typically applied to 16-bit integer + /// types. + /// </summary> + Port = 7, + /// <summary> + /// Field should be formatted as an Internet Protocol v4 address. Typically applied to + /// 32-bit integer types. + /// </summary> + Ipv4Address = 8, + + /// <summary> + /// Field should be formatted as an Internet Protocol v6 address. Typically applied to + /// byte[] types. + /// </summary> + Ipv6Address = 9, + /// <summary> + /// Field should be formatted as a SOCKADDR. Typically applied to byte[] types. + /// </summary> + SocketAddress = 10, +#endif /// <summary> /// Field should be formatted as XML string data. Typically applied to /// strings or arrays of 8-bit or 16-bit integers. @@ -50,10 +90,41 @@ namespace System.Diagnostics.Tracing /// strings or arrays of 8-bit or 16-bit integers. /// </summary> Json = 12, +#if false + /// <summary> + /// Field should be formatted as a Win32 error code. Typically applied to + /// 32-bit integer types. + /// </summary> + Win32Error = 13, + + /// <summary> + /// Field should be formatted as an NTSTATUS code. Typically applied to + /// 32-bit integer types. + /// </summary> + NTStatus = 14, +#endif /// <summary> /// Field should be formatted as an HRESULT code. Typically applied to /// 32-bit integer types. /// </summary> HResult = 15, +#if false + /// <summary> + /// Field should be formatted as a FILETIME. Typically applied to 64-bit + /// integer types. This is the default format for DateTime types. + /// </summary> + FileTime = 16, + /// <summary> + /// When applied to a numeric type, indicates that the type should be formatted + /// as a signed integer. This is the default format for signed integer types. + /// </summary> + Signed = 17, + + /// <summary> + /// When applied to a numeric type, indicates that the type should be formatted + /// as an unsigned integer. This is the default format for unsigned integer types. + /// </summary> + Unsigned = 18, +#endif } } diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/Statics.cs b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/Statics.cs index c92937caee..516c8ba19a 100644 --- a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/Statics.cs +++ b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/Statics.cs @@ -211,6 +211,12 @@ namespace System.Diagnostics.Tracing return TraceLoggingDataType.Boolean8; case EventFieldFormat.Hexadecimal: return TraceLoggingDataType.HexInt8; +#if false + case EventSourceFieldFormat.Signed: + return TraceLoggingDataType.Int8; + case EventSourceFieldFormat.Unsigned: + return TraceLoggingDataType.UInt8; +#endif default: return MakeDataType(native, format); } @@ -234,6 +240,14 @@ namespace System.Diagnostics.Tracing return TraceLoggingDataType.Char16; case EventFieldFormat.Hexadecimal: return TraceLoggingDataType.HexInt16; +#if false + case EventSourceFieldFormat.Port: + return TraceLoggingDataType.Port; + case EventSourceFieldFormat.Signed: + return TraceLoggingDataType.Int16; + case EventSourceFieldFormat.Unsigned: + return TraceLoggingDataType.UInt16; +#endif default: return MakeDataType(native, format); } @@ -257,8 +271,26 @@ namespace System.Diagnostics.Tracing return TraceLoggingDataType.Boolean32; case EventFieldFormat.Hexadecimal: return TraceLoggingDataType.HexInt32; +#if false + case EventSourceFieldFormat.Ipv4Address: + return TraceLoggingDataType.Ipv4Address; + case EventSourceFieldFormat.ProcessId: + return TraceLoggingDataType.ProcessId; + case EventSourceFieldFormat.ThreadId: + return TraceLoggingDataType.ThreadId; + case EventSourceFieldFormat.Win32Error: + return TraceLoggingDataType.Win32Error; + case EventSourceFieldFormat.NTStatus: + return TraceLoggingDataType.NTStatus; +#endif case EventFieldFormat.HResult: return TraceLoggingDataType.HResult; +#if false + case EventSourceFieldFormat.Signed: + return TraceLoggingDataType.Int32; + case EventSourceFieldFormat.Unsigned: + return TraceLoggingDataType.UInt32; +#endif default: return MakeDataType(native, format); } @@ -280,6 +312,14 @@ namespace System.Diagnostics.Tracing return native; case EventFieldFormat.Hexadecimal: return TraceLoggingDataType.HexInt64; +#if false + case EventSourceFieldFormat.FileTime: + return TraceLoggingDataType.FileTime; + case EventSourceFieldFormat.Signed: + return TraceLoggingDataType.Int64; + case EventSourceFieldFormat.Unsigned: + return TraceLoggingDataType.UInt64; +#endif default: return MakeDataType(native, format); } @@ -301,6 +341,12 @@ namespace System.Diagnostics.Tracing return native; case EventFieldFormat.Hexadecimal: return HexIntPtrType; +#if false + case EventSourceFieldFormat.Signed: + return IntPtrType; + case EventSourceFieldFormat.Unsigned: + return UIntPtrType; +#endif default: return MakeDataType(native, format); } diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingDataType.cs b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingDataType.cs index b396031fe5..529948daf8 100644 --- a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingDataType.cs +++ b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingDataType.cs @@ -226,6 +226,49 @@ namespace System.Diagnostics.Tracing /// </summary> HexInt16 = UInt16 + (EventFieldFormat.Hexadecimal << 8), +#if false + /// <summary> + /// Formatted type. + /// Encoding assumes 32-bit value. + /// Decoding treats as process identifier. + /// </summary> + ProcessId = UInt32 + (EventSourceFieldFormat.ProcessId << 8), + + /// <summary> + /// Formatted type. + /// Encoding assumes 32-bit value. + /// Decoding treats as thread identifier. + /// </summary> + ThreadId = UInt32 + (EventSourceFieldFormat.ThreadId << 8), + + /// <summary> + /// Formatted type. + /// Encoding assumes 16-bit value. + /// Decoding treats as IP port. + /// </summary> + Port = UInt16 + (EventSourceFieldFormat.Port << 8), + + /// <summary> + /// Formatted type. + /// Encoding assumes 32-bit value. + /// Decoding treats as IPv4 address. + /// </summary> + Ipv4Address = UInt32 + (EventSourceFieldFormat.Ipv4Address << 8), + + /// <summary> + /// Formatted type. + /// Encoding assumes 16-bit bytecount followed by binary data. + /// Decoding treats as IPv6 address. + /// </summary> + Ipv6Address = Binary + (EventSourceFieldFormat.Ipv6Address << 8), + + /// <summary> + /// Formatted type. + /// Encoding assumes 16-bit bytecount followed by binary data. + /// Decoding treats as SOCKADDR. + /// </summary> + SocketAddress = Binary + (EventSourceFieldFormat.SocketAddress << 8), +#endif /// <summary> /// Formatted type. /// Encoding assumes null-terminated Char16 string. @@ -281,6 +324,21 @@ namespace System.Diagnostics.Tracing /// Decoding treats as MBCS JSON. /// </summary> CountedMbcsJson = CountedMbcsString + (EventFieldFormat.Json << 8), +#if false + /// <summary> + /// Formatted type. + /// Encoding assumes 32-bit value. + /// Decoding treats as Win32 error. + /// </summary> + Win32Error = UInt32 + (EventSourceFieldFormat.Win32Error << 8), + + /// <summary> + /// Formatted type. + /// Encoding assumes 32-bit value. + /// Decoding treats as NTSTATUS. + /// </summary> + NTStatus = UInt32 + (EventSourceFieldFormat.NTStatus << 8), +#endif /// <summary> /// Formatted type. /// Encoding assumes 32-bit value. diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingEventSource.cs b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingEventSource.cs index 28a93f4a61..07a56751ea 100644 --- a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingEventSource.cs +++ b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingEventSource.cs @@ -14,6 +14,7 @@ #endif // PLATFORM_UNIX #if ES_BUILD_STANDALONE +#define FEATURE_MANAGED_ETW_CHANNELS // #define FEATURE_ADVANCED_MANAGED_ETW_CHANNELS #endif diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/Winmeta.cs b/src/mscorlib/src/System/Diagnostics/Eventing/Winmeta.cs index d8689b610f..c93e745173 100644 --- a/src/mscorlib/src/System/Diagnostics/Eventing/Winmeta.cs +++ b/src/mscorlib/src/System/Diagnostics/Eventing/Winmeta.cs @@ -10,6 +10,9 @@ ** environment. ** ============================================================*/ +#if ES_BUILD_STANDALONE +#define FEATURE_MANAGED_ETW_CHANNELS +#endif #if ES_BUILD_STANDALONE namespace Microsoft.Diagnostics.Tracing |