diff options
| author | Stefan Kangas | 2022-10-15 03:02:17 +0200 |
|---|---|---|
| committer | Stefan Kangas | 2022-10-15 03:02:17 +0200 |
| commit | 8300899953cf903f2e3dcf2e985b16044959df7c (patch) | |
| tree | b47614b44ac535847611324dfb391fef3a76b180 | |
| parent | f5c6e628ed311761cfe9c0d2dd68baa2806abab4 (diff) | |
| download | emacs-8300899953cf903f2e3dcf2e985b16044959df7c.tar.gz emacs-8300899953cf903f2e3dcf2e985b16044959df7c.zip | |
Use file-size-human-readable in memory-report--format
* lisp/emacs-lisp/memory-report.el (memory-report--format): Use
file-size-human-readable.
| -rw-r--r-- | lisp/emacs-lisp/memory-report.el | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/lisp/emacs-lisp/memory-report.el b/lisp/emacs-lisp/memory-report.el index 56b1ea6ed48..968a80b59e7 100644 --- a/lisp/emacs-lisp/memory-report.el +++ b/lisp/emacs-lisp/memory-report.el | |||
| @@ -262,12 +262,7 @@ by counted more than once." | |||
| 262 | (cl-struct-slot-info struct-type))))) | 262 | (cl-struct-slot-info struct-type))))) |
| 263 | 263 | ||
| 264 | (defun memory-report--format (bytes) | 264 | (defun memory-report--format (bytes) |
| 265 | (setq bytes (/ bytes 1024.0)) | 265 | (format "%10s" (file-size-human-readable bytes 'iec " "))) |
| 266 | (let ((units '("KiB" "MiB" "GiB" "TiB"))) | ||
| 267 | (while (>= bytes 1024) | ||
| 268 | (setq bytes (/ bytes 1024.0)) | ||
| 269 | (setq units (cdr units))) | ||
| 270 | (format "%6.1f %s" bytes (car units)))) | ||
| 271 | 266 | ||
| 272 | (defun memory-report--gc-elem (elems type) | 267 | (defun memory-report--gc-elem (elems type) |
| 273 | (* (nth 1 (assq type elems)) | 268 | (* (nth 1 (assq type elems)) |