docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class Measure

    Enables measuring of performance metrics during a performance test.

    Inheritance
    object
    Measure
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.PerformanceTesting
    Assembly: Unity.PerformanceTesting.dll
    Syntax
    public static class Measure

    Methods

    Custom(string, double)

    Saves provided value as a performance measurement.

    Declaration
    public static void Custom(string name, double value)
    Parameters
    Type Name Description
    string name

    The name of the sample group to save the value to.

    double value

    Value to be saved.

    Custom(SampleGroup, double)

    Saves provided value as a performance measurement.

    Declaration
    public static void Custom(SampleGroup sampleGroup, double value)
    Parameters
    Type Name Description
    SampleGroup sampleGroup

    The sample group to save the value to.

    double value

    Value to be saved.

    Frames()

    Measures frame times with given parameters.

    Declaration
    public static FramesMeasurement Frames()
    Returns
    Type Description
    FramesMeasurement

    FramesMeasurement using a builder pattern to provide parameters. Call Run() method to start measurement.

    Method(Action)

    Measures execution time for a method with given parameters.

    Declaration
    public static MethodMeasurement Method(Action action)
    Parameters
    Type Name Description
    Action action

    The action to be measured.

    Returns
    Type Description
    MethodMeasurement

    MethodMeasurementusing a builder pattern to provide parameters. Call ScopeMeasurement.Run to start measurement.

    ProfilerMarkers(params string[])

    Measures profiler markers for the given scope.

    Declaration
    public static ProfilerMeasurement ProfilerMarkers(params string[] profilerMarkerLabels)
    Parameters
    Type Name Description
    string[] profilerMarkerLabels

    List of profiler marker names.

    Returns
    Type Description
    ProfilerMeasurement

    A ProfilerMeasurement instance configured according to the given arguments.

    ProfilerMarkers(params SampleGroup[])

    Measures profiler markers for the given scope.

    Declaration
    public static ProfilerMeasurement ProfilerMarkers(params SampleGroup[] sampleGroups)
    Parameters
    Type Name Description
    SampleGroup[] sampleGroups

    List of SampleGroups where the name matches the profiler marker to measure.

    Returns
    Type Description
    ProfilerMeasurement

    A ProfilerMeasurement instance configured according to the given arguments.

    Scope(string)

    Measures execution time for the given scope as a single time.

    Declaration
    public static ScopeMeasurement Scope(string name = "Time")
    Parameters
    Type Name Description
    string name

    Name to use for the sample group.

    Returns
    Type Description
    ScopeMeasurement

    IDisposable ScopeMeasurement on which you should call the Dispose() method to stop measurement.

    Scope(SampleGroup)

    Measures execution time for the given scope as a single time.

    Declaration
    public static ScopeMeasurement Scope(SampleGroup sampleGroup)
    Parameters
    Type Name Description
    SampleGroup sampleGroup

    Sample group to use to save samples to.

    Returns
    Type Description
    ScopeMeasurement

    IDisposable ScopeMeasurement on which you should call the Dispose() method to stop measurement.

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)