Fix sequence type derivation in the presence of negation types.
[sbcl.git] / contrib / sb-sprof / test.lisp
blob7f1923b2a6e7d37d4f1ebfb8ca60585eaebc6957
1 (in-package :cl-user)
3 (require :sb-sprof)
5 ;;; silly examples
7 (defun test-0 (n &optional (depth 0))
8 (declare (optimize (debug 3)))
9 (when (< depth n)
10 (dotimes (i n)
11 (test-0 n (1+ depth))
12 (test-0 n (1+ depth)))))
14 (defun test ()
15 (sb-sprof:with-profiling (:reset t :max-samples 1000 :report :graph)
16 (test-0 7)))
18 (defun consalot ()
19 (let ((junk '()))
20 (loop repeat 10000 do
21 (push (make-array 10) junk))
22 junk))
24 (defun consing-test ()
25 ;; 0.0001 chosen so that it breaks rather reliably when sprof does not
26 ;; respect pseudo atomic.
27 (sb-sprof:with-profiling (:reset t
28 ;; setitimer with small intervals
29 ;; is broken on FreeBSD 10.0
30 ;; And ARM targets are not fast in
31 ;; general, causing the profiling signal
32 ;; to be constantly delivered without
33 ;; making any progress.
34 #-(or freebsd arm) :sample-interval
35 #-(or freebsd arm) 0.0001
36 #+arm :sample-interval #+arm 0.1
37 :report :graph :loop nil)
38 (let ((target (+ (get-universal-time) 15)))
39 (princ #\.)
40 (force-output)
41 (loop while (< (get-universal-time) target)
42 do (consalot)))))
44 #-(or win32 darwin) ;not yet
45 (test)
46 #-(or win32 darwin) ;not yet
47 (consing-test)
49 ;; For debugging purposes, print output for visual inspection to see if
50 ;; the allocation sequence gets hit in the right places (i.e. not at all
51 ;; in traditional builds, and everywhere if SB-SAFEPOINT-STRICTLY is
52 ;; enabled.)
53 (disassemble #'consalot)