Indexing: have the indexer put itself in the ionice "idle" class by default (can be changed in the config)

This commit is contained in:
Jean-Francois Dockes
2011-09-29 12:03:26 +02:00
parent 8923d64fea
commit 95995b7ff9
8 changed files with 114 additions and 3 deletions
+3
View File
@@ -103,6 +103,9 @@ extern bool startMonitor(RclConfig *conf, int flags);
/** Main routine for the event receiving thread */
extern void *rclMonRcvRun(void *);
/** Utility routine to try and set ionice */
extern void rclMonIonice(RclConfig *conf);
// Specific debug macro for monitor synchronization events
#define MONDEB LOGDEB2
+12
View File
@@ -42,6 +42,7 @@
#include "recollindex.h"
#include "pathut.h"
#include "x11mon.h"
#include "rclionice.h"
typedef unsigned long mttcast;
@@ -545,4 +546,15 @@ bool startMonitor(RclConfig *conf, int opts)
LOGDEB(("Monitor: returning\n"));
return true;
}
void rclMonIonice(RclConfig *config)
{
string clss, classdata;
if (!config->getConfParam("monioniceclass", clss) || clss.empty())
clss = "3";
config->getConfParam("monioniceclassdata", classdata);
rclionice(clss, classdata);
}
#endif // RCL_MONITOR
+7 -1
View File
@@ -294,6 +294,8 @@ int main(int argc, const char **argv)
if (setpriority(PRIO_PROCESS, 0, 20) != 0) {
LOGINFO(("recollindex: can't setpriority(), errno %d\n", errno));
}
// Try to ionice. This does not work on all platforms
rclMonIonice(config);
if (op_flags & (OPT_i|OPT_e)) {
lockorexit(&pidfile);
@@ -350,12 +352,16 @@ int main(int argc, const char **argv)
exit(1);
}
}
pidfile.write_pid();
// Not too sure if I have to redo the nice thing after daemon(),
// can't hurt anyway (easier than testing on all platforms...)
if (setpriority(PRIO_PROCESS, 0, 20) != 0) {
LOGINFO(("recollindex: can't setpriority(), errno %d\n", errno));
}
pidfile.write_pid();
// Try to ionice. This does not work on all platforms
rclMonIonice(config);
if (sleepsecs > 0) {
LOGDEB(("recollindex: sleeping %d\n", sleepsecs));
for (int i = 0; i < sleepsecs; i++) {