Show / Hide Table of Contents

Class PerformancePlugin

Tracks potential performance problems in the server and generates a report. Eventually we can make these reports output from the server and track them across builds.

Inheritance
System.Object
PerformancePlugin
Implements
IHasDisplayTabs
IInitializablePlugin
IThreadedPlugin
IShutdownablePlugin
IConfigurablePlugin
IEditablePlugin
IGUIPlugin
IServerPlugin
Namespace: Eco.Core.DebugStatistic
Assembly: Eco.Core.dll
Syntax
public class PerformancePlugin : Singleton<PerformancePlugin>, IHasDisplayTabs, IInitializablePlugin, IThreadedPlugin, IShutdownablePlugin, IConfigurablePlugin, IEditablePlugin, IGUIPlugin, IServerPlugin

Constructors

PerformancePlugin()

Declaration
public PerformancePlugin()

Fields

IntervalCounters

Declaration
public static int[] IntervalCounters
Field Value
Type Description
System.Int32[]

IntervalTimes

Configured interval times used by the PerformancePlugin. These values must be multiples of each other.

Declaration
public static readonly double[] IntervalTimes
Field Value
Type Description
System.Double[]

Properties

CollectControllerStats

Flag to collect controller stats when a data is being captured or the controller stats tab is open.

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

Config

Declaration
public PerformanceConfig Config { get; }
Property Value
Type Description
PerformanceConfig

DisplayTabs

Declaration
public IEnumerable<IDisplayTab> DisplayTabs { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<IDisplayTab>

ParamChanged

Declaration
public ThreadSafeAction<object, string> ParamChanged { get; set; }
Property Value
Type Description
ThreadSafeAction<System.Object, System.String>

PluginConfig

Declaration
public IPluginConfig PluginConfig { get; }
Property Value
Type Description
IPluginConfig

Methods

AddMetricCollector<T>()

Registers a new metric collector with the performance plugin instance.

Declaration
public void AddMetricCollector<T>()
    where T : IMetricCollector, new()
Type Parameters
Name Description
T

IMetricCollector type to instantiate/register

GetCategory()

Declaration
public string GetCategory()
Returns
Type Description
System.String

GetControllerMetricsReport()

Returns the Controller Metrics report for displaying on the "Controller Stats" DisplayTab for the server GUI.

Declaration
public string GetControllerMetricsReport()
Returns
Type Description
System.String

GetCountOfObjectsReport()

Declaration
public string GetCountOfObjectsReport()
Returns
Type Description
System.String

GetEditObject()

Declaration
public object GetEditObject()
Returns
Type Description
System.Object

GetMetricsReport()

Generates and returns the report used in the "Metrics Stats" DisplayTab for the server GUI.

Declaration
public string GetMetricsReport()
Returns
Type Description
System.String

GetMonitoredMetrics()

Retrieves the currently stored metrics and metrics being tracked by our PerformanceManager instance for use in external metric publishing.

Declaration
public Dictionary<string, double> GetMonitoredMetrics()
Returns
Type Description
System.Collections.Generic.Dictionary<System.String, System.Double>

GetPerformanceManagerReport()

Returns the PerformanceManager GetReport results for displaying on the "Performance Manager" DisplayTab for the server GUI.

Declaration
public string GetPerformanceManagerReport()
Returns
Type Description
System.String

GetRepeatedNotificationsReport()

Declaration
public string GetRepeatedNotificationsReport()
Returns
Type Description
System.String

GetStatus()

Declaration
public string GetStatus()
Returns
Type Description
System.String

GetStoredMetrics()

This one is exposed via API to provide the historical data of metrics.

Declaration
public string GetStoredMetrics()
Returns
Type Description
System.String

GetValueMetric(String)

Retrieves the generic key/value metric currently being stored for reports/publishing.

Declaration
public double GetValueMetric(string name)
Parameters
Type Name Description
System.String name

Name of the metric to retrieve

Returns
Type Description
System.Double

Stored value if the metric exists. Otherwise 0.

HasMetricCollector(Type)

Declaration
public bool HasMetricCollector(Type type)
Parameters
Type Name Description
System.Type type
Returns
Type Description
System.Boolean

Initialize(TimedTask)

Declaration
public void Initialize(TimedTask timer)
Parameters
Type Name Description
TimedTask timer

OnEditObjectChanged(Object, String)

Declaration
public void OnEditObjectChanged(object o, string param)
Parameters
Type Name Description
System.Object o
System.String param

RemoveMetricCollector(Type)

Removes an existing metric collector instance from the performance plugin.

Declaration
public void RemoveMetricCollector(Type type)
Parameters
Type Name Description
System.Type type

IMetricCollector type to remove.

Run()

Starts our IWorker instance for generating performance reports.

Declaration
public void Run()

SetCaptureData(Boolean)

Enable/disable performance reports data collection

Declaration
public void SetCaptureData(bool enable)
Parameters
Type Name Description
System.Boolean enable

ShutdownAsync()

Declaration
public Task ShutdownAsync()
Returns
Type Description
System.Threading.Tasks.Task

StoreIntervalMetric(String, Int32, Double, Int32, Int32)

Declaration
public void StoreIntervalMetric(string name, int count, double ms, int controllerId, int playerId)
Parameters
Type Name Description
System.String name
System.Int32 count
System.Double ms
System.Int32 controllerId
System.Int32 playerId

StoreValueMetric(String, Double)

Stores a generic key/value metric for generating reports/publishing to external sources.

Declaration
public void StoreValueMetric(string name, double value)
Parameters
Type Name Description
System.String name

Name of the metric to store

System.Double value

Current value of the metric.

ToString()

Returns a string that represnets this object. Used by the Eco server to properly localize the plugin instance.

Declaration
public override string ToString()
Returns
Type Description
System.String

Returns a string that represnets this object.

Implements

IHasDisplayTabs
IInitializablePlugin
IThreadedPlugin
IShutdownablePlugin
IConfigurablePlugin
IEditablePlugin
IGUIPlugin
IServerPlugin

Extension Methods

PropertyChanges.FirePropertyChanged(Object, String)
PropertyChanges.FirePropertyChanged(Object, String, Object, Object)
PropertyChanges.FirePropertyChanged(Object, MemberChangedBeforeAfterEventArgs)
☀
☾
In This Article
Back to top
Copyright (c) Strange Loop Games 2021
☀
☾