mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 06:20:55 -08:00
; * lisp/emacs-lisp/igc.el: Add docstrings and fix typos
(igc--current-idle-time): Add docstring. (igc--idle-timer): Fix typo in docstring. (igc--predict-idle-time): Add docstring. (igc--on-idle): Fix typo in comment, add docstring.
This commit is contained in:
parent
7a84008270
commit
c5be680ec3
1 changed files with 9 additions and 2 deletions
|
|
@ -468,7 +468,7 @@ This function is called from a timer; see `igc-start-collecting-stats'."
|
||||||
;;; Opportunistic GC
|
;;; Opportunistic GC
|
||||||
|
|
||||||
(defvar igc--idle-timer nil
|
(defvar igc--idle-timer nil
|
||||||
"Idle timer to trigger oppurtunistic GC.")
|
"Idle timer to trigger opportunistic GC.")
|
||||||
|
|
||||||
(defvar igc--idle-delay 1.0
|
(defvar igc--idle-delay 1.0
|
||||||
"Time, in seconds, to wait for `igc--idle-timer'.")
|
"Time, in seconds, to wait for `igc--idle-timer'.")
|
||||||
|
|
@ -490,14 +490,18 @@ This function is called from a timer; see `igc-start-collecting-stats'."
|
||||||
#'igc--on-idle (vector nil) 0)))
|
#'igc--on-idle (vector nil) 0)))
|
||||||
|
|
||||||
(defun igc--current-idle-time ()
|
(defun igc--current-idle-time ()
|
||||||
|
"Time since the last command finished, in seconds as a float.
|
||||||
|
See `igc--on-idle'."
|
||||||
(let ((idle-time (current-idle-time)))
|
(let ((idle-time (current-idle-time)))
|
||||||
(if idle-time (float-time idle-time) 0)))
|
(if idle-time (float-time idle-time) 0)))
|
||||||
|
|
||||||
(defun igc--predict-idle-time ()
|
(defun igc--predict-idle-time ()
|
||||||
|
"Predict available time until the next command starts.
|
||||||
|
See `igc--on-idle'."
|
||||||
(* (igc--current-idle-time) 0.80))
|
(* (igc--current-idle-time) 0.80))
|
||||||
|
|
||||||
;; The igc-idle-timer works a bit like the blink-cursor-timer. It can
|
;; The igc-idle-timer works a bit like the blink-cursor-timer. It can
|
||||||
;; call 'gc--on-idle' multiple times per idle cycle either until some GC
|
;; call 'igc--on-idle' multiple times per idle cycle either until some GC
|
||||||
;; work is done or until `igc--idle-repetitions' is reached. We do this
|
;; work is done or until `igc--idle-repetitions' is reached. We do this
|
||||||
;; because our idle time prediction primarily depends on the
|
;; because our idle time prediction primarily depends on the
|
||||||
;; `current-idle-time', i.e. our predicted idle time gets larger the
|
;; `current-idle-time', i.e. our predicted idle time gets larger the
|
||||||
|
|
@ -509,6 +513,9 @@ This function is called from a timer; see `igc-start-collecting-stats'."
|
||||||
;; calling 'igc--arena-step' again.
|
;; calling 'igc--arena-step' again.
|
||||||
|
|
||||||
(defun igc--on-idle (state repetition)
|
(defun igc--on-idle (state repetition)
|
||||||
|
"Timer function to do GC in idle Emacs state.
|
||||||
|
Calls igc--arena-step, wrapper for mps_arena_step for this very purpose.
|
||||||
|
See `igc-start-idle-timer."
|
||||||
(let ((timer2 (aref state 0)))
|
(let ((timer2 (aref state 0)))
|
||||||
(when timer2
|
(when timer2
|
||||||
(cancel-timer timer2)))
|
(cancel-timer timer2)))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue