From: Laurence Warne Date: Sun, 13 Nov 2022 19:53:17 +0000 (+0000) Subject: Make VSIZE and RSS human-readable in Proced buffers X-Git-Tag: emacs-29.0.90~1616^2~108 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=67d08daa97019ae11f5a85fc40cf95138e4837dc;p=emacs.git Make VSIZE and RSS human-readable in Proced buffers * lisp/proced.el (proced-format-memory): New function. (proced-grammar-alist): Use proced-format-memory to format VSIZE and RSS. (Bug#59272) --- diff --git a/lisp/proced.el b/lisp/proced.el index a774f2dd1e2..a6f1a717785 100644 --- a/lisp/proced.el +++ b/lisp/proced.el @@ -140,8 +140,8 @@ the external command (usually \"kill\")." (nice "Ni" "%3d" 3 proced-< t (nice pid) (t t nil)) (thcount "THCount" "%d" right proced-< t (thcount pid) (nil t t)) (start "Start" proced-format-start 6 proced-time-lessp nil (start pid) (t t nil)) - (vsize "VSize" "%d" right proced-< t (vsize pid) (nil t t)) - (rss "RSS" "%d" right proced-< t (rss pid) (nil t t)) + (vsize "VSize" proced-format-memory right proced-< t (vsize pid) (nil t t)) + (rss "RSS" proced-format-memory right proced-< t (rss pid) (nil t t)) (etime "ETime" proced-format-time right proced-time-lessp t (etime pid) (nil t t)) (pcpu "%CPU" "%.1f" right proced-< t (pcpu pid) (nil t t)) (pmem "%Mem" "%.1f" right proced-< t (pmem pid) (nil t t)) @@ -1425,6 +1425,10 @@ The return string is always 6 characters wide." Replace newline characters by \"^J\" (two characters)." (string-replace "\n" "^J" args)) +(defun proced-format-memory (kilobytes) + "Format KILOBYTES in a human readable format." + (funcall byte-count-to-string-function (* 1024 kilobytes))) + (defun proced-format (process-alist format) "Display PROCESS-ALIST using FORMAT." (if (symbolp format)