Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 682 → Rev 683

/shark/trunk/kernel/modules/elastic.c
47,8 → 47,9
 
#define ELASTIC_EMPTY_SLOT 0
#define ELASTIC_PRESENT 1
#define ELASTIC_SAVE_ARRIVALS 2
 
#define ELASTIC_IDLE APER_STATUS_BASE
 
#define ELASTIC_DEBUG
 
typedef struct {
66,12 → 67,8
int kelastic;
int beta;
 
int nact;
 
int flags;
 
int arrivals;
 
} ELASTIC_task_descr;
 
typedef struct {
79,7 → 76,7
 
bandwidth_t U; /*+ the used bandwidth by the server +*/
 
ELASTIC_task_descr *elist;
ELASTIC_task_descr *elist;//[MAX_PROC];
 
LEVEL scheduling_level;
 
118,6 → 115,9
TIMESPEC_ASSIGN(&(lev->elist[p].dline),acttime);
ADDUSEC2TIMESPEC(lev->elist[p].period,&(lev->elist[p].dline));
 
proc_table[p].avail_time = lev->elist[p].wcet;
proc_table[p].wcet = lev->elist[p].wcet;
 
/* Job insertion */
job_task_default_model(job, lev->elist[p].dline);
level_table[ lev->scheduling_level ]->
130,12 → 130,21
PID p = (PID)(arg);
ELASTIC_level_des *lev;
struct timespec acttime;
#ifdef ELASTIC_DEBUG
printk("(ELASTIC:Timer:%d)",p);
#endif
kern_gettime(&acttime);
lev = (ELASTIC_level_des *)level_table[proc_table[p].task_level];
ELASTIC_activation(lev, p, &acttime);
event_need_reschedule();
 
/* Next activation */
kern_event_post(&(lev->elist[p].dline), ELASTIC_timer_act, (void *)(p));
}
 
/* The on-line guarantee is enabled only if the appropriate flag is set... */
143,7 → 152,7
{
ELASTIC_level_des *lev = (ELASTIC_level_des *)(level_table[l]);
 
return 0;
return 1;
 
}
 
186,9 → 195,6
proc_table[p].wcet = elastic->wcet;
proc_table[p].control |= CONTROL_CAP;
 
if (elastic->arrivals == SAVE_ARRIVALS)
lev->elist[p].arrivals |= ELASTIC_SAVE_ARRIVALS;
 
return 0; /* OK, also if the task cannot be guaranteed... */
 
}
211,6 → 217,10
{
ELASTIC_level_des *lev = (ELASTIC_level_des *)(level_table[l]);
 
#ifdef ELASTIC_DEBUG
printk("(ELASTIC:Dsp:%d)",p);
#endif
 
level_table[ lev->scheduling_level ]->
private_dispatch(lev->scheduling_level,p,nostop);
 
220,6 → 230,10
{
ELASTIC_level_des *lev = (ELASTIC_level_des *)(level_table[l]);
 
#ifdef ELASTIC_DEBUG
printk("(ELASTIC:Epi:%d)",p);
#endif
 
/* check if the wcet is finished... */
if (proc_table[p].avail_time <= 0) {
244,17 → 258,6
/* check if we are not in the SLEEP state */
if (proc_table[p].status != SLEEP) {
if (lev->elist[p].arrivals & ELASTIC_SAVE_ARRIVALS) {
/* skip the sporadic job, but increase a counter */
#ifdef ELASTIC_DEBUG
printk("(ELASTIC:SaveAct:%d)", p);
#endif
lev->elist[p].nact++;
}
return;
}
295,19 → 298,15
 
case (long)(NULL):
 
#ifdef ELASTIC_DEBUG
printk("(ELASTIC:EndCyc:%d)",p);
#endif
 
level_table[ lev->scheduling_level ]->
private_extract(lev->scheduling_level,p);
 
if (lev->elist[p].nact > 0) {
proc_table[p].status = ELASTIC_IDLE;
 
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);
 
315,6 → 314,10
 
case 1:
 
#ifdef ELASTIC_DEBUG
printk("(ELASTIC:Disable:%d)",p);
#endif
 
level_table[ lev->scheduling_level ]->
private_extract(lev->scheduling_level,p);
 
369,11 → 372,7
lev->l.public_block = ELASTIC_public_block;
lev->l.public_message = ELASTIC_public_message;
 
lev->elist = malloc(MAX_PROC * sizeof(ELASTIC_task_descr));
if (lev->elist == NULL) {
printk("ELASTIC: Error allocating elastic task decriptor table\n");
sys_end();
}
lev->elist = kern_alloc(MAX_PROC * sizeof(ELASTIC_task_descr));
 
/* fill the ELASTIC task descriptor part */
for (i=0; i<MAX_PROC; i++) {
385,8 → 384,6
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;
}