[PATCH] track GC time for SBCL

3 views
Skip to first unread message

Qian Yun

unread,
Oct 14, 2023, 9:21:44 PM10/14/23
to fricas-devel
It is possible to track GC time in SBCL via variable
sb-ext:*gc-run-time* .

As for backwards compatibility, this variable is confirmed to
exist in sbcl-1.1.1.

- Qian

=====

diff --git a/src/lisp/fricas-lisp.lisp b/src/lisp/fricas-lisp.lisp
index a904f5be..426c53be 100644
--- a/src/lisp/fricas-lisp.lisp
+++ b/src/lisp/fricas-lisp.lisp
@@ -1154,7 +1154,9 @@ with this hack and will try to convince the GCL
crowd to fix this.

#+:GCL
(defmacro |elapsedGcTime| () '(system:gbc-time))
-#-:GCL
+#+:SBCL
+(defmacro |elapsedGcTime| () 'sb-ext:*gc-run-time*)
+#-(or :GCL :SBCL)
(defmacro |elapsedGcTime| () '0)

(defmacro |char| (arg)

Qian Yun

unread,
Oct 15, 2023, 9:24:08 AM10/15/23
to fricas-devel
More Lisps are supported:

diff --git a/src/lisp/fricas-lisp.lisp b/src/lisp/fricas-lisp.lisp
index a904f5be..dae6fe70 100644
--- a/src/lisp/fricas-lisp.lisp
+++ b/src/lisp/fricas-lisp.lisp
@@ -1152,10 +1152,18 @@ with this hack and will try to convince the GCL
crowd to fix this.

(defmacro |elapsedUserTime| () '(get-internal-run-time))

-#+:GCL
-(defmacro |elapsedGcTime| () '(system:gbc-time))
-#-:GCL
-(defmacro |elapsedGcTime| () '0)
+#+:gcl
+(defun |elapsedGcTime| () (system:gbc-time))
+#+:sbcl
+(defun |elapsedGcTime| () sb-ext:*gc-run-time*)
+#+:openmcl
+(defun |elapsedGcTime| () (ccl:gctime))
+#+:clisp
+(defun |elapsedGcTime| ()
+ (multiple-value-bind (used room static gc-count gc-space gc-time)
(sys::%room)
+ gc-time))
+#-(or :gcl :sbcl :openmcl :clisp)
+(defun |elapsedGcTime| () 0)

(defmacro |char| (arg)
(cond ((stringp arg) (character arg))

- Qian
Reply all
Reply to author
Forward
0 new messages