Recorder

class in UnityEngine.Profiling

Cambiar al Manual

Descripción

Records profiling data produced by a specific Sampler.

Recorder accumulates elapsed time of every Begin/End pair during a frame. Once enabled it sums delta time between Begin and End samples produced by a Sampler. Use elapsedNanoseconds to get the accumulated time for the previous frame.

using UnityEngine;
using UnityEngine.Profiling;

public class ExampleClass : MonoBehaviour { Recorder behaviourUpdateRecorder; void Start() { behaviourUpdateRecorder = Recorder.Get("BehaviourUpdate"); behaviourUpdateRecorder.enabled = true; }

void Update() { if (behaviourUpdateRecorder.isValid) Debug.Log("BehaviourUpdate time: " + behaviourUpdateRecorder.elapsedNanoseconds); } }

Note: A Recorder collects data regardless of the Profiler state. When a Recorder is enabled, data is accumulated every time its Sampler is hit. This information is equivalent to the one you can see in Hierarchy view in the Profiler Window.

At the moment Samplers are available only in the Editor and Development Players. Use Recorder.isValid to verify if Recorder can collect the data.

Recorder supports only internal static Profiler labels and labels generated by CustomSampler. Dynamic internal labels produced by scripting method calls and labels produced by Profiler.BeginSample are not supported.

See Also: Sampler, Recorder.isValid, Recorder.elapsedNanoseconds.

Variables

elapsedNanosecondsAccumulated time of Begin/End pairs for the previous frame in nanoseconds. (Read Only)
enabledEnables recording.
gpuElapsedNanosecondsGets the accumulated GPU time, in nanoseconds, for a frame. The Recorder has a three frame delay so this gives the timings for the frame that was three frames before the one that you access this property on. (Read Only).
gpuSampleBlockCountGets the number of Begin/End time pairs that the GPU executed during a frame. The Recorder has a three frame delay so this gives the timings for the frame that was three frames before the one that you access this property on. (Read Only).
isValidReturns true if Recorder is valid and can collect data. (Read Only)
sampleBlockCountNumber of time Begin/End pairs was called during the previous frame. (Read Only)

Funciones Públicas

CollectFromAllThreadsConfigures the recorder to collect samples from all threads.
FilterToCurrentThreadConfigures the recorder to only collect data from the current thread.

Funciones Estáticas

GetUse this function to get a Recorder for the specific Profiler label.
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961