Skip to content
Snippets Groups Projects
Commit 1f3a5f31 authored by toy's avatar toy
Browse files

profile:report-time doesn't print out a long list of functions that

were not profiled anymore.  The cutoff is user-configurable by setting
the (new) variable profile::*no-calls-limit* appropriately.
parent 4a712063
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
;;; Carnegie Mellon University, and has been placed in the public domain. ;;; Carnegie Mellon University, and has been placed in the public domain.
;;; ;;;
(ext:file-comment (ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/profile.lisp,v 1.20 2001/12/06 19:15:41 pmai Exp $") "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/profile.lisp,v 1.21 2002/05/01 17:43:37 toy Exp $")
;;; ;;;
;;; ********************************************************************** ;;; **********************************************************************
;;; ;;;
...@@ -141,6 +141,11 @@ ...@@ -141,6 +141,11 @@
(defvar *timed-functions* () (defvar *timed-functions* ()
"List of functions that are currently being timed.") "List of functions that are currently being timed.")
(defvar *no-calls* nil
"A list of profiled functions which weren't called.")
(defvar *no-calls-limit* 20
"If the number of profiled functions that were not called is less than
this, the functions are listed. If NIL, then always list the functions.")
;;; We associate a PROFILE-INFO structure with each profiled function name. ;;; We associate a PROFILE-INFO structure with each profiled function name.
;;; This holds the functions that we call to manipulate the closure which ;;; This holds the functions that we call to manipulate the closure which
...@@ -473,8 +478,8 @@ ...@@ -473,8 +478,8 @@
(declare (optimize (speed 0))) (declare (optimize (speed 0)))
(unless (boundp '*call-overhead*) (unless (boundp '*call-overhead*)
(compute-time-overhead)) (compute-time-overhead))
(let ((info ()) (let ((info ()))
(no-call ())) (setf *no-calls* nil)
(dolist (name names) (dolist (name names)
(let ((pinfo (profile-info-or-lose name))) (let ((pinfo (profile-info-or-lose name)))
(unless (eq (fdefinition name) (unless (eq (fdefinition name)
...@@ -486,7 +491,7 @@ ...@@ -486,7 +491,7 @@
(calls time consing profile callers) (calls time consing profile callers)
(funcall (profile-info-read-time pinfo)) (funcall (profile-info-read-time pinfo))
(if (zerop calls) (if (zerop calls)
(push name no-call) (push name *no-calls*)
(push (make-time-info name calls (push (make-time-info name calls
(compensate-time calls time profile) (compensate-time calls time profile)
consing consing
...@@ -530,20 +535,19 @@ ...@@ -530,20 +535,19 @@
"~%Estimated total profiling overhead: ~4,2F seconds~%" "~%Estimated total profiling overhead: ~4,2F seconds~%"
(* *total-profile-overhead* (float total-calls)))) (* *total-profile-overhead* (float total-calls))))
(when no-call (when *no-calls*
(format *trace-output* (let ((num-no-calls (length *no-calls*)))
"~%These functions were not called:~%~{~<~%~:; ~S~>~}~%" (if (and *no-calls-limit*
(sort no-call #'string< (numberp *no-calls-limit*)
:key #'(lambda (n) (> num-no-calls *no-calls-limit*))
(cond ((symbolp n) (format *trace-output*
(symbol-name n)) "~%~@(~r~) profiled functions were not called. ~
((and (listp n) ~%See the variable profile::*no-calls* for a list."
(eq (car n) 'setf) num-no-calls)
(consp (cdr n)) (format *trace-output*
(symbolp (cadr n))) "~%The following profiled functions were not called:~
(symbol-name (cadr n))) ~%~{~<~%~:; ~A~>~}~%"
(t *no-calls*))))
(princ-to-string n)))))))
(values))) (values)))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment