Function: profiler-calltree-build-1

profiler-calltree-build-1 is a byte-compiled function defined in profiler.el.gz.

Signature

(profiler-calltree-build-1 TREE LOG &optional REVERSE)

Source Code

;; Defined in /usr/src/emacs/lisp/profiler.el.gz
(defun profiler-calltree-build-1 (tree log &optional reverse)
  ;; This doesn't try to stitch up partial backtraces together.
  ;; We still use it for reverse calltrees, but for forward calltrees, we use
  ;; profiler-calltree-build-unified instead now.
  (maphash
   (lambda (backtrace count)
     (let ((node tree)
           (max (length backtrace)))
       (dotimes (i max)
         (let ((entry (aref backtrace (if reverse i (- max i 1)))))
           (when entry
             (let ((child (profiler-calltree-find node entry)))
               (unless child
                 (setq child (profiler-make-calltree
                              :entry entry :parent node))
                 (push child (profiler-calltree-children node)))
               (incf (profiler-calltree-count child) count)
               (setq node child)))))))
   log))