Imported Upstream version 5.4.0.167

Former-commit-id: 5624ac747d633e885131e8349322922b6a59baaa
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-08-21 15:34:15 +00:00
parent e49d6f06c0
commit 536cd135cc
12856 changed files with 563812 additions and 223249 deletions

View File

@@ -1,7 +1,12 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
# Visual Studio 15
VisualStudioVersion = 15.0.26430.12
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{90DA2470-329A-4DD0-95B3-F00D42DD9137}"
ProjectSection(SolutionItems) = preProject
documentation\EventCounterTutorial.md = documentation\EventCounterTutorial.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Diagnostics.Tracing.Tests", "tests\System.Diagnostics.Tracing.Tests.csproj", "{7E0E1B11-FF70-461E-99F7-C0AF252C0C60}"
ProjectSection(ProjectDependencies) = postProject
{EB880FDC-326D-42B3-A3FD-0CD3BA29A7F4} = {EB880FDC-326D-42B3-A3FD-0CD3BA29A7F4}
@@ -26,10 +31,10 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7E0E1B11-FF70-461E-99F7-C0AF252C0C60}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU
{7E0E1B11-FF70-461E-99F7-C0AF252C0C60}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU
{7E0E1B11-FF70-461E-99F7-C0AF252C0C60}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU
{7E0E1B11-FF70-461E-99F7-C0AF252C0C60}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU
{7E0E1B11-FF70-461E-99F7-C0AF252C0C60}.Debug|Any CPU.ActiveCfg = netcoreapp-Debug|Any CPU
{7E0E1B11-FF70-461E-99F7-C0AF252C0C60}.Debug|Any CPU.Build.0 = netcoreapp-Debug|Any CPU
{7E0E1B11-FF70-461E-99F7-C0AF252C0C60}.Release|Any CPU.ActiveCfg = netcoreapp-Release|Any CPU
{7E0E1B11-FF70-461E-99F7-C0AF252C0C60}.Release|Any CPU.Build.0 = netcoreapp-Release|Any CPU
{EB880FDC-326D-42B3-A3FD-0CD3BA29A7F4}.Debug|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
{EB880FDC-326D-42B3-A3FD-0CD3BA29A7F4}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
{EB880FDC-326D-42B3-A3FD-0CD3BA29A7F4}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU

View File

