Show / Hide Table of Contents

Class PerformanceManager

Class for managing performance counters (PerformanceCounter) and producing performance reports.

Inheritance
System.Object
PerformanceManager
Namespace: Eco.Shared.Tools
Assembly: Eco.Shared.dll
Syntax
public class PerformanceManager : Object

Constructors

PerformanceManager()

Declaration
public PerformanceManager()

Properties

Active

Declaration
public bool Active { get; set; }
Property Value
Type Description
System.Boolean

Default

Returns Default PerformanceManager.

Declaration
public static PerformanceManager Default { get; }
Property Value
Type Description
PerformanceManager

Methods

AddPerformanceCounter(PerformanceCounter)

Adds new performance counter. If performance counter with same name already exists then throws System.InvalidOperationException.

Declaration
public PerformanceCounter AddPerformanceCounter(PerformanceCounter performanceCounter)
Parameters
Type Name Description
PerformanceCounter performanceCounter
Returns
Type Description
PerformanceCounter

AddPerformanceCounter(String, Func<PerformanceCounter, PerformanceCounter>)

Adds new performance counter. If performance counter with same name already exists then throws System.InvalidOperationException. Uses configure for custom counter configuration.

Declaration
public PerformanceCounter AddPerformanceCounter(string name, Func<PerformanceCounter, PerformanceCounter> configure)
Parameters
Type Name Description
System.String name
System.Func<PerformanceCounter, PerformanceCounter> configure
Returns
Type Description
PerformanceCounter

AddPerformanceCounter(String, Int32)

Adds new performance counter. If performance counter with same name already exists then throws System.InvalidOperationException..

Declaration
public PerformanceCounter AddPerformanceCounter(string name, int maxValues = 2147483647)
Parameters
Type Name Description
System.String name
System.Int32 maxValues
Returns
Type Description
PerformanceCounter

AddPerformanceCounter(String, Int32, Func<PerformanceCounter, PerformanceCounter>)

Adds new performance counter. If performance counter with same name already exists then throws System.InvalidOperationException. Uses configure for custom counter configuration.

Declaration
public PerformanceCounter AddPerformanceCounter(string name, int maxValues, Func<PerformanceCounter, PerformanceCounter> configure)
Parameters
Type Name Description
System.String name
System.Int32 maxValues
System.Func<PerformanceCounter, PerformanceCounter> configure
Returns
Type Description
PerformanceCounter

GetCounters()

Declaration
public ICollection<PerformanceCounter> GetCounters()
Returns
Type Description
System.Collections.Generic.ICollection<PerformanceCounter>

GetOrAddPerformanceCounter(String, Int32)

Declaration
public PerformanceCounter GetOrAddPerformanceCounter(string name, int maxValues = 2147483647)
Parameters
Type Name Description
System.String name
System.Int32 maxValues
Returns
Type Description
PerformanceCounter

GetReport(PerformanceReportFormat)

Returns report as string. Content depends on format. Read details about format in PerformanceReportFormat documentation.

Declaration
public string GetReport(PerformanceReportFormat format)
Parameters
Type Name Description
PerformanceReportFormat format
Returns
Type Description
System.String

GetTime()

Declaration
public TimeSpan GetTime()
Returns
Type Description
System.TimeSpan

SaveReport(PerformanceReportFormat)

Saves report to PerformanceManagerReport.txt or PerformanceManagerReport.json (for Trace format).

Declaration
public void SaveReport(PerformanceReportFormat format)
Parameters
Type Name Description
PerformanceReportFormat format

WriteReport(TextWriter, PerformanceReportFormat)

Writes report to writer. Content depends on format. Read details about format in PerformanceReportFormat documentation.

Declaration
public void WriteReport(TextWriter writer, PerformanceReportFormat format)
Parameters
Type Name Description
System.IO.TextWriter writer
PerformanceReportFormat format

WriteReportFullFormat(TextWriter)

Writes report in full format with all counter values.

Declaration
protected void WriteReportFullFormat(TextWriter writer)
Parameters
Type Name Description
System.IO.TextWriter writer

WriteReportShorterFormat(TextWriter)

Writes report in Shorter format, condensing information more than Short version, not supporting specific periods.

Declaration
protected void WriteReportShorterFormat(TextWriter writer)
Parameters
Type Name Description
System.IO.TextWriter writer

WriteReportShortFormat(TextWriter)

Writes report in short format. Only summary statistic (minimum, maximum and average values).

Declaration
protected void WriteReportShortFormat(TextWriter writer)
Parameters
Type Name Description
System.IO.TextWriter writer

WriteReportTraceFormat(TextWriter)

Writes report in trace format. Contains all data from counters in JSON format.

Declaration
protected void WriteReportTraceFormat(TextWriter writer)
Parameters
Type Name Description
System.IO.TextWriter writer

Extension Methods

CommandLine.FeedFromCommandLine(Object)
CommandLine.ToCommandLineArgs(Object, Func<Object, Boolean>)
ListUtil.DepthFirstTraversal<T>(T, Func<T, IEnumerable<T>>)
EnumerableExtensions.SingleItemAsEnumerable<T>(T)
EventUtils.RaiseEvent<TEventArgs>(Object, String, TEventArgs)
PredicateUtils.MatchesAll<TEnumerable, T>(T, TEnumerable)
PredicateUtils.MatchesAll<T>(T, Func<T, Boolean>[])
PredicateUtils.MatchesAny<TEnumerable, T>(T, TEnumerable)
ReflectionUtils.PropertyValue<T>(Object, PropertyInfo)
ReflectionUtils.TryGetPropertyValueByName<T>(Object, String, out T)
ReflectionUtils.GetPropertyValueByName<T>(Object, String)
ReflectionUtils.SetPropertyByName(Object, String, Object)
ReflectionUtils.GetStructPropertyByName<T>(Object, String)
ReflectionUtils.GetStringPropertyByName(Object, String)
ReflectionUtils.ZipByProperty<T>(Object, Object, Object, Func<T, T, T>)
☀
☾
In This Article
Back to top
Copyright (c) Strange Loop Games 2021
☀
☾