Class ProfilingSampler
Wrapper around CPU and GPU profiling samplers. Use this along ProfilingScope to profile a piece of code.
Inherited Members
Namespace: UnityEngine.Rendering
Assembly: Unity.RenderPipelines.Core.Runtime.dll
Syntax
[IgnoredByDeepProfiler]
public class ProfilingSamplerConstructors
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 | 
|---|---|
| float | 
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 | 
|---|---|
| int | 
enableRecording
Set to true to enable recording of profiling sampler timings.
Declaration
public bool enableRecording { set; }Property Value
| Type | Description | 
|---|---|
| bool | 
gpuElapsedTime
GPU Elapsed time in milliseconds.
Declaration
public float gpuElapsedTime { get; }Property Value
| Type | Description | 
|---|---|
| float | 
gpuSampleCount
Number of times the Profiling Sampler has hit on the GPU
Declaration
public int gpuSampleCount { get; }Property Value
| Type | Description | 
|---|---|
| int | 
inlineCpuElapsedTime
CPU Elapsed time in milliseconds (Direct execution).
Declaration
public float inlineCpuElapsedTime { get; }Property Value
| Type | Description | 
|---|---|
| float | 
inlineCpuSampleCount
Number of times the Profiling Sampler has hit on the CPU.
Declaration
public int inlineCpuSampleCount { get; }Property Value
| Type | Description | 
|---|---|
| int | 
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 : EnumParameters
| 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. |