Returns information about CPU usage by a function. Only returns valid data if the scriptProfile CVar is set to 1; returns 0 otherwise.

See also Debugging and Profiling functions.


usage, calls = GetFunctionCPUUsage(function, includeSubroutines)


  • function - A function reference (function)
  • includeSubroutines - True to include time spent in other functions called by the given function; false to count only time spent in the function body (boolean)


  • usage - Amount of CPU time used by the function (in milliseconds) since the UI was loaded or ResetCPUUsage() was last called (number)
  • calls - Number times the function was called (number)