From: Mark Wooding Date: Thu, 11 Jul 2024 12:27:57 +0000 (+0100) Subject: dot/shell-rc, el/dot-emacs.el: Lower I/O priority for build jobs. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/profile/commitdiff_plain/a680226e8187a19ad1f51c01c92cd5f16779fab6?ds=sidebyside dot/shell-rc, el/dot-emacs.el: Lower I/O priority for build jobs. --- diff --git a/dot/shell-rc b/dot/shell-rc index 778bd3e..e28dbb8 100644 --- a/dot/shell-rc +++ b/dot/shell-rc @@ -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. diff --git a/el/dot-emacs.el b/el/dot-emacs.el index 7bcaee2..4ad0e6c 100644 --- a/el/dot-emacs.el +++ b/el/dot-emacs.el @@ -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) ": "