• Stefan Monnier's avatar
    Rewrite sampler to use Elisp hash-tables. · 3d80c99f
    Stefan Monnier authored
    * src/profiler.c: Remove filtering functionality.
    (is_in_trace, Qgc): Remove vars.
    (make_log, record_backtrace, Fsample_profiler_log):
    Rewrite, using Elisp hash-tables.
    (approximate_median, evict_lower_half): New functions.
    (cpu_log): Rename from sample_log.
    (cpu_gc_count): New var.
    (Fsample_profiler_reset, Fmemory_profiler_reset): Remove.
    (sigprof_handler): Add count to cpu_gc_count during GC, detected via
    backtrace_list.
    (block_sigprof, unblock_sigprof): Remove.
    (gc_probe, mark_profiler): Remove functions.
    (syms_of_profiler): Staticpro cpu_log and memory_log.
    
    * lisp/profiler.el (profiler-sample-interval): Move before first use.
    Change default to 1ms.
    (profiler-entry=, profiler-backtrace-reverse, profiler-log-fixup-slot)
    (profiler-calltree-elapsed<, profiler-calltree-elapsed>): Remove functions.
    (profiler-entry-format): Don't use type-of.
    (profiler-slot, profiler-log): Remove structs.
    (profiler-log-timestamp, profiler-log-type, profiler-log-diff-p):
    Redefine for new log representation.
    (profiler-log-diff, profiler-log-fixup, profiler-calltree-build-1):
    Rewrite for new log representation.
    (profiler-calltree): Remove `elapsed' fields.
    (profiler-calltree-count<, profiler-report-make-entry-part):
    Remove gc special case.
    (profiler-calltree-find): Use equal.
    (profiler-calltree-walk): Remove `args'; rely on closures instead.
    (profiler-calltree-compute-percentages-1): Remove; inlined.
    (profiler-calltree-compute-percentages): Simplify.
    (profiler-report-log, profiler-report-reversed)
    (profiler-report-order): Use defvar-local.
    (profiler-report-line-format): Remove `elapsed', do a bit of CSE.
    (profiler-report-mode-map): Remove up/down bindings.
    (profiler-report-make-buffer-name): Simplify by CSE.
    (profiler-report-mode): Remove redundant code.
    (profiler-report-expand-entry, profiler-report-collapse-entry):
    Use inhibit-read-only.
    (profiler-report-render-calltree-1): Simplify by CSE.
    (profiler-reset): Rewrite for new subroutines.
    (profiler--report-cpu): Rename from sample-profiler-report.
    (profiler--report-memory): Rename from memory-profiler-report.
    
    * src/alloc.c (Fgarbage_collect): Record itself in backtrace_list.
    Don't set is_in_trace any more.  Don't call mark_profiler.
    Only call gc_probe for the memory profiler.
    (syms_of_alloc): Define Qautomatic_gc.
    
    * src/lisp.h (SXHASH_COMBINE): Move back to...
    * src/fns.c (SXHASH_COMBINE): ...here.
    
    * src/xdisp.c (Qautomatic_redisplay): New constant.
    (redisplay_internal): Record itself in backtrace_list.
    (syms_of_xdisp): Define Qautomatic_redisplay.
    
    * .dir-locals.el (indent-tabs-mode): Remove personal preference.
    3d80c99f
lisp.h 129 KB