@@ -2,8 +2,10 @@
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\dir.props" />
<PropertyGroup>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyKey>MSFT</AssemblyKey>
<IsNETCoreApp>true</IsNETCoreApp>
<IsUAP>true</IsUAP>
<IsNetFxNETStandard>true</IsNetFxNETStandard>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,71 @@
<h1>Introduction Tutorial: How to measure performance for very frequent events using EventCounters</h1>
<p>While EventSource is fast, logging too many events for very frequent events is still a performance hit. In this tutorial, we will introduce EventCounter, a mechanism for measuring performance for very frequent events.</p>
<p>For event that happen very frequently (for example, if it happen every few milliseconds), in general, you will want the performance overhead per event to be very low (e.g. less than a millisecond), otherwise it is going to cost a significant performance overhead. Logging an event, at the end of the day, need to write something to the disk. If the disk is not fast enough, you will lost events. We need a solution other than logging the event itself.</p>
<p>When dealing with large number of events, knowing the measure per event is not very useful either. Most of the time all we need is just some statistics out of it. So we could crank the statistics within the process itself and then write an event once in a while to report the statistics, that's what EventCounter will do for us. Let's take a look at an example how to do this in Microsoft.Diagnostics.Tracing.EventSource</p>
<p>In the sequel, we assume you are familiar with the basic EventSource usage, if you don't, please refer to <a href="http://blogs.msdn.com/b/vancem/archive/2012/07/09/logging-your-own-etw-events-in-c-system-diagnostics-tracing-eventsource.aspx">Vance's excellent blog</a> on that.</p>
<p>Without further ado, here is an example on how to use the EventCounter</p>
<pre><code>// Give your event sources a descriptive name using the EventSourceAttribute, otherwise the name of the class is used.
[EventSource(Name = "Samples-EventCounterDemos-Minimal")]
public sealed class MinimalEventCounterSource : EventSource
{
// define the singleton instance of the event source
public static MinimalEventCounterSource Log = new MinimalEventCounterSource();
private EventCounter requestCounter;
private MinimalEventCounterSource()
{
this.requestCounter = new EventCounter("request", this);
}
/// &lt;summary&gt;
/// Call this method to indicate that a request for a URL was made which tool a particular amount of time
public void Request(string url, float elapsedMSec)
{
// Notes:
// 1. the event ID passed to WriteEvent (1) corresponds to the (implied) event ID
// assigned to this method. The event ID could have been explicitly declared
// using an EventAttribute for this method
// 2. Each counter supports a single float value, so conceptually it maps to a single
// measurement in the code.
// 3. You don't have to have
WriteEvent(1, url, elapsedMSec); // This logs it to the event stream if events are on.
this.requestCounter.WriteMetric(elapsedMSec); // This adds it to the PerfCounter called 'Request' if PerfCounters are on
}
}
</code></pre>
<p>The WriteEvent line is the EventSource part and is not part of EventCounter, it is shown to show that you can log a message together with the event counter.</p>
<p>So, with that, we logged the metric to the EventCounter, but unless we can actually get the statistics out of it, it is not useful. To get the statistics, we need to enable the EventCounter by setting off a timer how frequently we want the events, as well as a listener to capture the events, to do that, you can use PerfView. Again, we assumed familiarity with PerfView, if not, you can refer to Vance's blog on that.</p>
<p>There is an extra keyword that you will need to specify the turn on the EventCounters.</p>
<p><code>PerfView /onlyProviders=*Samples-EventCounterDemos-Minimal:**EventCounterIntervalSec=1** collect</code></p>
<p>Note the bold part about EventCounterIntervalSec, that indicate the frequency of the sampling.</p>
<p>As usual, turn on PerfView, and then run the sample code, we will have something like this</p>
<p><img src="PerfViewCapture_Counters.png" alt="PerfView Capture of EventCounter traces" title="PerfView Capture of EventCounter traces" /></p>
<p>Now let's drill into what the data captured meant - when I copied from PerfView, it looks like this</p>
<p>Payload="{ Name="request", Mean=51.66667, StandardDerivation=34.37376, Count=3, Min=23, Max=100, IntervalSec=1.038177 }" </p>
<p>Now it is obvious that within a sampling period, we have 5 events, and all the other statistics.</p>
<p>Notice that, this command also log the events, so we will get both the events and the counter statistics.</p>
<p><img src="PerfViewCapture_Events.png" alt="PerfView Capture of Event Traces" title="PerfView Capture of Event Traces" /></p>
<p>As we mentioned, to avoid overhead, sometimes we will want just the counters. This command can be used to log <em>only</em> the counters:</p>
<p><code>PerfView /onlyProviders=*Samples-EventCounterDemos-Minimal:*:Critical:EventCounterIntervalSec=1 collect</code></p>
<p>Notice the 'Critical' keyword in the command line, that is used to filter out the other events with lower priorities.</p>

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

View File

@@ -4,6 +4,7 @@
<BuildConfigurations>
netcoreapp;
uap;
netfx;
</BuildConfigurations>
</PropertyGroup>
</Project>

View File

