anchor.diff:      sys.int::%%closure-trampoline
       sys.int::%%funcallable-instance-trampoline))
   
  +(defclass profile-data ()
  +  ((%data :initarg :data :reader profile-data)))
  +
   (defstruct thread-sample
     thread
     state
  
positive.code:                             (setf profile-buffer (decode-profile-buffer (mezzano.supervisor:stop-profiling)
                                                                          (if prune #'call-with-profiling nil)
                                                                          ignore-functions))))))))
      (cond (path
             (save-profile path profile-buffer :verbosity verbosity :order-by order-by)
             (values-list results))
            (t profile-buffer))))
  
  (defun decode-profile-buffer (buffer &optional prune-function ignore-functions)
    "Convert the buffer returned by STOP-PROFILING into a more useful format.
  
negative.code:                         (loop for (callee . count) across callees do
                               (format t "    ~D~10T~S~%" count callee))))))
               threads)))
  
  (defun generate-flame-graph (profile stream)
    (loop
       for sample across (profile-data profile)
       do
         (when (not (zerop (length sample)))
           (loop
              with first = t
              for (fn . offset) across (reverse (thread-sample-call-stack (elt sample 0)))
              do
                (when (not (eql fn 0))
                  (cond (first (setf first nil))
                        (t (write-char #\; stream)))
                  (write-string (substitute #\_ #\Space (substitute #\L #\< (substitute #\G #\> (format nil "~(~S~)" (sys.int::function-name fn))))) stream)))
           (write-char #\Space stream)
           (write 1 :stream stream)
           (terpri stream))))
  