# HG changeset patch
# User Steve Losh <steve@stevelosh.com>
# Date 1487710217 0
# Node ID 12fd42abb3ba3a0365b44b6cb02d0ab95bdcca22
# Parent  a0a09fcf271b62290ba5236a51df220c27972992
Add `profile`

diff -r a0a09fcf271b -r 12fd42abb3ba losh.lisp
--- 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)
diff -r a0a09fcf271b -r 12fd42abb3ba package.lisp
--- 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