Profiling¶
-
@profile()¶ @profile <expression>runs your expression while taking periodic backtraces. These are appended to an internal buffer of backtraces.
-
clear()¶ Clear any existing backtraces from the internal buffer.
-
print([io::IO = STDOUT, ][data::Vector]; format = :tree, C = false, combine = true, cols = tty_cols())¶ Prints profiling results to
io(by default,STDOUT). If you do not supply adatavector, the internal buffer of accumulated backtraces will be used.formatcan be:treeor:flat. IfC==true, backtraces from C and Fortran code are shown.combine==truemerges instruction pointers that correspond to the same line of code.colscontrols the width of the display.
-
print([io::IO = STDOUT, ]data::Vector, lidict::Dict; format = :tree, combine = true, cols = tty_cols()) Prints profiling results to
io. This variant is used to examine results exported by a previous call toretrieve(). Supply the vectordataof backtraces and a dictionarylidictof line information.
-
init(; n::Integer, delay::Float64)¶ Configure the
delaybetween backtraces (measured in seconds), and the numbernof instruction pointers that may be stored. Each instruction pointer corresponds to a single line of code; backtraces generally consist of a long list of instruction pointers. Default settings can be obtained by calling this function with no arguments, and each can be set independently using keywords or in the order(n, delay).
-
fetch() → data¶ Returns a reference to the internal buffer of backtraces. Note that subsequent operations, like
clear(), can affectdataunless you first make a copy. Note that the values indatahave meaning only on this machine in the current session, because it depends on the exact memory addresses used in JIT-compiling. This function is primarily for internal use;retrieve()may be a better choice for most users.
-
retrieve() → data, lidict¶ “Exports” profiling results in a portable format, returning the set of all backtraces (
data) and a dictionary that maps the (session-specific) instruction pointers indatatoLineInfovalues that store the file name, function name, and line number. This function allows you to save profiling results for future analysis.
-
clear_malloc_data()¶ Clears any stored memory allocation data when running julia with
--track-allocation. Execute the command(s) you want to test (to force JIT-compilation), then callclear_malloc_data(). Then execute your command(s) again, quit julia, and examine the resulting*.memfiles.