From: Christophe R. <cr...@us...> - 2004-06-21 11:33:47
|
Update of /cvsroot/sbcl/sbcl/contrib/sb-sprof In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20319/contrib/sb-sprof Added Files: Makefile sb-sprof.lisp sb-sprof.texinfo Log Message: 0.8.11.20: Add SB-SPROF contrib --- NEW FILE: Makefile --- MODULE=sb-sprof include ../vanilla-module.mk test:: true --- NEW FILE: sb-sprof.lisp --- ;;; Copyright (C) 2003 Gerd Moellmann <ger...@t-...> ;;; All rights reserved. ;;; ;;; Redistribution and use in source and binary forms, with or without ;;; modification, are permitted provided that the following conditions ;;; are met: ;;; ;;; 1. Redistributions of source code must retain the above copyright ;;; notice, this list of conditions and the following disclaimer. ;;; 2. Redistributions in binary form must reproduce the above copyright ;;; notice, this list of conditions and the following disclaimer in the ;;; documentation and/or other materials provided with the distribution. ;;; 3. The name of the author may not be used to endorse or promote ;;; products derived from this software without specific prior written ;;; permission. ;;; ;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS ;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE [...1077 lines suppressed...] (print-flat graph :stream stream :max max :min-percent min-percent)) (:graph (print-graph graph :stream stream :max max :min-percent min-percent)) ((nil))) graph)) ;;;; Silly Examples (defun test-0 (n &optional (depth 0)) (declare (optimize (debug 3))) (when (< depth n) (dotimes (i n) (test-0 n (1+ depth)) (test-0 n (1+ depth))))) (defun test () (with-profiling (:reset t :max-samples 1000 :report :graph) (test-0 7))) ;;; End of file. --- NEW FILE: sb-sprof.texinfo --- @node sb-sprof @section sb-sprof @cindex Profiler The @code{sb-sprof} module provides an alternate profiler which works by taking samples of the program execution at regular intervals, instead of instrumenting functions like @code{profile} does. You might find @code{sb-sprof} more useful than @code{profile} when profiling functions in the @code{common-lisp}-package, SBCL internals, or code where the instrumenting overhead is excessive. On the other hand it only works on x86, and isn't completely reliable even there. @subsection Example Usage @lisp (require :sb-sprof) (sb-sprof:start-profiling) (defvar *a* 0) (dotimes (i (expt 2 26)) (setf *a* (logxor *a* (* i 5) (+ *a* i)))) (sb-sprof:stop-profiling) (sb-sprof:report) @end lisp @subsection Functions @include fun-sb-sprof-report.texinfo @include fun-sb-sprof-reset.texinfo @include fun-sb-sprof-start-profiling.texinfo @include fun-sb-sprof-stop-profiling.texinfo @subsection Macros @include macro-sb-sprof-with-profiling.texinfo @subsection Variables @include var-sb-sprof-star-max-samples-star.texinfo @include var-sb-sprof-star-sample-interval-star.texinfo @subsection Credits @code{sb-sprof} is an SBCL port of Gerd Moellmann's statistical profiler for CMUCL. |