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 Profiler.Begin(). You can still attach some attributes to it while profiling a portion of code.
Properties
DisposeDelegate
Gets or sets the dispose profile delegate.
public ProfilerDisposeEventDelegate DisposeDelegate { readonly get; set; }
Property Value
- ProfilerDisposeEventDelegate
The dispose profile delegate.
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.
Methods
Begin(ProfilingCustomValue?, ProfilingCustomValue?, ProfilingCustomValue?, ProfilingCustomValue?)
Emits a Begin event with the specified formatted text.
public void Begin(ProfilingCustomValue? value0, ProfilingCustomValue? value1 = null, ProfilingCustomValue? value2 = null, ProfilingCustomValue? value3 = null)
Parameters
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).
Begin(string)
Emits a Begin profiling event with the specified text.
public void Begin(string text = null)
Parameters
text
stringThe text.
Begin(string, ProfilingCustomValue?, ProfilingCustomValue?, ProfilingCustomValue?, ProfilingCustomValue?)
Emits a Begin event with the specified formatted text.
public void Begin(string text, ProfilingCustomValue? value0, 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).
Begin(string, params object[])
Emits a Begin profiling event with the specified formatted text.
public void Begin(string textFormat, params object[] textFormatArguments)
Parameters
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(ProfilingCustomValue?, ProfilingCustomValue?, ProfilingCustomValue?, ProfilingCustomValue?)
Emits a End profiling event with the specified custom value.
public void End(ProfilingCustomValue? value0, ProfilingCustomValue? value1 = null, ProfilingCustomValue? value2 = null, ProfilingCustomValue? value3 = null)
Parameters
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).
End(string)
Emits a End profiling event with the specified text.
public void End(string text)
Parameters
text
stringThe text.
End(string, ProfilingCustomValue?, ProfilingCustomValue?, ProfilingCustomValue?, ProfilingCustomValue?)
Emits a End profiling event with the specified custom value.
public void End(string text, ProfilingCustomValue? value0, 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).
End(string, params object[])
Emits a End profiling event with the specified formatted text.
public void End(string textFormat, params object[] textFormatArguments)
Parameters
GetAttribute(string)
Gets the attribute value.
public object GetAttribute(string key)
Parameters
key
stringThe key.
Returns
- object
Value of a key.
Remarks
If profiling was not enabled for this profile key, the attribute is not stored
Mark()
Emits a Mark event.
public void Mark()
Mark(ProfilingCustomValue?, ProfilingCustomValue?, ProfilingCustomValue?, ProfilingCustomValue?)
Emits a Mark profiling event with the specified text.
public void Mark(ProfilingCustomValue? value0, ProfilingCustomValue? value1 = null, ProfilingCustomValue? value2 = null, ProfilingCustomValue? value3 = null)
Parameters
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(string)
Emits a Mark event with the specified text.
public void Mark(string text)
Parameters
text
stringThe text.
Mark(string, ProfilingCustomValue?, ProfilingCustomValue?, ProfilingCustomValue?, ProfilingCustomValue?)
Emits a Mark profiling event with the specified text.
public void Mark(string text, ProfilingCustomValue? value0, 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(string, params object[])
Emits a Mark event with the specified formatted text.
public void Mark(string textFormat, params object[] textFormatArguments)
Parameters
SetAttribute(string, object)
Sets the attribute value for a specified key. See remarks.
public void SetAttribute(string key, object value)
Parameters
Remarks
If profiling was not enabled for this profile key, the attribute is not stored