Struct ProfilingState
- Namespace
- Stride.Core.Diagnostics
- Assembly
- Stride.Core.dll
A profiler state contains information of a portion of code being profiled. See remarks.
public struct ProfilingState : IDisposable
- Implements
- Inherited Members
- Extension Methods
Remarks
This struct is not intended to be used directly but only through Begin(ProfilingKey). You can still attach some attributes to it while profiling a portion of code.
Properties
Attributes
A list of attributes (dimensions) associated with this profiling state.
public readonly TagList Attributes { get; }
Property Value
IsInitialized
Gets a value indicating whether this instance is initialized.
public bool IsInitialized { get; }
Property Value
- bool
true
if this instance is initialized; otherwise,false
.
ProfilingId
Gets the profiling unique identifier.
public readonly int ProfilingId { get; }
Property Value
- int
The profiling unique identifier.
ProfilingKey
Gets the profiling key.
public readonly ProfilingKey ProfilingKey { get; }
Property Value
- ProfilingKey
The profiling key.
TickFrequency
Gets or sets the TickFrequency used to convert long timestamp to TimeSpan. By default for CPU events it's Frequency and for GPU events it's set by the rendering code."/>
public long TickFrequency { get; set; }
Property Value
Methods
Begin()
public void Begin()
Begin(string, ProfilingCustomValue?, ProfilingCustomValue?, ProfilingCustomValue?, ProfilingCustomValue?)
Emits a Begin event with the specified formatted text.
public void Begin(string text, ProfilingCustomValue? value0 = null, ProfilingCustomValue? value1 = null, ProfilingCustomValue? value2 = null, ProfilingCustomValue? value3 = null)
Parameters
text
stringThe event text.
value0
ProfilingCustomValue?First value (can be int, float, long or double).
value1
ProfilingCustomValue?Second value (can be int, float, long or double).
value2
ProfilingCustomValue?Third value (can be int, float, long or double).
value3
ProfilingCustomValue?Fourth value (can be int, float, long or double).
CheckIfEnabled()
Checks if the profiling key is enabled and update this instance. See remarks.
public void CheckIfEnabled()
Remarks
This can be used for long running profiling that are using markers and want to log markers if the profiling was activated at runtime.
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
End()
Emits a End profiling event.
public void End()
End(string, ProfilingCustomValue?, ProfilingCustomValue?, ProfilingCustomValue?, ProfilingCustomValue?)
Emits a End profiling event with the specified custom value.
public void End(string text, ProfilingCustomValue? value0 = null, ProfilingCustomValue? value1 = null, ProfilingCustomValue? value2 = null, ProfilingCustomValue? value3 = null)
Parameters
text
stringThe event text.
value0
ProfilingCustomValue?First value (can be int, float, long or double).
value1
ProfilingCustomValue?Second value (can be int, float, long or double).
value2
ProfilingCustomValue?Third value (can be int, float, long or double).
value3
ProfilingCustomValue?Fourth value (can be int, float, long or double).
Mark()
Emits a Mark event.
public void Mark()
Mark(string, ProfilingCustomValue?, ProfilingCustomValue?, ProfilingCustomValue?, ProfilingCustomValue?)
Emits a Mark profiling event with the specified text.
public void Mark(string text, ProfilingCustomValue? value0 = null, ProfilingCustomValue? value1 = null, ProfilingCustomValue? value2 = null, ProfilingCustomValue? value3 = null)
Parameters
text
stringThe event text.
value0
ProfilingCustomValue?First value (can be int, float, long or double).
value1
ProfilingCustomValue?Second value (can be int, float, long or double).
value2
ProfilingCustomValue?Third value (can be int, float, long or double).
value3
ProfilingCustomValue?Fourth value (can be int, float, long or double).