sigildocs

(sigil profile)

Profiling Module

Provides CPU and memory profiling for Sigil programs.

Exports

profile-startprocedure

Start the profiler.

Enables collection of call counts, timing, and allocation data. Call profile-stop to end profiling and profile-results to retrieve the collected data.

profile-stopprocedure

Stop the profiler.

Disables data collection. Results are preserved until profile-reset is called.

profile-resetprocedure

Clear all profiling data.

Resets counters, timers, and allocation stats to zero.

Check if the profiler is currently running.

Get raw profiling results as a list of association lists.

Each entry contains: name, calls, self-ns, total-ns, alloc-count, and alloc-bytes.

Run THUNK with profiling enabled.

Clears profiling data, enables profiling, runs thunk, then stops profiling and returns the results.

Example:

(with-profiling (lambda () (fib 30)))
profile-topprocedure

Get top N entries sorted by self time (descending).

Returns a list of profile entries sorted by self-time, limited to N.

Print a formatted profiling report.

Displays the top N functions by self time with CPU and memory stats.