sb-sprof fails with :loop T

Bug #1318506 reported by David Catteeuw
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Fix Released
Undecided
Unassigned

Bug Description

===== Description =====

I try to use the statistical profiler with :loop T (to get sufficient samples). This results in an error unless I first run the statistical profiler without :loop T.

===== Repeatable test case =====

Below are 2 testfiles based on the manual's examples. Loading the first gives an error, loading the second returns profiles as expected. The output is shown after the files' contents.

--------------------------------- START OF FILE sprof1.lisp ---------------------------------
(in-package :cl-user)
(require :sb-sprof)
(declaim (optimize speed))
(defun cpu-test-inner (a i)
  (logxor a (* i 5) (+ a i)))
(defun cpu-test (n)
  (let ((a 0))
    (dotimes (i (expt 2 n) a)
      (setf a (cpu-test-inner a i)))))
(sb-sprof:with-profiling (:max-samples 1000 :report :flat :loop T)
  (cpu-test 26))
--------------------------------- END OF FILE sprof1.lisp ---------------------------------

--------------------------------- START OF FILE sprof2.lisp ---------------------------------
(in-package :cl-user)
(require :sb-sprof)
(declaim (optimize speed))
(defun cpu-test-inner (a i)
  (logxor a (* i 5) (+ a i)))
(defun cpu-test (n)
  (let ((a 0))
    (dotimes (i (expt 2 n) a)
      (setf a (cpu-test-inner a i)))))
(sb-sprof:with-profiling (:max-samples 1000 :report :flat)
  (cpu-test 26))
(sb-sprof:with-profiling (:max-samples 1000 :report :flat :loop T)
  (cpu-test 26))
--------------------------------- END OF FILE sprof2.lisp ---------------------------------

$ sbcl --load sprof1.lisp
This is SBCL 1.1.17, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.

