236,7 → 236,7 |
b->avail -= tx - b->last_reclaiming; |
|
#ifdef GRUBSTAR_DEBUG |
//kern_printf("(GS:Cap p%d av=%d Uf=%u U=%u, tx=%d)", p, b->avail, lev->Uf, lev->U,(int)tx); |
kern_printf("(GS:Cap p%d av=%d Uf=%u U=%u, tx=%d)", p, b->avail, lev->Uf, lev->U,(int)tx); |
#endif |
|
if (b->avail <= 0) b->flags = GRUBSTAR_NOACTIVE; |
258,32 → 258,14 |
} |
} |
|
|
/* The on-line guarantee is enabled only if the appropriate flag is set... */ |
static int GRUBSTAR_public_guarantee(LEVEL l, bandwidth_t *freebandwidth) |
{ |
GRUBSTAR_level_des *lev = (GRUBSTAR_level_des *)(level_table[l]); |
|
#ifdef GRUBSTAR_DEBUG |
kern_printf("(GS:Gua)"); |
#endif |
|
if (*freebandwidth >= lev->U) { |
*freebandwidth -= lev->U; |
return 1; |
} |
else |
return 0; |
} |
|
static void capacity_handler(void *l) |
{ |
|
GRUBSTAR_level_des *lev = l; |
lev->cap_lev = NIL; |
#ifdef GRUBSTAR_DEBUG |
kern_printf("(*)"); |
#endif |
#ifdef GRUBSTAR_DEBUG |
kern_printf("(*)"); |
#endif |
event_need_reschedule(); |
|
} |
292,12 → 274,12 |
{ |
GRUBSTAR_level_des *lev = (GRUBSTAR_level_des *)(level_table[l]); |
struct budget_struct *b=&lev->b[lev->tb[p]]; |
JOB_TASK_MODEL job; |
|
if ( TIMESPEC_A_LT_B(&b->dline, &schedule_time)) { |
|
JOB_TASK_MODEL job; |
|
if ( TIMESPEC_A_LT_B(&b->dline, &schedule_time)) { |
#ifdef GRUBSTAR_DEBUG |
kern_printf("(GS:Eli:%d)",p); |
|
#endif |
if (lev->cap_lev!=NIL) { |
kern_event_delete(lev->cap_lev); |
lev->cap_lev=NIL; |
307,7 → 289,7 |
level_table[ lev->scheduling_level ]-> |
private_extract(lev->scheduling_level, p); |
/* we modify the deadline ... */ |
TIMESPEC_ASSIGN(&b->dline, &schedule_time); |
kern_gettime(&b->dline); |
ADDUSEC2TIMESPEC(b->T, &b->dline); |
|
/* and the capacity */ |
471,9 → 453,6 |
if (p==exec) b = &lev->b[lev->tb[p]]; |
else if (lev->tb[exec]!=NIL) { |
b = &lev->b[lev->tb[exec]]; |
#ifdef GRUBSTAR_DEBUG |
kern_printf("(ex%d, c%d)***************************", exec, p); |
#endif |
p=exec; |
skip_epilog=1; |
} |
480,9 → 459,7 |
else return; |
|
|
GRUBSTAR_account_capacity(lev,p); |
// L'evento di capacità va cancellato perchè sarà ripristinato nella successiva dispatch |
/* we have to check if the capacity is still available */ |
GRUBSTAR_account_capacity(lev,p); |
if (b->flags) { |
|
/* there is capacity available, maybe it is simply a preemption; |
493,9 → 470,9 |
|
} else { |
/* we kill the current activation */ |
#ifdef GRUBSTAR_DEBUG |
kern_printf("(GS:HRExt:%d",p); |
#endif |
#ifdef GRUBSTAR_DEBUG |
kern_printf("(GS:HRExt:%d",p); |
#endif |
level_table[ lev->scheduling_level ]-> |
private_extract(lev->scheduling_level, p); |
|
554,7 → 531,7 |
lev->l.private_dispatch = GRUBSTAR_private_dispatch; |
lev->l.private_epilogue = GRUBSTAR_private_epilogue; |
|
lev->l.public_guarantee = GRUBSTAR_public_guarantee; |
lev->l.public_guarantee = NULL; |
lev->l.public_message = GRUBSTAR_public_message; |
|
lev->b = (struct budget_struct *)kern_alloc(sizeof(struct budget_struct)*n); |
565,7 → 542,7 |
lev->b[i].Ub = 0; |
NULL_TIMESPEC(&lev->b[i].dline); |
lev->b[i].dline_timer = NIL; |
lev->b[i].vtimer=NIL; |
lev->b[i].vtimer = NIL; |
lev->b[i].avail = 0; |
lev->b[i].current = -1; |
lev->b[i].flags = GRUBSTAR_ACTIVE; |
660,10 → 637,16 |
{ |
|
GRUBSTAR_level_des *lev = (GRUBSTAR_level_des *)(level_table[l]); |
bandwidth_t b; |
|
b = (MAX_BANDWIDTH / lev->b[budget].T) * lev->b[budget].Q; |
|
lev->U -= b; |
|
lev->b[budget].Q = Q; |
lev->b[budget].T = T; |
lev->b[budget].Ub = (MAX_BANDWIDTH / T) * Q; |
lev->U += lev->b[budget].Ub; |
|
return 0; |
|