Skip to content

Debug Profiling

scripts/vscripts/alyxlib/debug/profiling.lua

Methods

Profile

Profile a single function.

If profiling a single function, use profiler.totalTime to get the total time the function took to run.

If profiling a think, use profiler:GetMean() and other methods.

Profiler:Profile(func)

Parameters

  • func
    function
    The function to profile

Returns - any Returns the result of func

GetMean

Get the mean (average) profiled time in seconds.

Profiler:GetMean()

Returns - number

GetMedian

Get the median profiled time in seconds.

Profiler:GetMedian()

Returns - number

GetStandardDeviation

Calculate the standard deviation of the measurements.

The standard deviation is used to determine how spread out the measurements are. The higher the value, the more the measurements deviate from the mean, indicating greater variability. A lower value means the measurements are closer to the mean, indicating more consistency. A result of 0 means there is no variability (either because all measurements are the same, or there are no measurements).

Profiler:GetStandardDeviation()

Returns - number

Functions

Profiler

Creates a new profiler instance.

Profiler(useRunningTotal)

Parameters

  • useRunningTotal (optional)
    boolean
    If the profiler should keep a running total instead of keeping all profiled times in memory (use this if you run out of memory profiling)

Returns - Profiler

Types

Profiler

Profiler class