chiark / gitweb /
dot/shell-rc, el/dot-emacs.el: Lower I/O priority for build jobs.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 11 Jul 2024 12:27:57 +0000 (13:27 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Thu, 11 Jul 2024 12:27:57 +0000 (13:27 +0100)
dot/shell-rc
el/dot-emacs.el

index 778bd3ea652d8c719a6a20b9162c9a831af4cf87..e28dbb8b166da7cfc09a7f27adea9e5404eb40b0 100644 (file)
@@ -224,8 +224,13 @@ alias pushtmp='pushd ${TMPDIR-/tmp}'
 alias e="$EDITOR"
 alias svn="svnwrap svn"
 alias @="ssh"
-alias make="nice make"
-alias cross-run="nice cross-run"
+__mdw_nice="nice"
+if command -v ionice >/dev/null 2>&1; then
+  __mdw_nice="$__mdw_nice ionice -c3"
+fi
+alias mdw-nice="$__mdw_nice --"
+alias make="mdw-nice make"
+alias cross-run="mdw-nice cross-run"
 alias gdb="gdb -q"
 
 ## Shut up Lisp interpreters.
index 7bcaee2e9b2f2fd1310e88bf3479d190411c0843..4ad0e6c3d6dea9da2b03708d09364a0f45239daa 100644 (file)
@@ -917,11 +917,13 @@ (defadvice rename-file (after mdw-rename-buffers (from to &optional forcep)
 ;; Uprated version of M-x compile.
 
 (setq compile-command
-       (let ((ncpu (with-temp-buffer
-                     (insert-file-contents "/proc/cpuinfo")
-                     (buffer-string)
-                     (count-matches "^processor\\s-*:"))))
-         (format "nice make -j%d -k" (* 2 ncpu))))
+       (format "nice %smake -j%d -k"
+               (if (executable-find "ionice") "ionice -c3 " "")
+               (let ((ncpu (with-temp-buffer
+                             (insert-file-contents "/proc/cpuinfo")
+                             (buffer-string)
+                             (count-matches "^processor\\s-*:"))))
+                 (ceiling (* 3 ncpu) 2))))
 
 (defun mdw-compilation-buffer-name (mode)
   (concat "*" (downcase mode) ": "