/shark/trunk/ports/first/modules/grubstar.c |
---|
57,6 → 57,7 |
struct timespec dline; /* deadline */ |
struct timespec replenish; /* server period */ |
struct timespec vtimer_istant; /* timer of virtual time arrive */ |
int replenish_timer; |
int vtimer; |
int avail; /* current budget */ |
225,13 → 226,14 |
TRACER_LOGEVENT(FTrace_EVT_server_active,0,(unsigned int)b); |
if (b->vtimer!=NIL) kern_event_delete(b->vtimer); |
if (b->vtimer!=NIL) { |
kern_event_delete(b->vtimer); |
TIMESPEC_ASSIGN(acttime, &b->vtimer_istant); |
} |
b->vtimer=NIL; |
SUBTIMESPEC(&b->dline, acttime, &t2); |
if (/* 1 */ TIMESPEC_A_LT_B(&b->dline, acttime) || |
/* 2 */ TIMESPEC_A_GT_B(&t3, &t2) ) { |
//SUBTIMESPEC(&b->dline, acttime, &t2); |
//if (/* 1 */ TIMESPEC_A_LT_B(&b->dline, acttime) || |
// /* 2 */ TIMESPEC_A_GT_B(&t3, &t2) ) { |
if (b->negotiation) { |
lev->negotiation_in_progress--; |
b->negotiation=0; |
249,7 → 251,7 |
ADDUSEC2TIMESPEC(b->D, &b->dline); |
b->avail = b->Q; |
b->last_reclaiming = 0; |
} |
//} |
if (b->flags==GRUBSTAR_RECLAIMING) |
if (lev->Uf < lev->U) lev->Uf += b->Ub; |
313,6 → 315,7 |
t3.tv_sec = t / 1000000; |
t3.tv_nsec = (t % 1000000) * 1000; |
SUBTIMESPEC(&b->dline, &t3, &t2); |
TIMESPEC_ASSIGN(&b->vtimer_istant , &t2); |
b->vtimer = kern_event_post(&t2, GRUBSTAR_ANC, b); |
} |
} |
419,10 → 422,8 |
#ifdef GRUBSTAR_DEBUG |
kern_printf("(GS:PriIns:%d:%d", p, budget->b); |
#endif |
if (budget->b == -1) |
return; |
lev->tb[p] = budget->b; |
if (lev->b[budget->b].current == NIL && lev->b[budget->b].flags ) { |
451,7 → 452,6 |
#ifdef GRUBSTAR_DEBUG |
kern_printf("(GS:Ext:%d)", p); |
#endif |
/* a task is removed from execution for some reasons. It must be |
that it is the first in its budget queue (only the first task in |
a budget queue is put into execution!) */ |
521,6 → 521,7 |
mul32div32to32(lev->b[lev->tb[exec]].avail,(lev->U-lev->Uf),lev->U,lev->b[lev->tb[exec]].last_reclaiming); |
if (lev->b[lev->tb[exec]].last_reclaiming > 0) |
TRACER_LOGEVENT(FTrace_EVT_server_using_rec,(unsigned short int)lev->b[lev->tb[exec]].last_reclaiming,(unsigned int)(&lev->b[lev->tb[exec]])); |
653,6 → 654,7 |
lev->b[i].Ub = 0; |
NULL_TIMESPEC(&lev->b[i].dline); |
NULL_TIMESPEC(&lev->b[i].replenish); |
NULL_TIMESPEC(&lev->b[i].vtimer_istant); |
lev->b[i].replenish_timer = NIL; |
lev->b[i].vtimer = NIL; |
lev->b[i].avail = 0; |
760,7 → 762,7 |
lev->b[budget].current = -1; |
lev->b[budget].flags = GRUBSTAR_RECLAIMING; |
lev->b[budget].last_reclaiming = 0; |
lev->b[budget].loc_sched_level; |
lev->b[budget].loc_sched_level = -1; |
return 0; |
785,7 → 787,7 |
lev->b[budget].N_T = T; |
lev->b[budget].N_D = D; |
if (lev->b[budget].current!=NIL && !(lev->b[budget].Q==Q && lev->b[budget].T==T)) { |
if (0 && lev->b[budget].current!=NIL && !(lev->b[budget].Q==Q && lev->b[budget].T==T)) { |
lev->b[budget].N_Q = Q; |
lev->b[budget].N_T = T; |
lev->b[budget].N_D = D; |
/shark/trunk/ports/first/modules/nonestar.c |
---|
133,15 → 133,15 |
/* Change task level */ |
if (lev->flag & NONESTAR_CHANGE_LEVEL) { |
STD_command_message msg; |
proc_table[p].status = SLEEP; |
if (lev->current!=NIL && lev->status!=NONESTAR_IDLE) |
if (lev->current!=NIL && lev->status!=NONESTAR_IDLE) { |
level_table[ lev->scheduling_level ]-> |
private_extract(lev->scheduling_level, p); |
} |
lev->current = NIL; |
lev->budget = -1; |
proc_table[p].task_level = lev->new_level[p]; |
lev->flag=0; |
/* Send change level command to local scheduler */ |
168,7 → 168,6 |
#ifdef NONESTAR_DEBUG |
kern_printf("(NN:Epi:%d)",p); |
#endif |
if (NONESTAR_change_level(l, p)) return; |
level_table[ lev->scheduling_level ] -> |
194,13 → 193,16 |
{ |
NONESTAR_level_des *lev = (NONESTAR_level_des *)(level_table[l]); |
BUDGET_TASK_MODEL b; |
TIME Q; |
budget_task_default_model(b, lev->budget); |
#ifdef NONESTAR_DEBUG |
kern_printf("(NN:Act:%d:%d)",p,lev->budget); |
#endif |
GRUBSTAR_getbudgetinfo(lev->scheduling_level, &Q, NULL, NULL, lev->budget); |
lev->server_Q=Q; |
proc_table[p].avail_time = lev->server_Q; |
proc_table[p].wcet = lev->server_Q; |
lev->status = NONESTAR_READY; |
level_table[ lev->scheduling_level ]-> |
214,12 → 216,12 |
BUDGET_TASK_MODEL b; |
#ifdef NONESTAR_DEBUG |
kern_printf("(NS:pu)"); |
kern_printf("(NS:pu %d)",p); |
#endif |
lev->current=p; |
budget_task_default_model(b, lev->budget); |
lev->status=NONESTAR_READY; |
level_table[ lev->scheduling_level ]-> |
private_insert(lev->scheduling_level, p, (TASK_MODEL *)&b); |
230,9 → 232,9 |
NONESTAR_level_des *lev = (NONESTAR_level_des *)(level_table[l]); |
#ifdef NONESTAR_DEBUG |
kern_printf("(NN:pb)"); |
kern_printf("(NN:pb %d)", p); |
#endif |
lev->status=NONESTAR_IDLE; |
/* the task is blocked on a synchronization primitive. we have to |
remove it from the master module -and- from the local queue! */ |
lev->current=NIL; |
282,7 → 284,6 |
case STD_SET_NEW_MODEL: |
/* if the NONESTAR_task_create is called, then the pclass must be a |
valid pclass. */ |
h=(DUMMY_TASK_MODEL *)(msg->param); |
/* now we know that m is a valid model */ |
lev->flag = 0; |
290,7 → 291,6 |
lev->status = NONESTAR_IDLE; |
break; |
case STD_SET_NEW_LEVEL: |
297,7 → 297,6 |
lev->flag |= NONESTAR_CHANGE_LEVEL; |
lev->new_level[p] = (int)(msg->param); |
break; |
case STD_ACTIVATE_TASK: |
305,7 → 304,6 |
/* Enable wcet check */ |
proc_table[p].avail_time = lev->server_Q; |
proc_table[p].wcet = lev->server_Q; |
//kern_printf("(NN:ActEcy:%d:%d)", p, lev->server_Q); |
proc_table[p].control = (proc_table[p].control & ~CONTROL_CAP); |
NONESTAR_public_activate(l, p, NULL); |
407,6 → 405,11 |
} |
int NONESTAR_get_current(LEVEL l) { |
NONESTAR_level_des *lev = (NONESTAR_level_des *)(level_table[l]); |
return lev->current; |
} |
int NONESTAR_get_remain_capacity(int budget) |
{ |
return SERVER_get_remain_capacity(fsf_get_server_level(),budget); |