42,7 → 42,7 |
/* |
* DEBUG stuffs begin |
*/ |
//#define CBSSTAR_DEBUG |
#define CBSSTAR_DEBUG |
#ifdef CBSSTAR_DEBUG |
|
static __inline__ void fake_printf(char *fmt, ...) {} |
109,7 → 109,10 |
{ |
struct budget_struct *b = a; |
PID p; |
CBSSTAR_level_des *lev; |
|
lev = (CBSSTAR_level_des *)(level_table[b->l]); |
|
#ifdef CBSSTAR_DEBUG |
cbsstar_printf("(CS:HrdRes:"); |
#endif |
123,6 → 126,17 |
b->avail += b->Q; |
if (b->avail > b->Q) b->avail = b->Q; |
|
if (b->flags==CBSSTAR_RECLAIMING && b->avail>0) { |
bandwidth_t bw; |
bw = (MAX_BANDWIDTH / b->T) * b->Q; |
|
lev->Uf += bw; |
|
#ifdef CBSSTAR_DEBUG |
kern_printf("BW=%ld, U=%u, Uf=%u",(long)bw, lev->U, lev->Uf); |
#endif |
} |
|
if (b->avail > 0) b->flags = CBSSTAR_ACTIVE; |
|
/* avail may be <0 because a task executed via a shadow fo many time |
131,7 → 145,6 |
... we are now activating the next task */ |
if (b->current == NIL && b->flags) { |
if (iq_query_first(&(b->tasks)) != NIL) { |
CBSSTAR_level_des *lev; |
JOB_TASK_MODEL job; |
|
p = iq_getfirst(&b->tasks); |
145,7 → 158,6 |
|
b->current = p; |
|
lev = (CBSSTAR_level_des *)(level_table[b->l]); |
|
job_task_default_model(job, b->dline); |
job_task_def_noexc(job); |
175,9 → 187,9 |
struct budget_struct *b = arg; |
CBSSTAR_level_des *lev=(CBSSTAR_level_des *)level_table[b->l]; |
|
#ifdef CBSSTAR_DEBUG |
cbsstar_printf("(CS:Rec:"); |
#endif |
//#ifdef CBSSTAR_DEBUG |
kern_printf("(CS:Rec:"); |
//#endif |
|
b->vtimer = NIL; |
if (b->current != NIL && iq_query_first(&(b->tasks)) != NIL) { |
190,15 → 202,15 |
lev->Uf -= bw; |
|
#ifdef CBSSTAR_DEBUG |
cbsstar_printf("%ld",(long)bw); |
kern_printf("bw=%ld, U=%u, Uf=%u",(long)bw, lev->U, lev->Uf); |
#endif |
|
|
} |
|
#ifdef CBSSTAR_DEBUG |
cbsstar_printf(")"); |
#endif |
//#ifdef CBSSTAR_DEBUG |
kern_printf(")"); |
//#endif |
|
|
} |
240,7 → 252,7 |
lev->Uf += bw; |
|
#ifdef CBSSTAR_DEBUG |
cbsstar_printf("BW=%ld",(long)bw); |
kern_printf("BW=%ld, U=%u, Uf=%u",(long)bw, lev->U, lev->Uf); |
#endif |
} |
|
248,10 → 260,11 |
b->flags=CBSSTAR_ACTIVE; |
|
} |
else { |
|
SUBTIMESPEC(&b->dline, &t3, &t2); |
b->vtimer = kern_event_post(&t2, CBSSTAR_ANC, (void *)&b); |
} |
if (b->vtimer!=NIL) kern_event_delete(b->vtimer); |
b->vtimer=NIL; |
b->vtimer = kern_event_post(&t2, CBSSTAR_ANC, b); |
|
|
/* record the current task inserted in the master module */ |
277,10 → 290,10 |
|
SUBTIMESPEC(&schedule_time, &cap_lasttime, &ty); |
tx = TIMESPEC2USEC(&ty); |
b->avail -= tx; |
b->avail -= (int)((long long)tx * (long long)lev->Uf / (int)lev->U); |
|
#ifdef CBSSTAR_DEBUG |
kern_printf("(CS:Cap p%d av=%d)", p, b->avail); |
kern_printf("(CS:Cap p%d av=%d Uf=%u U=%u)", p, b->avail,lev->Uf, lev->U); |
#endif |
|
if (b->avail <= 0) b->flags = CBSSTAR_NOACTIVE; |
557,6 → 570,7 |
lev->b[i].T = 0; |
NULL_TIMESPEC(&lev->b[i].dline); |
lev->b[i].dline_timer = NIL; |
lev->b[i].vtimer=NIL; |
lev->b[i].avail = 0; |
lev->b[i].current = -1; |
lev->b[i].flags = CBSSTAR_ACTIVE; |