A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.unity3d.com/Manual/sprite/../../ScriptReference/Profiling.CustomSampler.html below:

Unity - Scripting API: CustomSampler

CustomSampler

class in UnityEngine.Profiling

/

Inherits from:Profiling.Sampler

/

Implemented in:UnityEngine.CoreModule

Suggest a change Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close Your name Your email Suggestion*

Cancel

Description

Custom CPU Profiler label used for profiling arbitrary code blocks.

Use CustomSampler to measure execution time of script code blocks. Produced information is displayed in the CPU Profiler and can be captured with Recorder.
Using CustomSampler is more efficient than using Profiler.BeginSample to profile your code. This is because CustomSamplers that have been created in advance have very low Begin call overhead compared to Profiler.BeginSample.

using UnityEngine;
using UnityEngine.Profiling;

public class ExampleClass : MonoBehaviour { CustomSampler sampler; void Start() { sampler = CustomSampler.Create("MyCustomSampler"); }

void Update() { sampler.Begin(); // do something that takes a lot of time sampler.End(); } }

CustomSampler.Begin is conditionally compiled away using ConditionalAttribute. Thus it will have zero overhead, when it is deployed in non-Development Build.

Additional resources: Sampler, CustomSampler.Create, CustomSampler.Begin.

Public Methods Method Description Begin Begin profiling a piece of code with a custom label defined by this instance of CustomSampler. End End profiling a piece of code with a custom label. Static Methods Method Description Create Creates a new CustomSampler for profiling parts of your code. Inherited Members Properties Property Description isValid Returns true if Sampler is valid. (Read Only) name Sampler name. (Read Only) Public Methods Method Description GetRecorder Returns Recorder associated with the Sampler. Static Methods Method Description Get Returns Sampler object for the specific CPU Profiler label. GetNames Returns number and names of all registered Profiler labels.

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4