(sigil profile)
Profiling Module
Provides CPU and memory profiling for Sigil programs.
Exports
profile-startprocedureStart 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-stopprocedureStop the profiler.
Disables data collection. Results are preserved until profile-reset is called.
profile-resetprocedureClear all profiling data.
Resets counters, timers, and allocation stats to zero.
profile-enabled?procedureCheck if the profiler is currently running.
profile-resultsprocedureGet raw profiling results as a list of association lists.
Each entry contains: name, calls, self-ns, total-ns, alloc-count, and alloc-bytes.
with-profilingprocedureRun 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-topprocedureGet top N entries sorted by self time (descending).
Returns a list of profile entries sorted by self-time, limited to N.
profile-reportprocedurePrint a formatted profiling report.
Displays the top N functions by self time with CPU and memory stats.