Profiler

class in UnityEngine.Profiling

Cambiar al Manual

Descripción

Controla el Profiler desde script.

You can add custom Profiler sections in your scripts with Profiler.BeginSample and Profiler.EndSample.

On standalone platforms, you can save all profiling information to a file, which allows you to inspect it later. To do this, you must specify a Profiler.logFile and set both Profiler.enabled and Profiler.enableBinaryLog to true.

Because use of the Profiler negatively affects the performance of your app, most of the Profiler API functionality is only available when "Development Build" is enabled. This means you must enable "Developer Build" if you want to use profiler API methods in your built app. Disabling "Development Build" makes your app run faster, but prevents you from using most of the Profiler API methods.

The exception to this are the Profiler API methods relating to memory usage. Because Unity manages most of its system memory at run-time, it can provide that information with no performance penalty, therefore those methods are available even if "Development Build" is not enabled. This applies to all memory-related Profiler API methods except Profiler.GetAllocatedMemoryForGraphicsDriver and Profiler.GetRuntimeMemorySizeLong, since they require extra profiling data only available in development builds.

Variables Estáticas

areaCountThe number of Profiler Areas that you can profile.
enableAllocationCallstacksEnables the recording of callstacks for managed allocations.
enableBinaryLogEnables the logging of profiling data to a file.
enabledHabilita el Profiler.
logFileSpecifies the file to use when writing profiling data.
maxUsedMemorySets the maximum amount of memory that Profiler uses for buffering data. This property is expressed in bytes.
usedHeapSizeLongReturns the number of bytes that Unity has allocated. This does not include bytes allocated by external libraries or drivers.

Funciones Estáticas

AddFramesFromFileDisplays the recorded profile data in the profiler.
BeginSampleEmpieza perfilando un pedazo de código con una etiqueta personalizada.
BeginThreadProfilingEnables profiling on the thread from which you call this method.
EmitFrameMetaDataWrite metadata associated with the current frame to the Profiler stream.
EndSampleEnds the current profiling sample.
EndThreadProfilingFrees the internal resources used by the Profiler for the thread.
GetAllocatedMemoryForGraphicsDriverReturns the amount of allocated memory for the graphics driver, in bytes.Solamente disponible en development players y el editor.
GetAreaEnabledReturns whether or not a given ProfilerArea is currently enabled.
GetMonoHeapSizeLongReturns the size of the reserved space for managed-memory.
GetMonoUsedSizeLongThe allocated managed-memory for live objects and non-collected objects.
GetRuntimeMemorySizeLongGathers the native-memory used by a Unity object.
GetTempAllocatorSizeReturns the size of the temp allocator.
GetTotalAllocatedMemoryLongThe total memory allocated by the internal allocators in Unity. Unity reserves large pools of memory from the system. This function returns the amount of used memory in those pools.
GetTotalReservedMemoryLongThe total memory Unity has reserved.
GetTotalUnusedReservedMemoryLongUnity allocates memory in pools for usage when unity needs to allocate memory. This function returns the amount of unused memory in these pools.
SetAreaEnabledEnable or disable a given ProfilerArea.
SetTempAllocatorRequestedSizeSets the size of the temp allocator.