debugger invoked on a TYPE-ERROR in thread
#<THREAD "main thread" RUNNING {1002D45473}>:
  The value NIL is not of type SB-SPROF::SAMPLES.

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [RETRY ] Retry EVAL of current toplevel form.
  1: [CONTINUE] Ignore error and continue loading file "/Users/dcatteeu/Projects/vub/apps/metaheuristics/sprof1.lisp".
  2: [ABORT ] Abort loading file "/Users/dcatteeu/Projects/vub/apps/metaheuristics/sprof1.lisp".
  3: Ignore runtime option --load "sprof1.lisp".
  4: Skip rest of --eval and --load options.
  5: Skip to toplevel READ/EVAL/PRINT loop.
  6: [EXIT ] Exit SBCL (calling #'EXIT, killing the process).

((DEFMACRO SB-SPROF:WITH-PROFILING) (SB-SPROF:WITH-PROFILING (:MAX-SAMPLES 1000 :REPORT :FLAT :LOOP T) (CPU-TEST 26)) #<unavailable argument>)
0]

$ sbcl --load sprof2.lisp
This is SBCL 1.1.17, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.

Number of samples: 61
Sample interval: 0.01 seconds
Total sampling time: 0.61 seconds
Number of cycles: 0
Sampled threads:
 #<SB-THREAD:THREAD "main thread" RUNNING {1002D45473}>

           Self Total Cumul
  Nr Count % Count % Count % Calls Function
------------------------------------------------------------------------
   1 21 34.4 57 93.4 21 34.4 - CPU-TEST
   2 19 31.1 27 44.3 40 65.6 - CPU-TEST-INNER
   3 13 21.3 13 21.3 53 86.9 - SB-VM::GENERIC-+
   4 8 13.1 8 13.1 61 100.0 - SB-KERNEL:TWO-ARG-XOR
   5 0 0.0 61 100.0 61 100.0 - (LAMBDA NIL :IN "/Users/dcatteeu/Projects/vub/apps/metaheuristics/sprof2.lisp")
   6 0 0.0 61 100.0 61 100.0 - SB-INT:SIMPLE-EVAL-IN-LEXENV
   7 0 0.0 61 100.0 61 100.0 - EVAL-TLF
   8 0 0.0 61 100.0 61 100.0 - (FLET SB-FASL::EVAL-FORM :IN SB-INT:LOAD-AS-SOURCE)
   9 0 0.0 61 100.0 61 100.0 - SB-INT:LOAD-AS-SOURCE
  10 0 0.0 61 100.0 61 100.0 - (FLET SB-FASL::LOAD-STREAM :IN LOAD)
  11 0 0.0 61 100.0 61 100.0 - LOAD
  12 0 0.0 61 100.0 61 100.0 - SB-IMPL::PROCESS-EVAL/LOAD-OPTIONS
  13 0 0.0 61 100.0 61 100.0 - SB-IMPL::TOPLEVEL-INIT
  14 0 0.0 61 100.0 61 100.0 - (FLET #:WITHOUT-INTERRUPTS-BODY-60 :IN SAVE-LISP-AND-DIE)
  15 0 0.0 61 100.0 61 100.0 - (LABELS SB-IMPL::RESTART-LISP :IN SAVE-LISP-AND-DIE)
------------------------------------------------------------------------
          0 0.0 elsewhere
Profiler sample vector full (723 traces / 10000 samples), doubling the size

Number of samples: 1000
Sample interval: 0.01 seconds
Total sampling time: 10.0 seconds
Number of cycles: 0
Sampled threads:
 #<SB-THREAD:THREAD "main thread" RUNNING {1002D45473}>

           Self Total Cumul
  Nr Count % Count % Count % Calls Function
------------------------------------------------------------------------
   1 298 29.8 933 93.3 298 29.8 - CPU-TEST
   2 291 29.1 485 48.5 589 58.9 - CPU-TEST-INNER
   3 212 21.2 212 21.2 801 80.1 - SB-VM::GENERIC-+
   4 199 19.9 199 19.9 1000 100.0 - SB-KERNEL:TWO-ARG-XOR
   5 0 0.0 1000 100.0 1000 100.0 - (LAMBDA NIL :IN "/Users/dcatteeu/Projects/vub/apps/metaheuristics/sprof2.lisp")
   6 0 0.0 1000 100.0 1000 100.0 - SB-INT:SIMPLE-EVAL-IN-LEXENV
   7 0 0.0 1000 100.0 1000 100.0 - EVAL-TLF
   8 0 0.0 1000 100.0 1000 100.0 - (FLET SB-FASL::EVAL-FORM :IN SB-INT:LOAD-AS-SOURCE)
   9 0 0.0 1000 100.0 1000 100.0 - SB-INT:LOAD-AS-SOURCE
  10 0 0.0 1000 100.0 1000 100.0 - (FLET SB-FASL::LOAD-STREAM :IN LOAD)
  11 0 0.0 1000 100.0 1000 100.0 - LOAD
  12 0 0.0 1000 100.0 1000 100.0 - SB-IMPL::PROCESS-EVAL/LOAD-OPTIONS
  13 0 0.0 1000 100.0 1000 100.0 - SB-IMPL::TOPLEVEL-INIT
  14 0 0.0 1000 100.0 1000 100.0 - (FLET #:WITHOUT-INTERRUPTS-BODY-60 :IN SAVE-LISP-AND-DIE)
  15 0 0.0 1000 100.0 1000 100.0 - (LABELS SB-IMPL::RESTART-LISP :IN SAVE-LISP-AND-DIE)
------------------------------------------------------------------------
          0 0.0 elsewhere
*

===== Version =====

SBCL 1.1.17

===== uname -a =====

Darwin 178-119-185-209.access.telenet.be 13.1.0 Darwin Kernel Version 13.1.0: Wed Apr 2 23:52:02 PDT 2014; root:xnu-2422.92.1~2/RELEASE_X86_64 x86_64

===== *FEATURES* =====

(:QUICKLISP :ASDF3 :ASDF2 :ASDF :OS-UNIX :NON-BASE-CHARS-EXIST-P :ASDF-UNICODE
 :ALIEN-CALLBACKS :ANSI-CL :ASH-RIGHT-VOPS :BSD :C-STACK-IS-CONTROL-STACK
 :COMMON-LISP :COMPARE-AND-SWAP-VOPS :COMPLEX-FLOAT-VOPS :CYCLE-COUNTER :DARWIN
 :DARWIN :DARWIN9-OR-BETTER :FLOAT-EQL-VOPS :GENCGC :IEEE-FLOATING-POINT
 :INLINE-CONSTANTS :INODE64 :LINKAGE-TABLE :LITTLE-ENDIAN
 :MACH-EXCEPTION-HANDLER :MACH-O :MEMORY-BARRIER-VOPS :MULTIPLY-HIGH-VOPS
 :OS-PROVIDES-BLKSIZE-T :OS-PROVIDES-DLADDR :OS-PROVIDES-DLOPEN
 :OS-PROVIDES-PUTWC :OS-PROVIDES-SUSECONDS-T :PACKAGE-LOCAL-NICKNAMES
 :RAW-INSTANCE-INIT-VOPS :SB-CORE-COMPRESSION :SB-DOC :SB-EVAL :SB-LDB
 :SB-PACKAGE-LOCKS :SB-SIMD-PACK :SB-SOURCE-LOCATIONS :SB-TEST :SB-THREAD
 :SB-UNICODE :SBCL :STACK-ALLOCATABLE-CLOSURES :STACK-ALLOCATABLE-FIXED-OBJECTS
 :STACK-ALLOCATABLE-LISTS :STACK-ALLOCATABLE-VECTORS
 :STACK-GROWS-DOWNWARD-NOT-UPWARD :SYMBOL-INFO-VOPS :UD2-BREAKPOINTS :UNIX
 :UNWIND-TO-FRAME-AND-CALL-VOP :X86-64)

Tags: sb-sprof
description: updated
tags: added: profile sb-sprof
Paul Khuong (pvk)
tags: removed: profile
Revision history for this message
David Catteeuw (david-catteeuw+lp) wrote :

The bug still exists in SBCL 1.2.0.

Douglas Katzman (dougk)
Changed in sbcl:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.