Function: profiler-compare-logs

profiler-compare-logs is a byte-compiled function defined in profiler.el.gz.

Signature

(profiler-compare-logs LOG1 LOG2)

Documentation

Compare LOG1 with LOG2 and return diff.

Source Code

;; Defined in /usr/src/emacs/lisp/profiler.el.gz
;;; Logs

;; The C code returns the log in the form of a hash-table where the keys are
;; vectors (of size profiler-max-stack-depth, holding truncated
;; backtraces, where the first element is the top of the stack) and
;; the values are integers (which count how many times this backtrace
;; has been seen, multiplied by a "weight factor" which is either the
;; sampling-interval or the memory being allocated).

(defun profiler-compare-logs (log1 log2)
  "Compare LOG1 with LOG2 and return diff."
  (let ((newlog (make-hash-table :test 'equal)))
    ;; Make a copy of `log1' into `newlog'.
    (maphash (lambda (backtrace count) (puthash backtrace count newlog))
             log1)
    (maphash (lambda (backtrace count)
               (puthash backtrace (- (gethash backtrace log1 0) count)
                        newlog))
             log2)
    newlog))