2
(or (fboundp 'get-usage) (load "/public/gcl/misc/rusage"))
4
(defun cv (x) (/ x (float INTERNAL-TIME-UNITS-PER-SECOND)))
5
(defvar *all-times* nil)
6
(defmacro with-timing (&rest forms)
7
`(let ((usg0 (get-usage t nil))
9
(t2 (get-internal-run-time))
10
(t3 (get-internal-real-time)))
12
(setq t1 (- (gbc-time ) t1))
13
(setq t2 (- (get-internal-run-time) t2))
14
(setq t3 (- (get-internal-real-time) t3))
15
(let ((usg (get-usage t nil)))
18
"Run= ~3,2f Elap= ~3,2f Gc= ~3,2f Fault= ~3d"
19
(cv t2) (cv t3) (cv t1)
20
(- (|rusage|-|ru_majflt| usg) (|rusage|-|ru_majflt| usg0)))))
21
(push (list ',(car forms) ans ) *all-times*)
25
(setq si::*notify-gbc* t)
26
(allocate 'cons 520 t)
30
(si::allocate-sgc 'symbol 20 30 30)
31
(si::allocate-sgc 'cons 50 3000 40)
33
(si::allocate-sgc 'vector 1 10 30)
34
(si::allocate-sgc 'string 1 10 30)
37
(print (in-package "MAXIMA"))
38
(setq $joe #$expand((x+y+z)^20)$)
44
(push (list form 'cons-pages (si::allocated-pages 'cons)) si::*all-times*)
47
(si::with-timing (sloop for i below 3 do (displa ($factor $joe))))
50
(test '(si::sgc-on nil))
51
(test '(si::sgc-on t))
52
(test '(si::sgc-on nil))
53
(test '(si::sgc-on t))
55
(print si::*all-times*)