12fd42abb3ba

Add `profile`
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Tue, 21 Feb 2017 20:50:17 +0000
parents a0a09fcf271b
children 85823854b8cb
branches/tags (none)
files losh.lisp package.lisp

Changes

--- a/losh.lisp	Mon Feb 20 15:40:36 2017 +0000
+++ b/losh.lisp	Tue Feb 21 20:50:17 2017 +0000
@@ -1968,6 +1968,14 @@
   (sb-sprof::stop-profiling)
   (dump-profile filename))
 
+#+sbcl
+(defmacro profile (&body body)
+  `(progn
+     (start-profiling)
+     (unwind-protect
+         (time (progn ,@body))
+       (stop-profiling))))
+
 
 ;;;; CLOS ---------------------------------------------------------------------
 (defun build-slot-definition (conc-name slot-spec)
--- a/package.lisp	Mon Feb 20 15:40:36 2017 +0000
+++ b/package.lisp	Tue Feb 21 20:50:17 2017 +0000
@@ -78,6 +78,7 @@
     :structural-string
     #+sbcl :start-profiling
     #+sbcl :stop-profiling
+    #+sbcl :profile
     :print-table
     :print-hash-table
     :print-hash-table-concisely