x-lang

← Index

x/tool/profile

Performance profiling and smart garbage collection.

alloc-count

Return the number of heap objects allocated.

Returns: INTEGER — Total heap allocations since last reset

eval-count

Return the number of eval invocations.

Returns: INTEGER — Total eval calls since last reset

tco-count

Return the number of tail-call optimizations performed.

Returns: INTEGER — Total tail-call optimizations since last reset

assoc-calls-count

Return the number of association list lookup operations.

Returns: INTEGER — Total alist lookup calls

assoc-steps-count

Return the total steps walked during alist lookups.

Returns: INTEGER — Total alist walk steps

sym-find-calls-count

Return the number of symbol lookup operations.

Returns: INTEGER — Total symbol-find calls

sym-find-steps-count

Return the total steps walked during symbol lookups.

Returns: INTEGER — Total symbol-find steps

gc-runs-count

Return the number of garbage collection runs.

Returns: INTEGER — Total GC mark/sweep cycles

bst-hits-count

Return the number of successful BST (binary search tree) lookups.

Returns: INTEGER — BST cache hits

bst-misses-count

Return the number of BST lookups that fell through to alist walk.

Returns: INTEGER — BST cache misses

profile-reset

Reset all performance counters to zero.

heap-collect-force

Force a full GC mark/sweep cycle, returning the number of objects freed.

Returns: INTEGER — Number of objects freed

heap-collect

Smart GC: only collect when allocations since last run exceed surviving objects.

Returns: INTEGER — Number of objects freed, or 0 if skipped

profile-evals-max

Return the largest eval count an object can hold.

Returns: INTEGER — The value an eval count stops at

profile-evals

Return how many times evaluation reached an object.

Returns: INTEGER — Times evaluation reached obj, at most (profile-evals-max)

profile-tree

Sum the eval counts through a body or a form.

Returns: LIST — (evals nodes saturated): the counts summed, the pairs visited, and #t when a count was at its maximum

profile-fn

Return a function’s calls and the evaluation its body did, as a profiling engine counted them.

An operative’s calls are counted on its first form, so one whose body starts with a name or a constant reads 0 calls.

Returns: LIST — (calls evals nodes saturated), or nil when f has no body

profile-rows

Return the calls and evaluation of every function on the heap, by the file and line its body starts on.

Returns: LIST — One (file line calls evals nodes saturated) row for each function body evaluation reached, in no order

profile-clear!

Set the eval count of every object on the heap to zero, so that what is counted next belongs to what runs next.

Returns: NIL — nil

profile-report

Print the n functions whose bodies evaluation reached most, most first.

A + after a row’s evals says a count in that body was at its maximum, so the sum is a lower bound.

Returns: ANY — nil

profile-snapshot

Return the profile counters and heap count as they stand, for profile-dump.

Returns: LIST — The heap count, then each profile counter

profile-dump

Dump the profile counters and heap count to stderr, as they stand or as snap recorded them.