Skip to content

Commit

Permalink
sb-sprof: Record profiling start and end times
Browse files Browse the repository at this point in the history
  • Loading branch information
scymtym committed Mar 13, 2018
1 parent fd6306c commit 3f1edad
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 4 additions & 2 deletions contrib/sb-sprof/interface.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ The following keyword args are recognized:
(truncate sample-interval)
(values secs (truncate (* rest 1000000))))
(setf *sampling* sampling
*samples* (make-samples :max-depth max-depth
*samples* (make-samples :start-time (get-internal-real-time)
:max-depth max-depth
:max-samples max-samples
:sample-interval sample-interval
:alloc-interval alloc-interval
Expand Down Expand Up @@ -251,7 +252,8 @@ The following keyword args are recognized:
(disable-call-counting)
(setf *profiling* nil
*sampling* nil
*profiled-threads* nil)))
*profiled-threads* nil)
(setf (samples-end-time *samples*) (get-internal-real-time))))
(values))

(defun reset ()
Expand Down
7 changes: 6 additions & 1 deletion contrib/sb-sprof/record.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
;;; Encapsulate all the information about a sampling run
(defstruct (samples
(:constructor
make-samples (&key mode sample-interval alloc-interval
make-samples (&key start-time
mode sample-interval alloc-interval
max-depth max-samples
&aux (vector (make-sample-vector max-samples)))))
;; When this vector fills up, we allocate a new one and copy over
Expand All @@ -36,6 +37,10 @@

(sampled-threads nil :type list)

;; Metadata
(start-time (sb-int:missing-arg) :type sb-kernel:internal-time :read-only t)
(end-time nil :type (or null sb-kernel:internal-time))

(mode nil :type sampling-mode :read-only t)
(sample-interval (sb-int:missing-arg) :type (real (0)) :read-only t)
(alloc-interval (sb-int:missing-arg) :type (integer (0)) :read-only t)
Expand Down

0 comments on commit 3f1edad

Please sign in to comment.