摸了个小工具, 效果如下:
欢迎提出改进意见:
;;; -*- lexical-binding: t; -*-
(defvar PREFIX/runtime-info-string "")
(add-hook 'post-gc-hook
(let ((--gcs-done -1))
(byte-compile (lambda ()
(eval-when-compile
(require 'cl-lib))
(when (/= --gcs-done gcs-done)
(setq PREFIX/runtime-info-string (format-spec "%N GC (%ts total): %M VM, %hh runtime"
`((?N . ,(format "%d%s"
gcs-done
(pcase (mod gcs-done 10)
(1 "st")
(2 "nd")
(3 "rd")
(_ "th"))))
(?t . ,(round gc-elapsed))
(?M . ,(cl-loop for memory = (memory-limit) then (/ memory 1024.0)
for mem-unit across "KMGT"
when (< memory 1024)
return (format "%.1f%c"
memory
mem-unit)))
(?h . ,(format "%.1f"
(/ (time-to-seconds (time-since before-init-time))
3600.0)))))
--gcs-done gcs-done))))))
(setq frame-title-format '("" default-directory " "
PREFIX/runtime-info-string))
(garbage-collect)
(redraw-frame)