Imported Upstream version 5.10.0.47

Former-commit-id: d0813289fa2d35e1f8ed77530acb4fb1df441bc0
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-01-24 17:04:36 +00:00
parent 88ff76fe28
commit e46a49ecf1
5927 changed files with 226314 additions and 129848 deletions

View File

@@ -2,8 +2,22 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Diagnostics.PerformanceCounter.Tests", "tests\System.Diagnostics.PerformanceCounter.Tests.csproj", "{296074B7-1CC9-497E-8C1E-FC5C985C75C6}"
ProjectSection(ProjectDependencies) = postProject
{9758106C-5D4E-475D-B5E7-B7ABC46B1DDA} = {9758106C-5D4E-475D-B5E7-B7ABC46B1DDA}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Diagnostics.PerformanceCounter", "src\System.Diagnostics.PerformanceCounter.csproj", "{9758106C-5D4E-475D-B5E7-B7ABC46B1DDA}"
ProjectSection(ProjectDependencies) = postProject
{5BDC8641-E3EE-47B5-BE7B-2D2275402412} = {5BDC8641-E3EE-47B5-BE7B-2D2275402412}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Diagnostics.PerformanceCounter", "ref\System.Diagnostics.PerformanceCounter.csproj", "{5BDC8641-E3EE-47B5-BE7B-2D2275402412}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{1A2F9F4A-A032-433E-B914-ADD5992BB178}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E107E9C1-E893-4E87-987E-04EF0DCEAEFD}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{2E666815-2EDB-464B-9DF6-380BF4789AD4}"
EndProject
Global
@@ -12,15 +26,25 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5BDC8641-E3EE-47B5-BE7B-2D2275402412}.Debug|Any CPU.ActiveCfg = netcoreapp-Debug|Any CPU
{5BDC8641-E3EE-47B5-BE7B-2D2275402412}.Debug|Any CPU.Build.0 = netcoreapp-Debug|Any CPU
{5BDC8641-E3EE-47B5-BE7B-2D2275402412}.Release|Any CPU.ActiveCfg = netcoreapp-Release|Any CPU
{5BDC8641-E3EE-47B5-BE7B-2D2275402412}.Release|Any CPU.Build.0 = netcoreapp-Release|Any CPU
{296074B7-1CC9-497E-8C1E-FC5C985C75C6}.Debug|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
{296074B7-1CC9-497E-8C1E-FC5C985C75C6}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
{296074B7-1CC9-497E-8C1E-FC5C985C75C6}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
{296074B7-1CC9-497E-8C1E-FC5C985C75C6}.Release|Any CPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
{9758106C-5D4E-475D-B5E7-B7ABC46B1DDA}.Debug|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
{9758106C-5D4E-475D-B5E7-B7ABC46B1DDA}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
{9758106C-5D4E-475D-B5E7-B7ABC46B1DDA}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
{9758106C-5D4E-475D-B5E7-B7ABC46B1DDA}.Release|Any CPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
{5BDC8641-E3EE-47B5-BE7B-2D2275402412}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU
{5BDC8641-E3EE-47B5-BE7B-2D2275402412}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU
{5BDC8641-E3EE-47B5-BE7B-2D2275402412}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU
{5BDC8641-E3EE-47B5-BE7B-2D2275402412}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{296074B7-1CC9-497E-8C1E-FC5C985C75C6} = {1A2F9F4A-A032-433E-B914-ADD5992BB178}
{9758106C-5D4E-475D-B5E7-B7ABC46B1DDA} = {E107E9C1-E893-4E87-987E-04EF0DCEAEFD}
{5BDC8641-E3EE-47B5-BE7B-2D2275402412} = {2E666815-2EDB-464B-9DF6-380BF4789AD4}
EndGlobalSection
EndGlobal

View File

@@ -2,6 +2,7 @@
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\dir.props" />
<PropertyGroup>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyKey>Open</AssemblyKey>
</PropertyGroup>
</Project>
</Project>

View File

@@ -2,7 +2,8 @@
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BuildConfigurations>
netcoreapp;
netfx;
netstandard;
</BuildConfigurations>
</PropertyGroup>
</Project>
</Project>

View File

@@ -5,15 +5,38 @@
// Changes to this file must follow the http://aka.ms/api-review process.
// ------------------------------------------------------------------------------
namespace System.Diagnostics
{
public partial class CounterCreationData
{
public CounterCreationData() { }
public CounterCreationData(string counterName, string counterHelp, System.Diagnostics.PerformanceCounterType counterType) { }
public string CounterHelp { get { throw null; } set { } }
public string CounterName { get { throw null; } set { } }
public System.Diagnostics.PerformanceCounterType CounterType { get { throw null; } set { } }
}
public partial class CounterCreationDataCollection : System.Collections.CollectionBase
{
public CounterCreationDataCollection() { }
public CounterCreationDataCollection(System.Diagnostics.CounterCreationDataCollection value) { }
public CounterCreationDataCollection(System.Diagnostics.CounterCreationData[] value) { }
public System.Diagnostics.CounterCreationData this[int index] { get { throw null; } set { } }
public int Add(System.Diagnostics.CounterCreationData value) { throw null; }
public void AddRange(System.Diagnostics.CounterCreationDataCollection value) { }
public void AddRange(System.Diagnostics.CounterCreationData[] value) { }
public bool Contains(System.Diagnostics.CounterCreationData value) { throw null; }
public void CopyTo(System.Diagnostics.CounterCreationData[] array, int index) { }
public int IndexOf(System.Diagnostics.CounterCreationData value) { throw null; }
public void Insert(int index, System.Diagnostics.CounterCreationData value) { }
protected override void OnValidate(object value) { }
public virtual void Remove(System.Diagnostics.CounterCreationData value) { }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public partial struct CounterSample
{
public static System.Diagnostics.CounterSample Empty;
public CounterSample(long rawValue, long baseValue, long counterFrequency, long systemFrequency, long timeStamp, long timeStamp100nSec, System.Diagnostics.PerformanceCounterType counterType) { throw null; }
public CounterSample(long rawValue, long baseValue, long counterFrequency, long systemFrequency, long timeStamp, long timeStamp100nSec, System.Diagnostics.PerformanceCounterType counterType, long counterTimeStamp) { throw null; }
public CounterSample(long rawValue, long baseValue, long counterFrequency, long systemFrequency, long timeStamp, long timeStamp100nSec, System.Diagnostics.PerformanceCounterType counterType) { throw null;}
public CounterSample(long rawValue, long baseValue, long counterFrequency, long systemFrequency, long timeStamp, long timeStamp100nSec, System.Diagnostics.PerformanceCounterType counterType, long counterTimeStamp) { throw null;}
public long BaseValue { get { throw null; } }
public long CounterFrequency { get { throw null; } }
public long CounterTimeStamp { get { throw null; } }
@@ -30,6 +53,44 @@ namespace System.Diagnostics
public static bool operator ==(System.Diagnostics.CounterSample a, System.Diagnostics.CounterSample b) { throw null; }
public static bool operator !=(System.Diagnostics.CounterSample a, System.Diagnostics.CounterSample b) { throw null; }
}
public static partial class CounterSampleCalculator
{
public static float ComputeCounterValue(System.Diagnostics.CounterSample newSample) { throw null; }
public static float ComputeCounterValue(System.Diagnostics.CounterSample oldSample, System.Diagnostics.CounterSample newSample) { throw null; }
}
public partial interface ICollectData
{
void CloseData();
void CollectData(int id, System.IntPtr valueName, System.IntPtr data, int totalBytes, out System.IntPtr res);
}
public partial class InstanceData
{
public InstanceData(string instanceName, System.Diagnostics.CounterSample sample) { }
public string InstanceName { get { throw null; } }
public long RawValue { get { throw null; } }
public System.Diagnostics.CounterSample Sample { get { throw null; } }
}
public partial class InstanceDataCollection : System.Collections.DictionaryBase
{
[System.ObsoleteAttribute("This constructor has been deprecated. Please use System.Diagnostics.InstanceDataCollectionCollection.get_Item to get an instance of this collection instead. http://go.microsoft.com/fwlink/?linkid=14202")]
public InstanceDataCollection(string counterName) { }
public string CounterName { get { throw null; } }
public System.Diagnostics.InstanceData this[string instanceName] { get { throw null; } }
public System.Collections.ICollection Keys { get { throw null; } }
public System.Collections.ICollection Values { get { throw null; } }
public bool Contains(string instanceName) { throw null; }
public void CopyTo(System.Diagnostics.InstanceData[] instances, int index) { }
}
public partial class InstanceDataCollectionCollection : System.Collections.DictionaryBase
{
[System.ObsoleteAttribute("This constructor has been deprecated. Please use System.Diagnostics.PerformanceCounterCategory.ReadCategory() to get an instance of this collection instead. http://go.microsoft.com/fwlink/?linkid=14202")]
public InstanceDataCollectionCollection() { }
public System.Diagnostics.InstanceDataCollection this[string counterName] { get { throw null; } }
public System.Collections.ICollection Keys { get { throw null; } }
public System.Collections.ICollection Values { get { throw null; } }
public bool Contains(string counterName) { throw null; }
public void CopyTo(System.Diagnostics.InstanceDataCollection[] counters, int index) { }
}
public sealed partial class PerformanceCounter : System.ComponentModel.Component, System.ComponentModel.ISupportInitialize
{
[System.ObsoleteAttribute("This field has been deprecated and is not used. Use machine.config or an application configuration file to set the size of the PerformanceCounter file mapping.")]
@@ -40,25 +101,20 @@ namespace System.Diagnostics
public PerformanceCounter(string categoryName, string counterName, string instanceName) { }
public PerformanceCounter(string categoryName, string counterName, string instanceName, bool readOnly) { }
public PerformanceCounter(string categoryName, string counterName, string instanceName, string machineName) { }
[System.ComponentModel.DefaultValueAttribute("")]
public string CategoryName { get { throw null; } set { } }
public string CounterHelp { get { throw null; } }
[System.ComponentModel.DefaultValueAttribute("")]
public string CounterName { get { throw null; } set { } }
public System.Diagnostics.PerformanceCounterType CounterType { get { throw null; } }
[System.ComponentModel.DefaultValueAttribute((System.Diagnostics.PerformanceCounterInstanceLifetime)(0))]
public System.Diagnostics.PerformanceCounterInstanceLifetime InstanceLifetime { get { throw null; } set { } }
[System.ComponentModel.DefaultValueAttribute("")]
public string InstanceName { get { throw null; } set { } }
[System.ComponentModel.DefaultValueAttribute(".")]
public string MachineName { get { throw null; } set { } }
public long RawValue { get { throw null; } set { } }
[System.ComponentModel.DefaultValueAttribute(true)]
public bool ReadOnly { get { throw null; } set { } }
public void BeginInit() { }
public void Close() { }
public static void CloseSharedResources() { }
public long Decrement() { return default(long); }
public long Decrement() { throw null; }
protected override void Dispose(bool disposing) { }
public void EndInit() { }
public long Increment() { throw null; }
public long IncrementBy(long value) { throw null; }
@@ -66,11 +122,57 @@ namespace System.Diagnostics
public float NextValue() { throw null; }
public void RemoveInstance() { }
}
public sealed partial class PerformanceCounterCategory
{
public PerformanceCounterCategory() { }
public PerformanceCounterCategory(string categoryName) { }
public PerformanceCounterCategory(string categoryName, string machineName) { }
public string CategoryHelp { get { throw null; } }
public string CategoryName { get { throw null; } set { } }
public System.Diagnostics.PerformanceCounterCategoryType CategoryType { get { throw null; } }
public string MachineName { get { throw null; } set { } }
public bool CounterExists(string counterName) { throw null; }
public static bool CounterExists(string counterName, string categoryName) { throw null; }
public static bool CounterExists(string counterName, string categoryName, string machineName) { throw null; }
[System.ObsoleteAttribute("This method has been deprecated. Please use System.Diagnostics.PerformanceCounterCategory.Create(string categoryName, string categoryHelp, PerformanceCounterCategoryType categoryType, CounterCreationDataCollection counterData) instead. http://go.microsoft.com/fwlink/?linkid=14202")]
public static System.Diagnostics.PerformanceCounterCategory Create(string categoryName, string categoryHelp, System.Diagnostics.CounterCreationDataCollection counterData) { throw null; }
public static System.Diagnostics.PerformanceCounterCategory Create(string categoryName, string categoryHelp, System.Diagnostics.PerformanceCounterCategoryType categoryType, System.Diagnostics.CounterCreationDataCollection counterData) { throw null; }
public static System.Diagnostics.PerformanceCounterCategory Create(string categoryName, string categoryHelp, System.Diagnostics.PerformanceCounterCategoryType categoryType, string counterName, string counterHelp) { throw null; }
[System.ObsoleteAttribute("This method has been deprecated. Please use System.Diagnostics.PerformanceCounterCategory.Create(string categoryName, string categoryHelp, PerformanceCounterCategoryType categoryType, string counterName, string counterHelp) instead. http://go.microsoft.com/fwlink/?linkid=14202")]
public static System.Diagnostics.PerformanceCounterCategory Create(string categoryName, string categoryHelp, string counterName, string counterHelp) { throw null; }
public static void Delete(string categoryName) { }
public static bool Exists(string categoryName) { throw null; }
public static bool Exists(string categoryName, string machineName) { throw null; }
public static System.Diagnostics.PerformanceCounterCategory[] GetCategories() { throw null; }
public static System.Diagnostics.PerformanceCounterCategory[] GetCategories(string machineName) { throw null; }
public System.Diagnostics.PerformanceCounter[] GetCounters() { throw null; }
public System.Diagnostics.PerformanceCounter[] GetCounters(string instanceName) { throw null; }
public string[] GetInstanceNames() { throw null; }
public bool InstanceExists(string instanceName) { throw null; }
public static bool InstanceExists(string instanceName, string categoryName) { throw null; }
public static bool InstanceExists(string instanceName, string categoryName, string machineName) { throw null; }
public System.Diagnostics.InstanceDataCollectionCollection ReadCategory() { throw null; }
}
public enum PerformanceCounterCategoryType
{
MultiInstance = 1,
SingleInstance = 0,
Unknown = -1,
}
public enum PerformanceCounterInstanceLifetime
{
Global = 0,
Process = 1,
}
public sealed partial class PerformanceCounterManager : System.Diagnostics.ICollectData
{
[System.ObsoleteAttribute("This class has been deprecated. Use the PerformanceCounters through the System.Diagnostics.PerformanceCounter class instead. http://go.microsoft.com/fwlink/?linkid=14202")]
public PerformanceCounterManager() { }
[System.ObsoleteAttribute("This class has been deprecated. Use the PerformanceCounters through the System.Diagnostics.PerformanceCounter class instead. http://go.microsoft.com/fwlink/?linkid=14202")]
void System.Diagnostics.ICollectData.CloseData() { }
[System.ObsoleteAttribute("This class has been deprecated. Use the PerformanceCounters through the System.Diagnostics.PerformanceCounter class instead. http://go.microsoft.com/fwlink/?linkid=14202")]
void System.Diagnostics.ICollectData.CollectData(int callIdx, System.IntPtr valueNamePtr, System.IntPtr dataPtr, int totalBytes, out System.IntPtr res) { res = default(System.IntPtr); }
}
public enum PerformanceCounterType
{
AverageBase = 1073939458,

View File

@@ -2,18 +2,19 @@
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'netfx'">true</IsPartialFacadeAssembly>
<ProjectGuid>{5BDC8641-E3EE-47B5-BE7B-2D2275402412}</ProjectGuid>
</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)' == 'netstandard-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Release|AnyCPU'" />
<ItemGroup>
<Compile Include="System.Diagnostics.PerformanceCounter.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="System.Diagnostics.PerformanceCounter.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\System.Runtime\ref\System.Runtime.csproj" />
<ProjectReference Include="..\..\System.ComponentModel.Primitives\ref\System.ComponentModel.Primitives.csproj" />
<ItemGroup Condition="'$(TargetGroup)' == 'netfx'">
<Reference Include="mscorlib" />
<Reference Include="System" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>
</Project>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BuildConfigurations>
netcoreapp-Windows_NT;
netstandard;
netfx;
</BuildConfigurations>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,294 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<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="InvalidParameter" xml:space="preserve">
<value>Invalid value '{1}' for parameter '{0}'.</value>
</data>
<data name="CategoryHelpCorrupt" xml:space="preserve">
<value>Cannot load Category Help data because an invalid index '{0}' was read from the registry.</value>
</data>
<data name="CounterNameCorrupt" xml:space="preserve">
<value>Cannot load Counter Name data because an invalid index '{0}' was read from the registry.</value>
</data>
<data name="CounterDataCorrupt" xml:space="preserve">
<value>Cannot load Performance Counter data because an unexpected registry key value type was read from '{0}'.</value>
</data>
<data name="InstanceNameTooLong" xml:space="preserve">
<value>Instance names used for writing to custom counters must be 127 characters or less.</value>
</data>
<data name="ProcessLifetimeNotValidInGlobal" xml:space="preserve">
<value>PerformanceCounterInstanceLifetime.Process is not valid in the global shared memory. If your performance counter category was created with an older version of the Framework, it uses the global shared memory. Either use PerformanceCounterInstanceLifetime.Global, or if applications running on older versions of the Framework do not need to write to your category, delete and recreate it.</value>
</data>
<data name="CountersOOM" xml:space="preserve">
<value>Custom counters file view is out of memory.</value>
</data>
<data name="MappingCorrupted" xml:space="preserve">
<value>Cannot continue the current operation, the performance counters memory mapping has been corrupted.</value>
</data>
<data name="SingleInstanceOnly" xml:space="preserve">
<value>Category '{0}' is marked as single-instance. Performance counters in this category can only be created without instance names.</value>
</data>
<data name="MultiInstanceOnly" xml:space="preserve">
<value>Category '{0}' is marked as multi-instance. Performance counters in this category can only be created with instance names.</value>
</data>
<data name="CantConvertProcessToGlobal" xml:space="preserve">
<value>An instance with a lifetime of Process can only be accessed from a PerformanceCounter with the InstanceLifetime set to PerformanceCounterInstanceLifetime.Process.</value>
</data>
<data name="CantConvertGlobalToProcess" xml:space="preserve">
<value>An instance with a lifetime of Global can only be accessed from a PerformanceCounter with the InstanceLifetime set to PerformanceCounterInstanceLifetime.Global.</value>
</data>
<data name="InstanceAlreadyExists" xml:space="preserve">
<value>Instance '{0}' already exists with a lifetime of Process. It cannot be recreated or reused until it has been removed or until the process using it has exited.</value>
</data>
<data name="SharedMemoryGhosted" xml:space="preserve">
<value>Cannot access shared memory, AppDomain has been unloaded.</value>
</data>
<data name="SetSecurityDescriptionFailed" xml:space="preserve">
<value>Cannot initialize security descriptor initialized.</value>
</data>
<data name="CantCreateFileMapping" xml:space="preserve">
<value>Cannot create file mapping.</value>
</data>
<data name="CantMapFileView" xml:space="preserve">
<value>Cannot map view of file.</value>
</data>
<data name="MismatchedCounterTypes" xml:space="preserve">
<value>MismatchedCounterTypes=Mismatched counter types.</value>
</data>
<data name="PerfCounterPdhError" xml:space="preserve">
<value>There was an error calculating the PerformanceCounter value (0x{0}).</value>
</data>
<data name="MustAddCounterCreationData" xml:space="preserve">
<value>Only objects of type CounterCreationData can be added to a CounterCreationDataCollection.</value>
</data>
<data name="CantReadInstance" xml:space="preserve">
<value>Instance '{0}' does not exist in the specified Category.</value>
</data>
<data name="CantReadCategoryIndex" xml:space="preserve">
<value>Could not Read Category Index: {0}.</value>
</data>
<data name="MissingCategory" xml:space="preserve">
<value>Category does not exist.</value>
</data>
<data name="CounterLayout" xml:space="preserve">
<value>The Counter layout for the Category specified is invalid, a counter of the type: AverageCount64, AverageTimer32, CounterMultiTimer, CounterMultiTimerInverse, CounterMultiTimer100Ns, CounterMultiTimer100NsInverse, RawFraction, or SampleFraction has to be immediately followed by any of the base counter types: AverageBase, CounterMultiBase, RawBase or SampleBase.</value>
</data>
<data name="CantReadCounter" xml:space="preserve">
<value>Counter '{0}' does not exist in the specified Category.</value>
</data>
<data name="HelpNotAvailable" xml:space="preserve">
<value>Help Not Available</value>
</data>
<data name="MissingCategoryDetail" xml:space="preserve">
<value>Category {0} does not exist.</value>
</data>
<data name="MissingCounter" xml:space="preserve">
<value>Counter {0} does not exist.</value>
</data>
<data name="CantChangeCategoryRegistration" xml:space="preserve">
<value>Cannot create or delete the Performance Category '{0}' because access is denied.</value>
</data>
<data name="InvalidProperty" xml:space="preserve">
<value>Invalid value {1} for property {0}.</value>
</data>
<data name="CategoryNameNotSet" xml:space="preserve">
<value>Category name property has not been set.</value>
</data>
<data name="PerformanceCategoryExists" xml:space="preserve">
<value>Cannot create Performance Category '{0}' because it already exists.</value>
</data>
<data name="PerfInvalidCategoryName" xml:space="preserve">
<value>Invalid category name. Its length must be in the range between '{0}' and '{1}'. Double quotes, control characters and leading or trailing spaces are not allowed.</value>
</data>
<data name="CategoryNameTooLong" xml:space="preserve">
<value>Category names must be 1024 characters or less.</value>
</data>
<data name="PerfInvalidCounterName" xml:space="preserve">
<value>Invalid counter name. Its length must be in the range between '{0}' and '{1}'. Double quotes, control characters and leading or trailing spaces are not allowed.</value>
</data>
<data name="PerfInvalidHelp" xml:space="preserve">
<value>Invalid help string. Its length must be in the range between '{0}' and '{1}'.</value>
</data>
<data name="InvalidCounterName" xml:space="preserve">
<value>Invalid empty or null string for counter name.</value>
</data>
<data name="DuplicateCounterName" xml:space="preserve">
<value>Cannot create Performance Category with counter name {0} because the name is a duplicate.</value>
</data>
<data name="CantDeleteCategory" xml:space="preserve">
<value>Cannot delete Performance Category because this category is not registered or is a system category.</value>
</data>
<data name="InstanceNameRequired" xml:space="preserve">
<value>Counter is not single instance, an instance name needs to be specified.</value>
</data>
<data name="MissingInstance" xml:space="preserve">
<value>Instance {0} does not exist in category {1}.</value>
</data>
<data name="CantSetLifetimeAfterInitialized" xml:space="preserve">
<value>The InstanceLifetime cannot be set after the instance has been initialized. You must use the default constructor and set the CategoryName, InstanceName, CounterName, InstanceLifetime and ReadOnly properties manually before setting the RawValue.</value>
</data>
<data name="ReadOnlyCounter" xml:space="preserve">
<value>Cannot update Performance Counter, this object has been initialized as ReadOnly.</value>
</data>
<data name="PCNotSupportedUnderAppContainer" xml:space="preserve">
<value>Writeable performance counters are not allowed when running in AppContainer.</value>
</data>
<data name="CategoryNameMissing" xml:space="preserve">
<value>Failed to initialize because CategoryName is missing.</value>
</data>
<data name="CounterNameMissing" xml:space="preserve">
<value>Failed to initialize because CounterName is missing.</value>
</data>
<data name="InstanceLifetimeProcessonReadOnly" xml:space="preserve">
<value>InstanceLifetime is unused by ReadOnly counters.</value>
</data>
<data name="RemoteWriting" xml:space="preserve">
<value>Cannot write to a Performance Counter in a remote machine.</value>
</data>
<data name="NotCustomCounter" xml:space="preserve">
<value>The requested Performance Counter is not a custom counter, it has to be initialized as ReadOnly.</value>
</data>
<data name="InstanceLifetimeProcessforSingleInstance" xml:space="preserve">
<value>Single instance categories are only valid with the Global lifetime.</value>
</data>
<data name="InstanceNameProhibited" xml:space="preserve">
<value>Counter is single instance, instance name '{0}' is not valid for this counter category.</value>
</data>
<data name="ReadOnlyRemoveInstance" xml:space="preserve">
<value>Cannot remove Performance Counter Instance, this object as been initialized as ReadOnly.</value>
</data>
<data name="CounterExists" xml:space="preserve">
<value>Could not locate Performance Counter with specified category name '{0}', counter name '{1}'.</value>
</data>
<data name="SetSecurityDescriptorFailed" xml:space="preserve">
<value>Cannot initialize security descriptor initialized.</value>
</data>
<data name="RegKeyMissingShort" xml:space="preserve">
<value>Cannot open registry key {0} on computer {1}.</value>
</data>
<data name="CantGetMappingSize" xml:space="preserve">
<value>Cannot calculate the size of the file view.</value>
</data>
<data name="CantReadCategory" xml:space="preserve">
<value>Cannot read Category {0}.</value>
</data>
<data name="PlatformNotSupported_PerfCounters" xml:space="preserve">
<value>Performance Counters are not supported on this platform.</value>
</data>
</root>

View File

@@ -0,0 +1,178 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{9758106C-5D4E-475D-B5E7-B7ABC46B1DDA}</ProjectGuid>
<RootNamespace>System.Diagnostics.PerformanceCounter</RootNamespace>
<AssemblyName>System.Diagnostics.PerformanceCounter</AssemblyName>
<DefineConstants>$(DefineConstants);FEATURE_REGISTRY</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'netfx'">true</IsPartialFacadeAssembly>
<GeneratePlatformNotSupportedAssemblyMessage Condition="'$(TargetGroup)' != 'netcoreapp'">SR.PlatformNotSupported_PerfCounters</GeneratePlatformNotSupportedAssemblyMessage>
<UWPCompatible>false</UWPCompatible>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Windows_NT-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Windows_NT-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netfx-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netfx-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Release|AnyCPU'" />
<ItemGroup Condition="'$(TargetGroup)' == 'netcoreapp'">
<Compile Include="System\Diagnostics\DiagnosticsConfiguration.cs" />
<Compile Include="System\Diagnostics\CounterCreationData.cs" />
<Compile Include="System\Diagnostics\CounterCreationDataCollection.cs" />
<Compile Include="System\Diagnostics\CounterSample.cs" />
<Compile Include="System\Diagnostics\CounterSampleCalculator.cs" />
<Compile Include="System\Diagnostics\ICollectData.cs" />
<Compile Include="System\Diagnostics\InstanceData.cs" />
<Compile Include="System\Diagnostics\InstanceDataCollection.cs" />
<Compile Include="System\Diagnostics\InstanceDataCollectionCollection.cs" />
<Compile Include="System\Diagnostics\PerfCounterSection.cs" />
<Compile Include="System\Diagnostics\PerformanceCounter.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="System\Diagnostics\PerformanceCounterCategory.cs" />
<Compile Include="System\Diagnostics\PerformanceCounterCategoryType.cs" />
<Compile Include="System\Diagnostics\PerformanceCounterInstanceLifetime.cs" />
<Compile Include="System\Diagnostics\PerformanceCounterLib.cs" />
<Compile Include="System\Diagnostics\PerformanceCounterManager.cs" />
<Compile Include="System\Diagnostics\PerformanceCounterType.cs" />
<Compile Include="System\Diagnostics\SharedPerformanceCounter.cs" />
<Compile Include="System\Diagnostics\SharedUtils.cs" />
<Compile Include="System\Diagnostics\SystemDiagnosticsSection.cs" />
<Compile Include="System\Diagnostics\TraceInternal.cs" />
<Compile Include="misc\EnvironmentHelpers.cs" />
<Compile Include="$(CommonPath)\Interop\Windows\Interop.BOOL.cs">
<Link>Common\Interop\Windows\Interop.BOOL.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\Interop.Errors.cs">
<Link>Common\Interop\Windows\Interop.Errors.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\Interop.Libraries.cs">
<Link>Common\Interop\Windows\Interop.Libraries.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\advapi32\Interop.ConvertStringSecurityDescriptorToSecurityDescriptor.cs">
<Link>Common\Interop\Windows\advapi32\Interop.ConvertStringSecurityDescriptorToSecurityDescriptor.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\advapi32\Interop.GetTokenInformation.cs">
<Link>Common\Interop\Windows\advapi32\Interop.GetTokenInformation.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\advapi32\Interop.PERF_INFO.cs">
<Link>Common\Interop\Windows\advapi32\Interop.PERF_INFO.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\advapi32\Interop.ProcessOptions.cs">
<Link>Common\Interop\Windows\advapi32\Interop.ProcessOptions.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\advapi32\Interop.TOKEN_INFORMATION_CLASS.cs">
<Link>Common\Interop\Windows\advapi32\Interop.TOKEN_INFORMATION_CLASS.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.CreateFileMapping.cs">
<Link>Common\Interop\Windows\kernel32\Interop.CreateFileMapping.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.DuplicateHandle_SafeProcessHandle.cs">
<Link>Common\Interop\Windows\kernel32\Interop.DuplicateHandle.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.FreeLibrary.cs">
<Link>Common\Interop\Windows\kernel32\Interop.FreeLibrary.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.GetComputerName.cs">
<Link>Common\Interop\Windows\kernel32\Interop.GetComputerName.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.GetCurrentProcess_SafeProcessHandle.cs">
<Link>Common\Interop\Windows\kernel32\Interop.GetCurrentProcess.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.GetCurrentProcessId.cs">
<Link>Common\Interop\Windows\kernel32\Interop.GetCurrentProcessId.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.GetProcessTimes.cs">
<Link>Common\Interop\Windows\kernel32\Interop.GetProcessTimes.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.HandleOptions.cs">
<Link>Common\Interop\Windows\kernel32\Interop.HandleOptions.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.LoadLibrary.cs">
<Link>Common\Interop\Windows\kernel32\Interop.LoadLibrary.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.LocalAlloc.cs">
<Link>Common\Interop\Windows\kernel32\Interop.LocalAlloc.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.LocalAlloc.Constants.cs">
<Link>Common\Interop\Windows\kernel32\Interop.LocalAlloc.Constants.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.LocalFree.cs">
<Link>Common\Interop\Windows\kernel32\Interop.LocalFree.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.MapViewOfFile.cs">
<Link>Common\Interop\Windows\kernel32\Interop.MapViewOfFile.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.MemOptions.cs">
<Link>Common\Interop\Windows\kernel32\Interop.MemOptions.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.MEMORY_BASIC_INFO.cs">
<Link>Common\Interop\Windows\kernel32\Interop.MEMORY_BASIC_INFO.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.OpenFileMapping.cs">
<Link>Common\Interop\Windows\kernel32\Interop.OpenFileMapping.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.OpenProcess.cs">
<Link>Common\Interop\Windows\kernel32\Interop.OpenProcess.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.PerformanceCounterOptions.cs">
<Link>Common\Interop\Windows\kernel32\Interop.PerformanceCounterOptions.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.ProcessWaitHandle.cs">
<Link>Common\Interop\Windows\kernel32\Interop.ProcessWaitHandle.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.SECURITY_ATTRIBUTES.cs">
<Link>Common\Interop\Windows\kernel32\Interop.SECURITY_ATTRIBUTES.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.UnmapViewOfFile.cs">
<Link>Common\Interop\Windows\kernel32\Interop.UnmapViewOfFile.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.VirtualQuery.cs">
<Link>Common\Interop\Windows\kernel32\Interop.VirtualQuery.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.WaitForSingleObject.cs">
<Link>Common\Interop\Windows\kernel32\Interop.WaitForSingleObject.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\perfcounter\Interop.FormatFromRawValue.cs">
<Link>Common\Interop\Windows\perfcounter\Interop.FormatFromRawValue.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Microsoft\Win32\SafeHandles\SafeLocalAllocHandle.cs">
<Link>Common\Microsoft\Win32\SafeHandles\SafeLocalAllocHandle.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Microsoft\Win32\SafeHandles\SafeLocalMemHandle.cs">
<Link>Common\Microsoft\Win32\SafeHandles\SafeLocalMemHandle.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup Condition="'$(TargetGroup)' == 'netfx'">
<Reference Include="mscorlib" />
<Reference Include="System" />
</ItemGroup>
<ItemGroup Condition="'$(TargetGroup)' != 'netfx'">
<Reference Include="Microsoft.Win32.Registry" />
<Reference Include="Microsoft.Win32.Primitives" />
<Reference Include="System.Collections" />
<Reference Include="System.Collections.NonGeneric" />
<Reference Include="System.ComponentModel.Primitives" />
<Reference Include="System.ComponentModel.TypeConverter" />
<Reference Include="System.Configuration.ConfigurationManager" />
<Reference Include="System.Diagnostics.Debug" />
<Reference Include="System.Diagnostics.Process" />
<Reference Include="System.Diagnostics.Tools" />
<Reference Include="System.IO.FileSystem" />
<Reference Include="System.IO.MemoryMappedFiles" />
<Reference Include="System.Resources.ResourceManager" />
<Reference Include="System.Runtime" />
<Reference Include="System.Runtime.Extensions" />
<Reference Include="System.Runtime.InteropServices" />
<Reference Include="System.Security.Claims" />
<Reference Include="System.Security.Permissions" />
<Reference Include="System.Security.Principal.Windows" />
<Reference Include="System.Security.Principal" />
<Reference Include="System.Threading" />
<Reference Include="System.Threading.Thread" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>

View File

@@ -0,0 +1,70 @@
// 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.ComponentModel;
namespace System.Diagnostics
{
/// <summary>
/// A class defining the counter type, name and help string for a custom counter.
/// </summary>
public class CounterCreationData
{
private PerformanceCounterType _counterType = PerformanceCounterType.NumberOfItems32;
private string _counterName = string.Empty;
private string _counterHelp = string.Empty;
public CounterCreationData()
{
}
public CounterCreationData(string counterName, string counterHelp, PerformanceCounterType counterType)
{
CounterType = counterType;
CounterName = counterName;
CounterHelp = counterHelp;
}
public PerformanceCounterType CounterType
{
get
{
return _counterType;
}
set
{
if (!Enum.IsDefined(typeof(PerformanceCounterType), value))
throw new InvalidEnumArgumentException(nameof(PerformanceCounterType), (int)value, typeof(PerformanceCounterType));
_counterType = value;
}
}
public string CounterName
{
get
{
return _counterName;
}
set
{
PerformanceCounterCategory.CheckValidCounter(value);
_counterName = value;
}
}
public string CounterHelp
{
get
{
return _counterHelp;
}
set
{
PerformanceCounterCategory.CheckValidHelp(value);
_counterHelp = value;
}
}
}
}

View File

@@ -0,0 +1,104 @@
// 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.Collections;
namespace System.Diagnostics
{
public class CounterCreationDataCollection : CollectionBase
{
public CounterCreationDataCollection()
{
}
public CounterCreationDataCollection(CounterCreationDataCollection value)
{
AddRange(value);
}
public CounterCreationDataCollection(CounterCreationData[] value)
{
AddRange(value);
}
public CounterCreationData this[int index]
{
get
{
return ((CounterCreationData)(List[index]));
}
set
{
List[index] = value;
}
}
public int Add(CounterCreationData value)
{
return List.Add(value);
}
public void AddRange(CounterCreationData[] value)
{
if (value == null)
{
throw new ArgumentNullException(nameof(value));
}
for (int i = 0; i < value.Length; i++)
{
Add(value[i]);
}
}
public void AddRange(CounterCreationDataCollection value)
{
if (value == null)
{
throw new ArgumentNullException(nameof(value));
}
int currentCount = value.Count;
for (int i = 0; i < currentCount; i++)
{
Add(value[i]);
}
}
public bool Contains(CounterCreationData value)
{
return List.Contains(value);
}
public void CopyTo(CounterCreationData[] array, int index)
{
List.CopyTo(array, index);
}
public int IndexOf(CounterCreationData value)
{
return List.IndexOf(value);
}
public void Insert(int index, CounterCreationData value)
{
List.Insert(index, value);
}
public virtual void Remove(CounterCreationData value)
{
List.Remove(value);
}
protected override void OnValidate(object value)
{
if (value == null)
throw new ArgumentNullException(nameof(value));
if (!(value is CounterCreationData))
throw new ArgumentException(SR.Format(SR.MustAddCounterCreationData));
}
}
}

View File

@@ -0,0 +1,192 @@
// 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.
namespace System.Diagnostics
{
/// <summary>
/// A struct holding the raw data for a performance counter.
/// </summary>
public struct CounterSample
{
private readonly long _rawValue;
private readonly long _baseValue;
private readonly long _timeStamp;
private readonly long _counterFrequency;
private readonly PerformanceCounterType _counterType;
private readonly long _timeStamp100nSec;
private readonly long _systemFrequency;
private readonly long _counterTimeStamp;
public static CounterSample Empty = new CounterSample(0, 0, 0, 0, 0, 0, PerformanceCounterType.NumberOfItems32);
public CounterSample(long rawValue, long baseValue, long counterFrequency, long systemFrequency, long timeStamp, long timeStamp100nSec, PerformanceCounterType counterType)
{
_rawValue = rawValue;
_baseValue = baseValue;
_timeStamp = timeStamp;
_counterFrequency = counterFrequency;
_counterType = counterType;
_timeStamp100nSec = timeStamp100nSec;
_systemFrequency = systemFrequency;
_counterTimeStamp = 0;
}
public CounterSample(long rawValue, long baseValue, long counterFrequency, long systemFrequency, long timeStamp, long timeStamp100nSec, PerformanceCounterType counterType, long counterTimeStamp)
{
_rawValue = rawValue;
_baseValue = baseValue;
_timeStamp = timeStamp;
_counterFrequency = counterFrequency;
_counterType = counterType;
_timeStamp100nSec = timeStamp100nSec;
_systemFrequency = systemFrequency;
_counterTimeStamp = counterTimeStamp;
}
/// <summary>
/// Raw value of the counter.
/// </summary>
public long RawValue
{
get
{
return _rawValue;
}
}
internal ulong UnsignedRawValue
{
get
{
return (ulong)_rawValue;
}
}
/// <summary>
/// Optional base raw value for the counter (only used if multiple counter based).
/// </summary>
public long BaseValue
{
get
{
return _baseValue;
}
}
/// <summary>
/// Raw system frequency
/// </summary>
public long SystemFrequency
{
get
{
return _systemFrequency;
}
}
/// <summary>
/// Raw counter frequency
/// </summary>
public long CounterFrequency
{
get
{
return _counterFrequency;
}
}
/// <summary>
/// Raw counter frequency
/// </summary>
public long CounterTimeStamp
{
get
{
return _counterTimeStamp;
}
}
/// <summary>
/// Raw timestamp
/// </summary>
public long TimeStamp
{
get
{
return _timeStamp;
}
}
/// <summary>
/// Raw high fidelity timestamp
/// </summary>
public long TimeStamp100nSec
{
get
{
return _timeStamp100nSec;
}
}
/// <summary>
/// Counter type
/// </summary>
public PerformanceCounterType CounterType
{
get
{
return _counterType;
}
}
/// <summary>
/// Static functions to calculate the performance value off the sample
/// </summary>
public static float Calculate(CounterSample counterSample)
{
return CounterSampleCalculator.ComputeCounterValue(counterSample);
}
/// <summary>
/// Static functions to calculate the performance value off the samples
/// </summary>
public static float Calculate(CounterSample counterSample, CounterSample nextCounterSample)
{
return CounterSampleCalculator.ComputeCounterValue(counterSample, nextCounterSample);
}
public override bool Equals(Object o)
{
return (o is CounterSample) && Equals((CounterSample)o);
}
public bool Equals(CounterSample sample)
{
return (_rawValue == sample._rawValue) &&
(_baseValue == sample._baseValue) &&
(_timeStamp == sample._timeStamp) &&
(_counterFrequency == sample._counterFrequency) &&
(_counterType == sample._counterType) &&
(_timeStamp100nSec == sample._timeStamp100nSec) &&
(_systemFrequency == sample._systemFrequency) &&
(_counterTimeStamp == sample._counterTimeStamp);
}
public override int GetHashCode()
{
return _rawValue.GetHashCode();
}
public static bool operator ==(CounterSample a, CounterSample b)
{
return a.Equals(b);
}
public static bool operator !=(CounterSample a, CounterSample b)
{
return !(a.Equals(b));
}
}
}

View File

@@ -0,0 +1,250 @@
// 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.ComponentModel;
using System.IO;
using System.Runtime.InteropServices;
using System.Security.Permissions;
using System.Globalization;
namespace System.Diagnostics
{
/// <summary>
/// Set of utility functions for interpreting the counter data
/// </summary>
public static class CounterSampleCalculator
{
private static volatile bool s_perfCounterDllLoaded = false;
/// <summary>
/// Converts 100NS elapsed time to fractional seconds
/// </summary>
/// <internalonly/>
private static float GetElapsedTime(CounterSample oldSample, CounterSample newSample)
{
float eSeconds;
float eDifference;
if (newSample.RawValue == 0)
{
// no data [start time = 0] so return 0
return 0.0f;
}
else
{
float eFreq;
eFreq = (float)(ulong)oldSample.CounterFrequency;
if (oldSample.UnsignedRawValue >= (ulong)newSample.CounterTimeStamp || eFreq <= 0.0f)
return 0.0f;
// otherwise compute difference between current time and start time
eDifference = (float)((ulong)newSample.CounterTimeStamp - oldSample.UnsignedRawValue);
// convert to fractional seconds using object counter
eSeconds = eDifference / eFreq;
return eSeconds;
}
}
/// <summary>
/// Computes the calculated value given a raw counter sample.
/// </summary>
public static float ComputeCounterValue(CounterSample newSample)
{
return ComputeCounterValue(CounterSample.Empty, newSample);
}
/// <summary>
/// Computes the calculated value given a raw counter sample.
/// </summary>
public static float ComputeCounterValue(CounterSample oldSample, CounterSample newSample)
{
int newCounterType = (int)newSample.CounterType;
if (oldSample.SystemFrequency == 0)
{
if ((newCounterType != Interop.Kernel32.PerformanceCounterOptions.PERF_RAW_FRACTION) &&
(newCounterType != Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_RAWCOUNT) &&
(newCounterType != Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_RAWCOUNT_HEX) &&
(newCounterType != Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_LARGE_RAWCOUNT) &&
(newCounterType != Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_LARGE_RAWCOUNT_HEX) &&
(newCounterType != Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_MULTI_BASE))
{
// Since oldSample has a system frequency of 0, this means the newSample is the first sample
// on a two sample calculation. Since we can't do anything with it, return 0.
return 0.0f;
}
}
else if (oldSample.CounterType != newSample.CounterType)
{
throw new InvalidOperationException(SR.Format(SR.MismatchedCounterTypes));
}
if (newCounterType == Interop.Kernel32.PerformanceCounterOptions.PERF_ELAPSED_TIME)
return (float)GetElapsedTime(oldSample, newSample);
Interop.Kernel32.PerformanceCounterOptions.PDH_RAW_COUNTER newPdhValue = new Interop.Kernel32.PerformanceCounterOptions.PDH_RAW_COUNTER();
Interop.Kernel32.PerformanceCounterOptions.PDH_RAW_COUNTER oldPdhValue = new Interop.Kernel32.PerformanceCounterOptions.PDH_RAW_COUNTER();
FillInValues(oldSample, newSample, oldPdhValue, newPdhValue);
LoadPerfCounterDll();
Interop.Kernel32.PerformanceCounterOptions.PDH_FMT_COUNTERVALUE pdhFormattedValue = new Interop.Kernel32.PerformanceCounterOptions.PDH_FMT_COUNTERVALUE();
long timeBase = newSample.SystemFrequency;
int result = Interop.PerfCounter.FormatFromRawValue((uint)newCounterType, Interop.Kernel32.PerformanceCounterOptions.PDH_FMT_DOUBLE | Interop.Kernel32.PerformanceCounterOptions.PDH_FMT_NOSCALE | Interop.Kernel32.PerformanceCounterOptions.PDH_FMT_NOCAP100,
ref timeBase, newPdhValue, oldPdhValue, pdhFormattedValue);
if (result != Interop.Errors.ERROR_SUCCESS)
{
// If the numbers go negative, just return 0. This better matches the old behavior.
if (result == Interop.Kernel32.PerformanceCounterOptions.PDH_CALC_NEGATIVE_VALUE || result == Interop.Kernel32.PerformanceCounterOptions.PDH_CALC_NEGATIVE_DENOMINATOR || result == Interop.Kernel32.PerformanceCounterOptions.PDH_NO_DATA)
return 0;
else
throw new Win32Exception(result, SR.Format(SR.PerfCounterPdhError, result.ToString("x", CultureInfo.InvariantCulture)));
}
return (float)pdhFormattedValue.data;
}
// This method figures out which values are supposed to go into which structures so that PDH can do the
// calculation for us. This was ported from Window's cutils.c
private static void FillInValues(CounterSample oldSample, CounterSample newSample, Interop.Kernel32.PerformanceCounterOptions.PDH_RAW_COUNTER oldPdhValue, Interop.Kernel32.PerformanceCounterOptions.PDH_RAW_COUNTER newPdhValue)
{
int newCounterType = (int)newSample.CounterType;
switch (newCounterType)
{
case Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_COUNTER:
case Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_QUEUELEN_TYPE:
case Interop.Kernel32.PerformanceCounterOptions.PERF_SAMPLE_COUNTER:
case Interop.Kernel32.PerformanceCounterOptions.PERF_OBJ_TIME_TIMER:
case Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_OBJ_TIME_QUEUELEN_TYPE:
newPdhValue.FirstValue = newSample.RawValue;
newPdhValue.SecondValue = newSample.TimeStamp;
oldPdhValue.FirstValue = oldSample.RawValue;
oldPdhValue.SecondValue = oldSample.TimeStamp;
break;
case Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_100NS_QUEUELEN_TYPE:
newPdhValue.FirstValue = newSample.RawValue;
newPdhValue.SecondValue = newSample.TimeStamp100nSec;
oldPdhValue.FirstValue = oldSample.RawValue;
oldPdhValue.SecondValue = oldSample.TimeStamp100nSec;
break;
case Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_TIMER:
case Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_TIMER_INV:
case Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_BULK_COUNT:
case Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_LARGE_QUEUELEN_TYPE:
case Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_MULTI_TIMER:
case Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_MULTI_TIMER_INV:
newPdhValue.FirstValue = newSample.RawValue;
newPdhValue.SecondValue = newSample.TimeStamp;
oldPdhValue.FirstValue = oldSample.RawValue;
oldPdhValue.SecondValue = oldSample.TimeStamp;
if (newCounterType == Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_MULTI_TIMER || newCounterType == Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_MULTI_TIMER_INV)
{
// this is to make PDH work like PERFMON for
// this counter type
newPdhValue.FirstValue *= (uint)newSample.CounterFrequency;
if (oldSample.CounterFrequency != 0)
{
oldPdhValue.FirstValue *= (uint)oldSample.CounterFrequency;
}
}
if ((newCounterType & Interop.Kernel32.PerformanceCounterOptions.PERF_MULTI_COUNTER) == Interop.Kernel32.PerformanceCounterOptions.PERF_MULTI_COUNTER)
{
newPdhValue.MultiCount = (int)newSample.BaseValue;
oldPdhValue.MultiCount = (int)oldSample.BaseValue;
}
break;
//
// These counters do not use any time reference
//
case Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_RAWCOUNT:
case Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_RAWCOUNT_HEX:
case Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_DELTA:
case Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_LARGE_RAWCOUNT:
case Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_LARGE_RAWCOUNT_HEX:
case Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_LARGE_DELTA:
newPdhValue.FirstValue = newSample.RawValue;
newPdhValue.SecondValue = 0;
oldPdhValue.FirstValue = oldSample.RawValue;
oldPdhValue.SecondValue = 0;
break;
//
// These counters use the 100 Ns time base in thier calculation
//
case Interop.Kernel32.PerformanceCounterOptions.PERF_100NSEC_TIMER:
case Interop.Kernel32.PerformanceCounterOptions.PERF_100NSEC_TIMER_INV:
case Interop.Kernel32.PerformanceCounterOptions.PERF_100NSEC_MULTI_TIMER:
case Interop.Kernel32.PerformanceCounterOptions.PERF_100NSEC_MULTI_TIMER_INV:
newPdhValue.FirstValue = newSample.RawValue;
newPdhValue.SecondValue = newSample.TimeStamp100nSec;
oldPdhValue.FirstValue = oldSample.RawValue;
oldPdhValue.SecondValue = oldSample.TimeStamp100nSec;
if ((newCounterType & Interop.Kernel32.PerformanceCounterOptions.PERF_MULTI_COUNTER) == Interop.Kernel32.PerformanceCounterOptions.PERF_MULTI_COUNTER)
{
newPdhValue.MultiCount = (int)newSample.BaseValue;
oldPdhValue.MultiCount = (int)oldSample.BaseValue;
}
break;
//
// These counters use two data points
//
case Interop.Kernel32.PerformanceCounterOptions.PERF_SAMPLE_FRACTION:
case Interop.Kernel32.PerformanceCounterOptions.PERF_RAW_FRACTION:
case Interop.Kernel32.PerformanceCounterOptions.PERF_LARGE_RAW_FRACTION:
case Interop.Kernel32.PerformanceCounterOptions.PERF_PRECISION_SYSTEM_TIMER:
case Interop.Kernel32.PerformanceCounterOptions.PERF_PRECISION_100NS_TIMER:
case Interop.Kernel32.PerformanceCounterOptions.PERF_PRECISION_OBJECT_TIMER:
case Interop.Kernel32.PerformanceCounterOptions.PERF_AVERAGE_TIMER:
case Interop.Kernel32.PerformanceCounterOptions.PERF_AVERAGE_BULK:
newPdhValue.FirstValue = newSample.RawValue;
newPdhValue.SecondValue = newSample.BaseValue;
oldPdhValue.FirstValue = oldSample.RawValue;
oldPdhValue.SecondValue = oldSample.BaseValue;
break;
default:
// an unidentified counter was returned so
newPdhValue.FirstValue = 0;
newPdhValue.SecondValue = 0;
oldPdhValue.FirstValue = 0;
oldPdhValue.SecondValue = 0;
break;
}
}
private static void LoadPerfCounterDll()
{
if (s_perfCounterDllLoaded)
return;
new FileIOPermission(PermissionState.Unrestricted).Assert();
string installPath = SharedUtils.GetLatestBuildDllDirectory(".");
string perfcounterPath = Path.Combine(installPath, "perfcounter.dll");
if (Interop.Kernel32.LoadLibrary(perfcounterPath) == IntPtr.Zero)
{
throw new Win32Exception(Marshal.GetLastWin32Error());
}
s_perfCounterDllLoaded = true;
}
}
}

View File

@@ -0,0 +1,105 @@
// 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.Reflection;
using System.Configuration;
namespace System.Diagnostics
{
internal enum InitState
{
NotInitialized,
Initializing,
Initialized
}
internal static class DiagnosticsConfiguration
{
private static volatile SystemDiagnosticsSection s_configSection;
private static volatile InitState s_initState = InitState.NotInitialized;
internal static int PerformanceCountersFileMappingSize
{
get
{
for (int retryCount = 0; !CanInitialize() && retryCount <= 5; ++retryCount)
{
if (retryCount == 5)
return SharedPerformanceCounter.DefaultCountersFileMappingSize;
System.Threading.Thread.Sleep(200);
}
Initialize();
SystemDiagnosticsSection configSectionSav = s_configSection;
if (configSectionSav != null && configSectionSav.PerfCounters != null)
{
int size = configSectionSav.PerfCounters.FileMappingSize;
if (size < SharedPerformanceCounter.MinCountersFileMappingSize)
size = SharedPerformanceCounter.MinCountersFileMappingSize;
if (size > SharedPerformanceCounter.MaxCountersFileMappingSize)
size = SharedPerformanceCounter.MaxCountersFileMappingSize;
return size;
}
else
return SharedPerformanceCounter.DefaultCountersFileMappingSize;
}
}
internal static string ConfigFilePath
{
get
{
Initialize();
SystemDiagnosticsSection configSectionSav = s_configSection;
return configSectionSav?.ElementInformation?.Source ?? string.Empty;
}
}
private static SystemDiagnosticsSection GetConfigSection()
{
SystemDiagnosticsSection configSection = (SystemDiagnosticsSection)ConfigurationManager.GetSection("system.diagnostics");
return configSection;
}
internal static bool CanInitialize()
{
bool setConfigurationSystemInProgress = (bool)(typeof(ConfigurationManager).GetProperty("SetConfigurationSystemInProgress", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null));
return (s_initState != InitState.Initializing) && !setConfigurationSystemInProgress;
}
internal static void Initialize()
{
// Initialize() is also called by other components outside of Trace (such as PerformanceCounter)
// as a result using one lock for this critical section and another for Trace API critical sections
// (such as Trace.WriteLine) could potentially lead to deadlock between 2 threads that are
// executing these critical sections (and consequently obtaining the 2 locks) in the reverse order.
// Using the same lock for DiagnosticsConfiguration as well as TraceInternal avoids this issue.
// Sequential locks on TraceInternal.critSec by the same thread is a non issue for this critical section.
lock (TraceInternal.critSec)
{
// because some of the code used to load config also uses diagnostics
// we can't block them while we initialize from config. Therefore we just
// return immediately and they just use the default values.
bool setConfigurationSystemInProgress = (bool)(typeof(ConfigurationManager).GetProperty("SetConfigurationSystemInProgress", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null));
if (s_initState != InitState.NotInitialized || setConfigurationSystemInProgress)
{
return;
}
s_initState = InitState.Initializing; // used for preventing recursion
try
{
s_configSection = GetConfigSection();
}
finally
{
s_initState = InitState.Initialized;
}
}
}
}
}

View File

@@ -0,0 +1,28 @@
// 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.Runtime.InteropServices;
namespace System.Diagnostics
{
/// <internalonly/>
[ComImport, Guid("73386977-D6FD-11D2-BED5-00C04F79E3AE"), System.Runtime.InteropServices.InterfaceTypeAttribute(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)]
public interface ICollectData
{
[return: MarshalAs(UnmanagedType.I4)]
void CollectData(
[In, MarshalAs(UnmanagedType.I4 )]
int id,
[In, MarshalAs(UnmanagedType.SysInt )]
IntPtr valueName,
[In, MarshalAs(UnmanagedType.SysInt )]
IntPtr data,
[In, MarshalAs(UnmanagedType.I4 )]
int totalBytes,
[Out, MarshalAs(UnmanagedType.SysInt)]
out IntPtr res);
void CloseData();
}
}

View File

@@ -0,0 +1,30 @@
// 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.
namespace System.Diagnostics
{
/// <summary>
/// A holder of instance data.
/// </summary>
public class InstanceData
{
public InstanceData(string instanceName, CounterSample sample)
{
InstanceName = instanceName;
Sample = sample;
}
public string InstanceName { get; }
public CounterSample Sample { get; }
public long RawValue
{
get
{
return Sample.RawValue;
}
}
}
}

View File

@@ -0,0 +1,78 @@
// 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.Collections;
using System.Globalization;
namespace System.Diagnostics
{
/// <summary>
/// A collection containing all the instance data for a counter. This collection is contained in the
/// <see cref='System.Diagnostics.InstanceDataCollectionCollection'/> when using the
/// <see cref='System.Diagnostics.PerformanceCounterCategory.ReadCategory'/> method.
/// </summary>
public class InstanceDataCollection : DictionaryBase
{
[Obsolete("This constructor has been deprecated. Please use System.Diagnostics.InstanceDataCollectionCollection.get_Item to get an instance of this collection instead. http://go.microsoft.com/fwlink/?linkid=14202")]
public InstanceDataCollection(string counterName)
{
if (counterName == null)
throw new ArgumentNullException(nameof(counterName));
CounterName = counterName;
}
public string CounterName { get; }
public ICollection Keys
{
get { return Dictionary.Keys; }
}
public ICollection Values
{
get
{
return Dictionary.Values;
}
}
public InstanceData this[string instanceName]
{
get
{
if (instanceName == null)
throw new ArgumentNullException(nameof(instanceName));
if (instanceName.Length == 0)
instanceName = PerformanceCounterLib.SingleInstanceName;
string objectName = instanceName.ToLower(CultureInfo.InvariantCulture);
return (InstanceData)Dictionary[objectName];
}
}
internal void Add(string instanceName, InstanceData value)
{
string objectName = instanceName.ToLower(CultureInfo.InvariantCulture);
Dictionary.Add(objectName, value);
}
public bool Contains(string instanceName)
{
if (instanceName == null)
throw new ArgumentNullException(nameof(instanceName));
string objectName = instanceName.ToLower(CultureInfo.InvariantCulture);
return Dictionary.Contains(objectName);
}
public void CopyTo(InstanceData[] instances, int index)
{
Dictionary.Values.CopyTo(instances, index);
}
}
}

View File

@@ -0,0 +1,67 @@
// 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.Collections;
using System.Globalization;
namespace System.Diagnostics
{
/// <summary>
/// The collection returned from the <see cref='System.Diagnostics.PerformanceCounterCategory.ReadCategory'/> method.
/// that contains all the counter and instance data.
/// The collection contains an InstanceDataCollection object for each counter. Each InstanceDataCollection
/// object contains the performance data for all counters for that instance. In other words the data is
/// indexed by counter name and then by instance name.
/// </summary>
public class InstanceDataCollectionCollection : DictionaryBase
{
[Obsolete("This constructor has been deprecated. Please use System.Diagnostics.PerformanceCounterCategory.ReadCategory() to get an instance of this collection instead. http://go.microsoft.com/fwlink/?linkid=14202")]
public InstanceDataCollectionCollection() : base() { }
public InstanceDataCollection this[string counterName]
{
get
{
if (counterName == null)
throw new ArgumentNullException(nameof(counterName));
object objectName = counterName.ToLower(CultureInfo.InvariantCulture);
return (InstanceDataCollection)Dictionary[objectName];
}
}
public ICollection Keys
{
get { return Dictionary.Keys; }
}
public ICollection Values
{
get
{
return Dictionary.Values;
}
}
internal void Add(string counterName, InstanceDataCollection value)
{
object objectName = counterName.ToLower(CultureInfo.InvariantCulture);
Dictionary.Add(objectName, value);
}
public bool Contains(string counterName)
{
if (counterName == null)
throw new ArgumentNullException(nameof(counterName));
object objectName = counterName.ToLower(CultureInfo.InvariantCulture);
return Dictionary.Contains(objectName);
}
public void CopyTo(InstanceDataCollection[] counters, int index)
{
Dictionary.Values.CopyTo((Array)counters, index);
}
}
}

View File

@@ -0,0 +1,19 @@
// 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.Configuration;
namespace System.Diagnostics
{
internal class PerfCounterSection : ConfigurationElement
{
private static readonly ConfigurationProperty s_propFileMappingSize = new ConfigurationProperty("filemappingsize", typeof(int), 524288, ConfigurationPropertyOptions.None);
private static readonly ConfigurationPropertyCollection s_properties = new ConfigurationPropertyCollection { s_propFileMappingSize };
[ConfigurationProperty("filemappingsize", DefaultValue = 524288)]
public int FileMappingSize => (int)this[s_propFileMappingSize];
protected override ConfigurationPropertyCollection Properties => s_properties;
}
}

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