1.0.45.28: add LIMIT and PRINT-NO-CALL-LIST arguments to SB-PROFILE:REPORT
authorNikodemus Siivola <nikodemus@random-state.net>
Sat, 12 Feb 2011 15:51:47 +0000 (15:51 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Sat, 12 Feb 2011 15:51:47 +0000 (15:51 +0000)
  Patch by William Halliburton, lp#710017.

  These arguments are used to control the amount of information printed
  by REPORT as many times you are only looking for the top contenders
  and the other information is unnecessary and, at times, inundating.

src/code/profile.lisp
version.lisp-expr

index 59929eb..c4d2750 100644 (file)
                (float profile)))))
     (max raw-compensated 0.0)))
 
-(defun report ()
-  "Report results from profiling. The results are approximately adjusted
-for profiling overhead. The compensation may be rather inaccurate when
-bignums are involved in runtime calculation, as in a very-long-running
-Lisp process."
+(defun report (&key limit (print-no-call-list t))
+  "Report results from profiling. The results are approximately
+adjusted for profiling overhead. The compensation may be rather
+inaccurate when bignums are involved in runtime calculation, as in a
+very-long-running Lisp process.
+
+If LIMIT is set to an integer, only the top LIMIT results are
+reported. If PRINT-NO-CALL-LIST is T (the default) then a list of
+uncalled profiled functions are listed."
   (unless (boundp '*overhead*)
     (setf *overhead*
           (compute-overhead)))
@@ -399,13 +403,16 @@ Lisp process."
                                   :gc-run-time gc-run-time)
                   time-info-list))))
 
-    (setf time-info-list
-          (sort time-info-list
-                #'>=
-                :key #'time-info-seconds))
-    (print-profile-table time-info-list)
+    (let ((times
+           (sort time-info-list
+                 #'>=
+                 :key #'time-info-seconds)))
+      (print-profile-table
+       (if (and limit (> (length times) limit))
+           (subseq times 0 limit)
+           times)))
 
-    (when no-call-name-list
+    (when (and print-no-call-list no-call-name-list)
       (format *trace-output*
               "~%These functions were not called:~%~{~<~%~:; ~S~>~}~%"
               (sort no-call-name-list #'string<
index c254d9a..a8f663e 100644 (file)
@@ -20,4 +20,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.45.27"
+"1.0.45.28"