From 47e881f460cfb441be64a1ff17295357fb02d0ad Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Thu, 4 Oct 2012 23:59:45 +0000 Subject: Add IO priority support ('i' key) --- Process.h | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'Process.h') diff --git a/Process.h b/Process.h index 2c3e0c33..c5f59346 100644 --- a/Process.h +++ b/Process.h @@ -21,6 +21,7 @@ in the source distribution for its full text. #include "Object.h" #include "Affinity.h" +#include "IOPriority.h" #include #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); -- cgit v1.2.3