Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 699 → Rev 700

/shark/trunk/kernel/modules/elastic.c
66,10 → 66,10
 
struct timespec dline; /* The current absolute deadline */
bandwidth_t Umax; /* The maximum utilization, Umax = C/Tmin */
bandwidth_t Umin; /* The minimum utilization, Umin = C/Tmax */
ext_bandwidth_t Umax; /* The maximum utilization, Umax = C/Tmin */
ext_bandwidth_t Umin; /* The minimum utilization, Umin = C/Tmax */
 
bandwidth_t U; /* The current utilization */
ext_bandwidth_t U; /* The current utilization */
TIME T; /* The current period, T = C/U */
 
int flags;
79,7 → 79,7
typedef struct {
level_des l; /*+ the standard level descriptor +*/
 
bandwidth_t U; /*+ the bandwidth reserved for elastic tasks +*/
ext_bandwidth_t U; /*+ the bandwidth reserved for elastic tasks +*/
 
ELASTIC_task_descr elist[MAX_PROC];
 
114,15 → 114,20
if (t->flags & ELASTIC_PRESENT) {
if (t->E == 0) {
Umin += t->U;
Umax += t->U;
} else {
Umin += t->Umin;
Umax += t->Umax;
t->U = t->Umax; // reset previous saturations
t->T = ((long long)t->C * (long long)MAX_BANDWIDTH) / t->U;
}
}
}
if (Umin > lev->U) return -1; // NOT FEASIBLE
if (Umin > lev->U) return -1; // NOT FEASIBLE
 
if (Umax <= lev->U) return 0; // FEASIBLE WITH MAXIMUM UTILIZATIONS
 
do {
Uf = 0;
Ev = 0;
220,8 → 225,10
{
ELASTIC_level_des *lev = (ELASTIC_level_des *)(level_table[l]);
 
return 1;
 
if (*freebandwidth >= lev->U) {
*freebandwidth -= lev->U;
*freebandwidth -= (unsigned int)lev->U;
return 1;
} else {
return 0;
228,31 → 235,7
}
}
 
/* Checks if the current task set is feasible. Returns 1=yes, 0=no */
static int ELASTIC_feasible(ELASTIC_level_des *lev)
{
ext_bandwidth_t Umin = 0;
PID i;
 
for (i=0; i<MAX_PROC; i++) {
if (lev->elist[i].flags & ELASTIC_PRESENT) {
if (lev->elist[i].E == 0) {
/* The task is not elastic. Use current utilization U */
Umin += lev->elist[i].U;
} else {
/* The task is elastic. Use minimum utilization Umin */
Umin += lev->elist[i].Umin;
}
}
}
if (Umin > lev->U) {
return 0;
} else {
return 1;
}
}
 
 
static int ELASTIC_public_create(LEVEL l, PID p, TASK_MODEL *m)
{
ELASTIC_level_des *lev = (ELASTIC_level_des *)(level_table[l]);
439,7 → 422,7
}
 
/*+ Registration function +*/
LEVEL ELASTIC_register_level(int flags, LEVEL master, bandwidth_t U)
LEVEL ELASTIC_register_level(int flags, LEVEL master, ext_bandwidth_t U)
{
LEVEL l; /* the level that we register */
ELASTIC_level_des *lev; /* for readableness only */
/shark/trunk/include/modules/elastic.h
45,7 → 45,7
#define ELASTIC_ENABLE_GUARANTEE 1 /*+ Task Guarantee enabled +*/
#define ELASTIC_ENABLE_ALL 1
 
LEVEL ELASTIC_register_level(int flags, LEVEL master, bandwidth_t U);
LEVEL ELASTIC_register_level(int flags, LEVEL master, ext_bandwidth_t U);
 
__END_DECLS
#endif