Add IO priority support ('i' key)

This commit is contained in:
Hisham Muhammad
2012-10-04 23:59:45 +00:00
parent e6c6d7fbf7
commit 47e881f460
14 changed files with 285 additions and 72 deletions

View File

@ -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);