Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


ProfilerMarker

Constructs a new performance marker for code instrumentation.
Read time 3 minutesLast updated 5 days ago

Definition

  • Type: Constructor
  • Namespace: Unity.Profiling
  • Assembly: UnityEngine.CoreModule

ProfilerMarker(string)

Constructs a new performance marker for code instrumentation.
public ProfilerMarker(string name)

Parameters

name

Marker name.

Remarks

Use ProfilerMarker to markup a piece of code for the Profiler and Recorder.

Examples

using Unity.Profiling;public class MySystemClass{ static readonly ProfilerMarker s_PreparePerfMarker = new ProfilerMarker("MySystem.Prepare"); static readonly ProfilerMarker s_SimulatePerfMarker = new ProfilerMarker(ProfilerCategory.Ai, "MySystem.Simulate"); public void UpdateLogic() { s_PreparePerfMarker.Begin(); // ... s_PreparePerfMarker.End(); using (s_SimulatePerfMarker.Auto()) { // ... } }}

ProfilerMarker(char*, int)

Constructs a new performance marker for code instrumentation.
public ProfilerMarker(char* name, int nameLen)

Parameters

name

Marker name.

nameLen

Marker name length.

Remarks

Use ProfilerMarker to markup a piece of code for the Profiler and Recorder.

Examples

using Unity.Profiling;public class MySystemClass{ static readonly ProfilerMarker s_PreparePerfMarker = new ProfilerMarker("MySystem.Prepare"); static readonly ProfilerMarker s_SimulatePerfMarker = new ProfilerMarker(ProfilerCategory.Ai, "MySystem.Simulate"); public void UpdateLogic() { s_PreparePerfMarker.Begin(); // ... s_PreparePerfMarker.End(); using (s_SimulatePerfMarker.Auto()) { // ... } }}

ProfilerMarker(ProfilerCategory, string)

Constructs a new performance marker for code instrumentation.
public ProfilerMarker(ProfilerCategory category, string name)

Parameters

Profiler category.

name

Marker name.

Remarks

Use ProfilerMarker to markup a piece of code for the Profiler and Recorder.

Examples

using Unity.Profiling;public class MySystemClass{ static readonly ProfilerMarker s_PreparePerfMarker = new ProfilerMarker("MySystem.Prepare"); static readonly ProfilerMarker s_SimulatePerfMarker = new ProfilerMarker(ProfilerCategory.Ai, "MySystem.Simulate"); public void UpdateLogic() { s_PreparePerfMarker.Begin(); // ... s_PreparePerfMarker.End(); using (s_SimulatePerfMarker.Auto()) { // ... } }}

ProfilerMarker(ProfilerCategory, char*, int)

Constructs a new performance marker for code instrumentation.
public ProfilerMarker(ProfilerCategory category, char* name, int nameLen)

Parameters

Profiler category.

name

Marker name.

nameLen

Marker name length.

Remarks

Use ProfilerMarker to markup a piece of code for the Profiler and Recorder.

Examples

using Unity.Profiling;public class MySystemClass{ static readonly ProfilerMarker s_PreparePerfMarker = new ProfilerMarker("MySystem.Prepare"); static readonly ProfilerMarker s_SimulatePerfMarker = new ProfilerMarker(ProfilerCategory.Ai, "MySystem.Simulate"); public void UpdateLogic() { s_PreparePerfMarker.Begin(); // ... s_PreparePerfMarker.End(); using (s_SimulatePerfMarker.Auto()) { // ... } }}

ProfilerMarker(string, MarkerFlags)

Constructs a new performance marker for code instrumentation.
public ProfilerMarker(string name, MarkerFlags flags)

Parameters

name

Marker name.

The marker flags.

Remarks

Use ProfilerMarker to markup a piece of code for the Profiler and Recorder.

Examples

using Unity.Profiling;public class MySystemClass{ static readonly ProfilerMarker s_PreparePerfMarker = new ProfilerMarker("MySystem.Prepare"); static readonly ProfilerMarker s_SimulatePerfMarker = new ProfilerMarker(ProfilerCategory.Ai, "MySystem.Simulate"); public void UpdateLogic() { s_PreparePerfMarker.Begin(); // ... s_PreparePerfMarker.End(); using (s_SimulatePerfMarker.Auto()) { // ... } }}

ProfilerMarker(char*, int, MarkerFlags)

Constructs a new performance marker for code instrumentation.
public ProfilerMarker(char* name, int nameLen, MarkerFlags flags)

Parameters

name

Marker name.

nameLen

Marker name length.

The marker flags.

Remarks

Use ProfilerMarker to markup a piece of code for the Profiler and Recorder.

Examples

using Unity.Profiling;public class MySystemClass{ static readonly ProfilerMarker s_PreparePerfMarker = new ProfilerMarker("MySystem.Prepare"); static readonly ProfilerMarker s_SimulatePerfMarker = new ProfilerMarker(ProfilerCategory.Ai, "MySystem.Simulate"); public void UpdateLogic() { s_PreparePerfMarker.Begin(); // ... s_PreparePerfMarker.End(); using (s_SimulatePerfMarker.Auto()) { // ... } }}

ProfilerMarker(ProfilerCategory, string, MarkerFlags)

Constructs a new performance marker for code instrumentation.
public ProfilerMarker(ProfilerCategory category, string name, MarkerFlags flags)

Parameters

Profiler category.

name

Marker name.

The marker flags.

Remarks

Use ProfilerMarker to markup a piece of code for the Profiler and Recorder.

Examples

using Unity.Profiling;public class MySystemClass{ static readonly ProfilerMarker s_PreparePerfMarker = new ProfilerMarker("MySystem.Prepare"); static readonly ProfilerMarker s_SimulatePerfMarker = new ProfilerMarker(ProfilerCategory.Ai, "MySystem.Simulate"); public void UpdateLogic() { s_PreparePerfMarker.Begin(); // ... s_PreparePerfMarker.End(); using (s_SimulatePerfMarker.Auto()) { // ... } }}

ProfilerMarker(ProfilerCategory, char*, int, MarkerFlags)

Constructs a new performance marker for code instrumentation.
public ProfilerMarker(ProfilerCategory category, char* name, int nameLen, MarkerFlags flags)

Parameters

Profiler category.

name

Marker name.

nameLen

Marker name length.

The marker flags.

Remarks

Use ProfilerMarker to markup a piece of code for the Profiler and Recorder.

Examples

using Unity.Profiling;public class MySystemClass{ static readonly ProfilerMarker s_PreparePerfMarker = new ProfilerMarker("MySystem.Prepare"); static readonly ProfilerMarker s_SimulatePerfMarker = new ProfilerMarker(ProfilerCategory.Ai, "MySystem.Simulate"); public void UpdateLogic() { s_PreparePerfMarker.Begin(); // ... s_PreparePerfMarker.End(); using (s_SimulatePerfMarker.Auto()) { // ... } }}