X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=contrib%2Fsb-sprof%2Fsb-sprof.lisp;h=ff0f4b90bfe89c55e14b69f832dfacc20645881e;hb=a42922aef908a1b45ae5420d51b2ca7ee1bafb9e;hp=d5a367893c3481c11f6189c23656420b09de3eb6;hpb=355e6c09a8f7f528a838f7a50b99ad77811b51a2;p=sbcl.git diff --git a/contrib/sb-sprof/sb-sprof.lisp b/contrib/sb-sprof/sb-sprof.lisp index d5a3678..ff0f4b9 100644 --- a/contrib/sb-sprof/sb-sprof.lisp +++ b/contrib/sb-sprof/sb-sprof.lisp @@ -297,6 +297,20 @@ ;; number of times the call was sampled (count 1 :type sb-int:index)) +(defvar *sample-interval* 0.01 + "Default number of seconds between samples.") +(declaim (type number *sample-interval*)) + +(defvar *alloc-interval* 4 + "Default number of allocation region openings between samples.") +(declaim (type number *alloc-interval*)) + +(defvar *max-samples* 50000 + "Default number of traces taken. This variable is somewhat misnamed: +each trace may actually consist of an arbitrary number of samples, depending +on the depth of the call stack.") +(declaim (type sb-int:index *max-samples*)) + ;;; Encapsulate all the information about a sampling run (defstruct (samples) ;; When this vector fills up, we allocate a new one and copy over @@ -339,28 +353,14 @@ profiling") (declaim (type (member :cpu :alloc) *sampling-mode*)) -(defvar *sample-interval* 0.01 - "Default number of seconds between samples.") -(declaim (number *sample-interval*)) - (defvar *alloc-region-size* #-gencgc - 4096 + (get-page-size) ;; This hardcoded 2 matches the one in gc_find_freeish_pages. It's not ;; really worth genesifying. #+gencgc (* 2 sb-vm:gencgc-page-size)) -(declaim (number *alloc-region-size*)) - -(defvar *alloc-interval* 4 - "Default number of allocation region openings between samples.") -(declaim (number *alloc-interval*)) - -(defvar *max-samples* 50000 - "Default number of traces taken. This variable is somewhat misnamed: -each trace may actually consist of an arbitrary number of samples, depending -on the depth of the call stack.") -(declaim (type sb-int:index *max-samples*)) +(declaim (type number *alloc-region-size*)) (defvar *samples* nil) (declaim (type (or null samples) *samples*)) @@ -556,6 +556,7 @@ on the depth of the call stack.") (sb-sys:without-gcing (with-alien ((scp (* os-context-t) :local scp)) (locally (declare (optimize (inhibit-warnings 2))) + (incf (samples-trace-count samples)) (record-trace-start samples) (let* ((pc-ptr (sb-vm:context-pc scp)) (fp (sb-vm::context-register scp #.sb-vm::cfp-offset))