Class CollectorBase
Abstract base class for simulation profiler collectors that gather performance and diagnostic data and dispatch it (by default as JSON) to the local file system.
Inherited Members
Namespace: Unity.SimulationPro
Assembly: Unity.SimulationPro.Capture.dll
Syntax
[Serializable]
public abstract class CollectorBase
Remarks
Subclass CollectorBase and implement PopulateEvents() to register EventBase instances. Collectors are managed by SimulationProfilerBase and invoked on a configurable period interval. Mark subclasses with IgnoreCollectorAttribute to exclude them from auto-discovery.
Constructors
CollectorBase()
Initializes a new CollectorBase instance, setting name to the concrete type name.
Declaration
protected CollectorBase()
Fields
CollectorConsumer
Consumer delegate to consume the collector profiler report. Invoked when the collector is ready for dispatch.
Declaration
public CollectorBase.ConsumeCollectorReport CollectorConsumer
Field Value
| Type | Description |
|---|---|
| CollectorBase.ConsumeCollectorReport |
category
Category for simulation profiler collector. Default is set to Logic.
Declaration
[SerializeField]
[HideInInspector]
public Category category
Field Value
| Type | Description |
|---|---|
| Category |
m_Enabled
Field indicating if the collector is enabled.
Declaration
[SerializeField]
[HideInInspector]
public bool m_Enabled
Field Value
| Type | Description |
|---|---|
| bool |
name
Name of the collector. Default is set to the name of the type.
Declaration
[SerializeField]
public string name
Field Value
| Type | Description |
|---|---|
| string |
pathOnFileSystem
The file system path where this collector writes its output data.
Declaration
[HideInInspector]
public string pathOnFileSystem
Field Value
| Type | Description |
|---|---|
| string |
period
Period at which the collector dispatch needs to be invoked.
Declaration
public int period
Field Value
| Type | Description |
|---|---|
| int |
simulationElapsedTime
The elapsed simulation time in seconds since the collector was started.
Declaration
[HideInInspector]
public float simulationElapsedTime
Field Value
| Type | Description |
|---|---|
| float |
Properties
defaultDispatcherEnabled
Returns if the default collector dispatcher is enabled.
Declaration
public bool defaultDispatcherEnabled { get; protected set; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
AddEvent(EventBase)
Add Continuous event to the collector for profiling.
Declaration
public void AddEvent(EventBase e)
Parameters
| Type | Name | Description |
|---|---|---|
| EventBase | e | The event to register with this collector. |
DispatchCollector(ProfilerReport)
Dispatch collector at an interval. Override this to dispatch the results to any other location other than local file system.
Declaration
public virtual void DispatchCollector(ProfilerReport report)
Parameters
| Type | Name | Description |
|---|---|---|
| ProfilerReport | report | The profiler report to dispatch. |
GetEvents()
Get all the events associated with the collector.
Declaration
public List<EventBase> GetEvents()
Returns
| Type | Description |
|---|---|
| List<EventBase> | The list of EventBase instances registered with this collector. |
Initialize()
Initialize your collector settings here.
Declaration
public virtual void Initialize()
PopulateEvents()
Called once during initialization to register all EventBase instances this collector tracks by calling AddEvent(EventBase).
Declaration
public abstract void PopulateEvents()