summaryrefslogtreecommitdiff
path: root/lisp/proced.el
diff options
context:
space:
mode:
authorLaurence Warne <laurencewarne@gmail.com>2022-11-13 19:53:17 +0000
committerEli Zaretskii <eliz@gnu.org>2022-11-17 11:54:04 +0200
commit67d08daa97019ae11f5a85fc40cf95138e4837dc (patch)
tree5e79a9a52a8ba5a448ba7ef67a329d3d785c4feb /lisp/proced.el
parentb6a7b42b199d4e96312bf8147d36dddbcf14f4ea (diff)
downloademacs-67d08daa97019ae11f5a85fc40cf95138e4837dc.tar.gz
emacs-67d08daa97019ae11f5a85fc40cf95138e4837dc.tar.bz2
emacs-67d08daa97019ae11f5a85fc40cf95138e4837dc.zip
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)
Diffstat (limited to 'lisp/proced.el')
-rw-r--r--lisp/proced.el8
1 files changed, 6 insertions, 2 deletions
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)