Class ProfilingSampler
Wrapper around CPU and GPU profiling samplers. Use this along ProfilingScope to profile a piece of code.
Namespace: UnityEngine.Rendering
Syntax
public class ProfilingSampler
Constructors
ProfilingSampler(String)
Constructor.
Declaration
public ProfilingSampler(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | Name of the profiling sampler. |
Properties
cpuElapsedTime
CPU Elapsed time in milliseconds (Command Buffer execution).
Declaration
public float cpuElapsedTime { get; }
Property Value
Type | Description |
---|---|
Single |
cpuSampleCount
Number of times the Profiling Sampler has hit on the CPU in the command buffer.
Declaration
public int cpuSampleCount { get; }
Property Value
Type | Description |
---|---|
Int32 |
enableRecording
Set to true to enable recording of profiling sampler timings.
Declaration
public bool enableRecording { set; }
Property Value
Type | Description |
---|---|
Boolean |
gpuElapsedTime
GPU Elapsed time in milliseconds.
Declaration
public float gpuElapsedTime { get; }
Property Value
Type | Description |
---|---|
Single |
gpuSampleCount
Number of times the Profiling Sampler has hit on the GPU
Declaration
public int gpuSampleCount { get; }
Property Value
Type | Description |
---|---|
Int32 |
inlineCpuElapsedTime
CPU Elapsed time in milliseconds (Direct execution).
Declaration
public float inlineCpuElapsedTime { get; }
Property Value
Type | Description |
---|---|
Single |
inlineCpuSampleCount
Number of times the Profiling Sampler has hit on the CPU.
Declaration
public int inlineCpuSampleCount { get; }
Property Value
Type | Description |
---|---|
Int32 |
name
Name of the Profiling Sampler
Declaration
public string name { get; }
Property Value
Type | Description |
---|---|
String |
Methods
Begin(CommandBuffer)
Begin the profiling block.
Declaration
public void Begin(CommandBuffer cmd)
Parameters
Type | Name | Description |
---|---|---|
CommandBuffer | cmd | Command buffer used by the profiling block. |
End(CommandBuffer)
End the profiling block.
Declaration
public void End(CommandBuffer cmd)
Parameters
Type | Name | Description |
---|---|---|
CommandBuffer | cmd | Command buffer used by the profiling block. |
Get<TEnum>(TEnum)
Get the sampler for the corresponding enumeration value.
Declaration
public static ProfilingSampler Get<TEnum>(TEnum marker)
where TEnum : Enum
Parameters
Type | Name | Description |
---|---|---|
TEnum | marker | Enumeration value. |
Returns
Type | Description |
---|---|
ProfilingSampler | The profiling sampler for the given enumeration value. |
Type Parameters
Name | Description |
---|---|
TEnum | Type of the enumeration. |