Skip to content
Snippets Groups Projects
Commit 9f6b1d32 authored by Petr Baudis's avatar Petr Baudis
Browse files

compctl --run: Automatically nice started computations

parent f1a2312d
No related branches found
No related tags found
No related merge requests found
...@@ -15,6 +15,9 @@ size_t static_minfree = 512*1048576UL; ...@@ -15,6 +15,9 @@ size_t static_minfree = 512*1048576UL;
size_t static_maxfree = 2048*1048576UL; size_t static_maxfree = 2048*1048576UL;
double split_ratio = 0.5; double split_ratio = 0.5;
/* Default nice value for processes started using compctl --run. */
#define COMPNICE 12
/* Other common definitions. */ /* Other common definitions. */
/* See README for the high-level protocol description. */ /* See README for the high-level protocol description. */
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/resource.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/un.h> #include <sys/un.h>
#include <unistd.h> #include <unistd.h>
...@@ -104,6 +105,9 @@ run(int argc, char *argv[]) ...@@ -104,6 +105,9 @@ run(int argc, char *argv[])
} }
free(line); free(line);
if (setpriority(PRIO_PROCESS, 0, COMPNICE) < 0)
perror("Warning: setpriority()");
char *argvx[argc + 1]; char *argvx[argc + 1];
for (int i = 0; i < argc; i++) for (int i = 0; i < argc; i++)
argvx[i] = argv[i]; argvx[i] = argv[i];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment