]> git.eshelyaron.com Git - emacs.git/commitdiff
Use file-size-human-readable in memory-report--format
authorStefan Kangas <stefankangas@gmail.com>
Sat, 15 Oct 2022 01:02:17 +0000 (03:02 +0200)
committerStefan Kangas <stefankangas@gmail.com>
Sat, 15 Oct 2022 01:02:17 +0000 (03:02 +0200)
* lisp/emacs-lisp/memory-report.el (memory-report--format): Use
file-size-human-readable.

lisp/emacs-lisp/memory-report.el

index 56b1ea6ed48e4e101f8c22e7a68150875461d428..968a80b59e7f4f78f70d969a3305377ab4991959 100644 (file)
@@ -262,12 +262,7 @@ by counted more than once."
                    (cl-struct-slot-info struct-type)))))
 
 (defun memory-report--format (bytes)
-  (setq bytes (/ bytes 1024.0))
-  (let ((units '("KiB" "MiB" "GiB" "TiB")))
-    (while (>= bytes 1024)
-      (setq bytes (/ bytes 1024.0))
-      (setq units (cdr units)))
-    (format "%6.1f %s" bytes (car units))))
+  (format "%10s" (file-size-human-readable bytes 'iec " ")))
 
 (defun memory-report--gc-elem (elems type)
   (* (nth 1 (assq type elems))