profile_stats
Builtin index · REPL & diagnostics
result = profiling_mode(true)
Input: true · Output: result
What it is
profiling_mode takes one argument, a boolean (true to start recording, false to stop), and returns none. profile_stats() takes no arguments and returns a Table value with columns function, calls, and seconds, one row per builtin called while recording was on. Record per-builtin time and call counts, then read them back; off by default, because the recording itself costs something.
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
result = profiling_mode(true) | true boolean, Table, or Recordnot documented yet | result Table | Returns a Table from profile_stats, with columns function, calls and seconds; profiling_mode hands back no value. See also the Timers section above, which lays out all four of Qu's profiling/timing mechanisms side by side (tic/toc, timer/preciseTimer, profile_start/profile_end, and this one) and says when to reach for which. |
Examples
From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.
function load_and_process(path)
profiling_mode(true)
data = read_csv(path, headers=true)
result = data.sort_by("value")
profiling_mode(false)
print(profile_stats()) # a real Table: function / calls / seconds
sandbox_mode(true)
try
touch("audit.log") # denied -- sandboxed for this section only
catch err
print("blocked: {err.message}")
end
sandbox_mode(false)
return result
end function
from quickstart
See also
profiling_mode — documented in the same entry.