49,6 → 49,8 |
#define ELASTIC_PRESENT 1 |
#define ELASTIC_SAVE_ARRIVALS 2 |
|
#define ELASTIC_DEBUG |
|
typedef struct { |
|
struct timespec dline; |
68,6 → 70,8 |
|
int flags; |
|
int arrivals; |
|
} ELASTIC_task_descr; |
|
typedef struct { |
85,13 → 89,20 |
|
} ELASTIC_level_des; |
|
static int ELASTIC_recompute() { |
static int ELASTIC_recompute(ELASTIC_level_des *lev) { |
|
PID i; |
|
for (i=0; i<MAX_PROC; i++) { |
if (lev->elist[i].flags & ELASTIC_PRESENT) |
lev->elist[i].period = lev->elist[i].Tmax; |
} |
|
return 0; |
|
} |
|
static int ELASTIC_check_guarantie() { |
static int ELASTIC_check_guarantie(ELASTIC_level_des *lev) { |
|
return 0; |
|
159,12 → 170,12 |
lev->elist[p].beta = elastic->beta; |
|
if (lev->flags & ELASTIC_ENABLE_GUARANTEE) |
if (ELASTIC_check_guarantie() != 0) { |
if (ELASTIC_check_guarantie(lev) != 0) { |
lev->elist[p].flags = ELASTIC_EMPTY_SLOT; |
return -1; |
} |
|
ELASTIC_recompute(); |
ELASTIC_recompute(lev); |
|
if (lev->elist[p].period == 0) { |
lev->elist[p].flags = ELASTIC_EMPTY_SLOT; |
176,7 → 187,7 |
proc_table[p].control |= CONTROL_CAP; |
|
if (elastic->arrivals == SAVE_ARRIVALS) |
lev->elist[p].flags |= ELASTIC_SAVE_ARRIVALS; |
lev->elist[p].arrivals |= ELASTIC_SAVE_ARRIVALS; |
|
return 0; /* OK, also if the task cannot be guaranteed... */ |
|
190,9 → 201,7 |
|
static int ELASTIC_public_eligible(LEVEL l, PID p) |
{ |
|
ELASTIC_level_des *lev = (ELASTIC_level_des *)(level_table[l]); |
JOB_TASK_MODEL job; |
|
return 0; |
|
210,7 → 219,6 |
static void ELASTIC_public_epilogue(LEVEL l, PID p) |
{ |
ELASTIC_level_des *lev = (ELASTIC_level_des *)(level_table[l]); |
JOB_TASK_MODEL job; |
|
/* check if the wcet is finished... */ |
if (proc_table[p].avail_time <= 0) { |
236,7 → 244,7 |
/* check if we are not in the SLEEP state */ |
if (proc_table[p].status != SLEEP) { |
|
if (lev->flags & ELASTIC_SAVE_ARRIVALS) { |
if (lev->elist[p].arrivals & ELASTIC_SAVE_ARRIVALS) { |
|
/* skip the sporadic job, but increase a counter */ |
#ifdef ELASTIC_DEBUG |
281,11 → 289,25 |
static int ELASTIC_public_message(LEVEL l, PID p, void *m) |
{ |
ELASTIC_level_des *lev = (ELASTIC_level_des *)(level_table[l]); |
struct timespec acttime; |
|
switch((long)(m)) { |
|
case (long)(NULL): |
|
level_table[ lev->scheduling_level ]-> |
private_extract(lev->scheduling_level,p); |
|
if (lev->elist[p].nact == 0) { |
|
lev->elist[p].nact--; |
|
kern_gettime(&acttime); |
|
ELASTIC_activation(lev,p,&acttime); |
|
} |
|
jet_update_endcycle(); /* Update the Jet data... */ |
TRACER_LOGEVENT(FTrace_EVT_task_end_cycle,(unsigned short int)proc_table[p].context,(unsigned int)l); |
|
293,6 → 315,11 |
|
case 1: |
|
level_table[ lev->scheduling_level ]-> |
private_extract(lev->scheduling_level,p); |
|
proc_table[p].status = SLEEP; |
|
TRACER_LOGEVENT(FTrace_EVT_task_disable,(unsigned short int)proc_table[p].context,(unsigned int)l); |
|
break; |
348,7 → 375,7 |
sys_end(); |
} |
|
/* fill the CBS descriptor part */ |
/* fill the ELASTIC task descriptor part */ |
for (i=0; i<MAX_PROC; i++) { |
NULL_TIMESPEC(&(lev->elist[i].dline)); |
lev->elist[i].Tmin = 0; |
355,9 → 382,11 |
lev->elist[i].Tmax = 0; |
lev->elist[i].period = 0; |
lev->elist[i].wcet = 0; |
lev->elist[i].Up = 0; |
lev->elist[i].kelastic = 0; |
lev->elist[i].beta = 0; |
lev->elist[i].nact = 0; |
lev->elist[i].arrivals = SKIP_ARRIVALS; |
lev->elist[i].flags = ELASTIC_EMPTY_SLOT; |
} |
|