diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2012-10-04 23:59:45 +0000 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2012-10-04 23:59:45 +0000 |
commit | 47e881f460cfb441be64a1ff17295357fb02d0ad (patch) | |
tree | a0e48ec820c059d71be2abb0573393ef76052ea7 /Process.h | |
parent | e6c6d7fbf7c463c7e8c877b60059c47f1841e9c0 (diff) |
Add IO priority support ('i' key)
Diffstat (limited to 'Process.h')
-rw-r--r-- | Process.h | 21 |
1 files changed, 20 insertions, 1 deletions
@@ -21,6 +21,7 @@ in the source distribution for its full text. #include "Object.h" #include "Affinity.h" +#include "IOPriority.h" #include <sys/types.h> #ifndef Process_isKernelThread @@ -53,6 +54,7 @@ typedef enum ProcessField_ { #ifdef HAVE_CGROUP CGROUP, #endif + IO_PRIORITY, LAST_PROCESSFIELD } ProcessField; @@ -91,6 +93,7 @@ typedef struct Process_ { long int priority; long int nice; long int nlwp; + IOPriority ioPriority; char starttime_show[8]; time_t starttime_ctime; #ifdef DEBUG @@ -175,6 +178,22 @@ void Process_toggleTag(Process* this); bool Process_setPriority(Process* this, int priority); +bool Process_changePriorityBy(Process* this, size_t delta); + +IOPriority Process_updateIOPriority(Process* this); + +bool Process_setIOPriority(Process* this, IOPriority ioprio); + +/* +[1] Note that before kernel 2.6.26 a process that has not asked for +an io priority formally uses "none" as scheduling class, but the +io scheduler will treat such processes as if it were in the best +effort class. The priority within the best effort class will be +dynamically derived from the cpu nice level of the process: +extern io_priority; +*/ +#define Process_effectiveIOPriority(p_) (IOPriority_class(p_->ioPriority) == IOPRIO_CLASS_NONE ? IOPriority_tuple(IOPRIO_CLASS_BE, (p_->nice + 20) / 5) : p_->ioPriority) + #ifdef HAVE_LIBHWLOC Affinity* Process_getAffinity(Process* this); @@ -189,7 +208,7 @@ bool Process_setAffinity(Process* this, Affinity* affinity); #endif -void Process_sendSignal(Process* this, int sgn); +void Process_sendSignal(Process* this, size_t sgn); int Process_pidCompare(const void* v1, const void* v2); |