Baloo
20 #include <sys/resource.h>
24 #include <sys/syscall.h>
32 #ifndef IOPRIO_CLASS_IDLE
41 #ifndef IOPRIO_WHO_PROCESS
43 IOPRIO_WHO_PROCESS = 1,
49 #ifndef IOPRIO_CLASS_SHIFT
50 const int IOPRIO_CLASS_SHIFT = 13;
55 bool lowerIOPriority()
58 if ( syscall( SYS_ioprio_set, IOPRIO_WHO_PROCESS, 0, IOPRIO_CLASS_IDLE<<IOPRIO_CLASS_SHIFT ) < 0 ) {
59 qDebug(
"cannot set io scheduling to idle (%s). Trying best effort.\n", strerror( errno ));
60 if ( syscall( SYS_ioprio_set, IOPRIO_WHO_PROCESS, 0, 7|IOPRIO_CLASS_BE<<IOPRIO_CLASS_SHIFT ) < 0 ) {
61 qDebug(
"cannot set io scheduling to best effort.\n");
74 return !setpriority( PRIO_PROCESS, 0, 19 );
80 bool lowerSchedulingPriority()
83 struct sched_param param;
84 memset( ¶m, 0,
sizeof(param) );
85 param.sched_priority = 0;
86 return !sched_setscheduler( 0, SCHED_BATCH, ¶m );
92 bool setIdleSchedulingPriority()
95 struct sched_param param;
96 memset( ¶m, 0,
sizeof(param) );
97 param.sched_priority = 0;
98 return !sched_setscheduler( 0, SCHED_IDLE, ¶m );
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Wed Nov 29 2023 03:56:26 by
doxygen 1.8.17 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.