@@ -116,6 +116,10 @@ namespace System.Diagnostics.Tracing
}
public abstract partial class EventListener : System.IDisposable
{
#if FEATURE_ETLEVENTS
public event EventHandler<EventSourceCreatedEventArgs> EventSourceCreated;
public event EventHandler<EventWrittenEventArgs> EventWritten;
#endif
protected EventListener() { }
public void DisableEvents(System.Diagnostics.Tracing.EventSource eventSource) { }
public virtual void Dispose() { }
@@ -124,7 +128,11 @@ namespace System.Diagnostics.Tracing
public void EnableEvents(System.Diagnostics.Tracing.EventSource eventSource, System.Diagnostics.Tracing.EventLevel level, System.Diagnostics.Tracing.EventKeywords matchAnyKeyword, System.Collections.Generic.IDictionary<string, string> arguments) { }
protected static int EventSourceIndex(System.Diagnostics.Tracing.EventSource eventSource) { throw null; }
protected internal virtual void OnEventSourceCreated(System.Diagnostics.Tracing.EventSource eventSource) { }
#if FEATURE_ETLEVENTS
protected internal virtual void OnEventWritten(System.Diagnostics.Tracing.EventWrittenEventArgs eventData) { }
#else
protected internal abstract void OnEventWritten(System.Diagnostics.Tracing.EventWrittenEventArgs eventData);
#endif
}
[System.FlagsAttribute]
public enum EventManifestOptions
@@ -227,6 +235,13 @@ namespace System.Diagnostics.Tracing
public string LocalizationResources { get { throw null; } set { } }
public string Name { get { throw null; } set { } }
}
#if FEATURE_ETLEVENTS
public class EventSourceCreatedEventArgs : EventArgs
{
public EventSourceCreatedEventArgs() { }
public EventSource EventSource { get; }
}
#endif
public partial class EventSourceException : System.Exception
{
public EventSourceException() { }

View File

@@ -4,16 +4,23 @@
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ProjectGuid>{0D8C8BAE-E5A5-4E9F-B101-3D18BD81D261}</ProjectGuid>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'netfx'">true</IsPartialFacadeAssembly>
<DefineConstants Condition="'$(TargetGroup)' == 'netcoreapp'">$(DefineConstants);FEATURE_ETLEVENTS</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netfx-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netfx-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Release|AnyCPU'" />
<ItemGroup>
<Compile Include="System.Diagnostics.Tracing.cs" />
</ItemGroup>
<ItemGroup>
<ItemGroup Condition="'$(TargetGroup)' != 'netfx'">
<ProjectReference Include="..\..\System.Runtime\ref\System.Runtime.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(TargetGroup)' == 'netfx'">
<Reference Include="mscorlib" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>

View File

@@ -0,0 +1,4 @@
Compat issues with assembly System.Diagnostics.Tracing:
MembersMustExist : Member 'System.Diagnostics.Tracing.EventSource.add_EventCommandExecuted(System.EventHandler<System.Diagnostics.Tracing.EventCommandEventArgs>)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'System.Diagnostics.Tracing.EventSource.remove_EventCommandExecuted(System.EventHandler<System.Diagnostics.Tracing.EventCommandEventArgs>)' does not exist in the implementation but it does exist in the contract.
Total Issues: 2

View File

@@ -1,27 +0,0 @@
Compat issues with assembly System.Diagnostics.Tracing:
TypesMustExist : Type 'System.Diagnostics.Tracing.EventActivityOptions' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Diagnostics.Tracing.EventAttribute' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Diagnostics.Tracing.EventChannel' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Diagnostics.Tracing.EventCommand' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Diagnostics.Tracing.EventCommandEventArgs' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Diagnostics.Tracing.EventCounter' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Diagnostics.Tracing.EventDataAttribute' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Diagnostics.Tracing.EventFieldAttribute' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Diagnostics.Tracing.EventFieldFormat' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Diagnostics.Tracing.EventFieldTags' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Diagnostics.Tracing.EventIgnoreAttribute' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Diagnostics.Tracing.EventKeywords' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Diagnostics.Tracing.EventLevel' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Diagnostics.Tracing.EventListener' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Diagnostics.Tracing.EventManifestOptions' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Diagnostics.Tracing.EventOpcode' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Diagnostics.Tracing.EventSource' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Diagnostics.Tracing.EventSourceAttribute' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Diagnostics.Tracing.EventSourceException' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Diagnostics.Tracing.EventSourceOptions' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Diagnostics.Tracing.EventSourceSettings' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Diagnostics.Tracing.EventTags' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Diagnostics.Tracing.EventTask' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Diagnostics.Tracing.EventWrittenEventArgs' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Diagnostics.Tracing.NonEventAttribute' does not exist in the implementation but it does exist in the contract.
Total Issues: 25

View File

@@ -6,6 +6,7 @@
uapaot-Windows_NT;
netcoreapp-Windows_NT;
netcoreapp-Unix;
netfx-Windows_NT;
</BuildConfigurations>
</PropertyGroup>
</Project>

View File

@@ -1,3 +1,7 @@
// 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.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("Microsoft.Reliability", "CA2002:DoNotLockOnObjectsWithWeakIdentity", Scope = "member", Target = "System.Diagnostics.Tracing.EventCounter.#Enqueue(System.Single)")]

View File

@@ -1,67 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="ArgumentOutOfRange_NeedNonNegNum" xml:space="preserve">
<value>Non-negative number required.</value>
</data>
<data name="ArgumentOutOfRange_NeedPosNum" xml:space="preserve">
<value>Positive number required.</value>
</data>
</root>

View File

@@ -1,23 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
<Library Name="*System.Diagnostics.Tracing*">
<Assembly Name="System.Diagnostics.Tracing">
<Namespace Name="System.Diagnostics.Tracing">
<Type Name="EventSourceAttribute" Dynamic="Required All">
<AttributeImplies Serialize="Required Public"/>
</Type>
<Type Name="EventDataAttribute" Dynamic="Required All">
<AttributeImplies Serialize="Required Public"/>
</Type>
<Type Name="EventAttribute" Dynamic="Required All"/>
<Type Name="EventSource">
<Method Name="Write{T}">
<GenericParameter Name="T" Serialize="Required Public"/>
</Method>
<Subtypes Dynamic="Required Public"/>
</Type>
<Type Name="PropertyValue.ReferenceTypeHelper{System.Object}" Dynamic="Required Public"/>
</Namespace>
</Assembly>
</Library>
</Directives>

View File

@@ -4,33 +4,32 @@
<PropertyGroup>
<AssemblyName>System.Diagnostics.Tracing</AssemblyName>
<ProjectGuid>{EB880FDC-326D-42B3-A3FD-0CD3BA29A7F4}</ProjectGuid>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
<NoWarn>CA2002</NoWarn>
<GenFacadesIgnoreMissingTypes Condition="'$(TargetGroup)'=='uapaot'">true</GenFacadesIgnoreMissingTypes>
<!-- Disable binplacing for now since we need to use the uapaot version of this assembly -->
<BinPlaceILCInputFolder>false</BinPlaceILCInputFolder>
<!-- CSC adds a typeforward for the internal nested type EventSource.EventMetadata but
GenFacades doesn't consider this as a viable target for a typeforward since it's internal -->
<GenFacadesIgnoreMissingTypes Condition="'$(TargetGroup)' == 'netfx'">true</GenFacadesIgnoreMissingTypes>
<DefineContants Condition="'$(TargetGroup)' != 'netfx'">$(DefineConstants);SUPPORTS_EVENTCOMMANDEXECUTED</DefineContants>
</PropertyGroup>
<!-- Default configurations to help VS understand the options -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Unix-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Unix-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Windows_NT-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Windows_NT-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netfx-Windows_NT-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netfx-Windows_NT-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Windows_NT-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Windows_NT-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uapaot-Windows_NT-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uapaot-Windows_NT-Release|AnyCPU'" />
<ItemGroup>
<Compile Include="FxCopBaseline.cs" />
<Compile Include="System\Diagnostics\Tracing\EventCounter.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="System\Diagnostics\Tracing\EventCounter.cs" Condition="'$(TargetGroup)'!='uapaot'" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\System.Runtime\src\System.Runtime.csproj" />
<ProjectReference Include="..\..\System.Diagnostics.Contracts\src\System.Diagnostics.Contracts.csproj" />
<ProjectReference Include="..\..\System.Diagnostics.Tools\src\System.Diagnostics.Tools.csproj" />
<ItemGroup Condition="'$(TargetGroup)' != 'netfx'">
<ReferenceFromRuntime Include="System.Private.CoreLib" />
</ItemGroup>
<ItemGroup Condition="'$(TargetGroup)' == 'netfx'">
<Reference Include="mscorlib" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>

View File

@@ -1,39 +0,0 @@
// 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;
#if ES_BUILD_STANDALONE
namespace Microsoft.Diagnostics.Tracing
#else
namespace System.Diagnostics.Tracing
#endif
{
/// <summary>
/// EventActivityOptions flags allow to specify different activity related characteristics.
/// </summary>
[Flags]
public enum EventActivityOptions
{
/// <summary>
/// No special options are added to the event.
/// </summary>
None = 0,
/// <summary>
/// Disable Implicit Activity Tracking
/// </summary>
Disable = 0x2,
/// <summary>
/// Allow activity event to call itself (directly or indirectly)
/// </summary>
Recursive = 0x4,
/// <summary>
/// Allows event activity to live beyond its parent.
/// </summary>
Detachable = 0x8
}
}

View File

@@ -18,6 +18,12 @@ namespace System.Diagnostics.Tracing
{
/// <summary>
/// Provides the ability to collect statistics through EventSource
///
/// See https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.Tracing/documentation/EventCounterTutorial.md
/// for a tutorial guide.
///
/// See https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestEventCounter.cs
/// which shows tests, which are also useful in seeing actual use.
/// </summary>
public class EventCounter
{
@@ -245,7 +251,9 @@ namespace System.Diagnostics.Tracing
private void RegisterCommandCallback()
{
#if SUPPORTS_EVENTCOMMANDEXECUTED
_eventSource.EventCommandExecuted += OnEventSourceCommand;
#endif
}
private void OnEventSourceCommand(object sender, EventCommandEventArgs e)

View File

@@ -1,193 +0,0 @@
// 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;
using System.Runtime.InteropServices;
#if ES_BUILD_STANDALONE
using Environment = Microsoft.Diagnostics.Tracing.Internal.Environment;
#endif
#if !ES_BUILD_AGAINST_DOTNET_V35
using Contract = System.Diagnostics.Contracts.Contract;
#else
using Contract = Microsoft.Diagnostics.Contracts.Internal.Contract;
#endif
#if ES_BUILD_STANDALONE
namespace Microsoft.Diagnostics.Tracing
#else
namespace System.Diagnostics.Tracing
#endif
{
[StructLayout(LayoutKind.Explicit, Size = 16)]
[System.Security.Permissions.HostProtection(MayLeakOnAbort = true)]
internal struct EventDescriptor
{
# region private
[FieldOffset(0)]
private int m_traceloggingId;
[FieldOffset(0)]
private ushort m_id;
[FieldOffset(2)]
private byte m_version;
[FieldOffset(3)]
private byte m_channel;
[FieldOffset(4)]
private byte m_level;
[FieldOffset(5)]
private byte m_opcode;
[FieldOffset(6)]
private ushort m_task;
[FieldOffset(8)]
private long m_keywords;
#endregion
public EventDescriptor(
int traceloggingId,
byte level,
byte opcode,
long keywords
)
{
this.m_id = 0;
this.m_version = 0;
this.m_channel = 0;
this.m_traceloggingId = traceloggingId;
this.m_level = level;
this.m_opcode = opcode;
this.m_task = 0;
this.m_keywords = keywords;
}
public EventDescriptor(
int id,
byte version,
byte channel,
byte level,
byte opcode,
int task,
long keywords
)
{
if (id < 0)
{
throw new ArgumentOutOfRangeException(nameof(id), Resources.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
}
if (id > ushort.MaxValue)
{
throw new ArgumentOutOfRangeException(nameof(id), Resources.GetResourceString("ArgumentOutOfRange_NeedValidId", 1, ushort.MaxValue));
}
m_traceloggingId = 0;
m_id = (ushort)id;
m_version = version;
m_channel = channel;
m_level = level;
m_opcode = opcode;
m_keywords = keywords;
if (task < 0)
{
throw new ArgumentOutOfRangeException(nameof(task), Resources.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
}
if (task > ushort.MaxValue)
{
throw new ArgumentOutOfRangeException(nameof(task), Resources.GetResourceString("ArgumentOutOfRange_NeedValidId", 1, ushort.MaxValue));
}
m_task = (ushort)task;
}
public int EventId
{
get
{
return m_id;
}
}
public byte Version
{
get
{
return m_version;
}
}
public byte Channel
{
get
{
return m_channel;
}
}
public byte Level
{
get
{
return m_level;
}
}
public byte Opcode
{
get
{
return m_opcode;
}
}
public int Task
{
get
{
return m_task;
}
}
public long Keywords
{
get
{
return m_keywords;
}
}
public override bool Equals(object obj)
{
if (!(obj is EventDescriptor))
return false;
return Equals((EventDescriptor) obj);
}
public override int GetHashCode()
{
return m_id ^ m_version ^ m_channel ^ m_level ^ m_opcode ^ m_task ^ (int)m_keywords;
}
public bool Equals(EventDescriptor other)
{
if ((m_id != other.m_id) ||
(m_version != other.m_version) ||
(m_channel != other.m_channel) ||
(m_level != other.m_level) ||
(m_opcode != other.m_opcode) ||
(m_task != other.m_task) ||
(m_keywords != other.m_keywords))
{
return false;
}
return true;
}
public static bool operator ==(EventDescriptor event1, EventDescriptor event2)
{
return event1.Equals(event2);
}
public static bool operator !=(EventDescriptor event1, EventDescriptor event2)
{
return !event1.Equals(event2);
}
}
}

Some files were not shown because too many files have changed in this diff Show More