Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 250 → Rev 241

/shark/trunk/ports/first/modules/cbsstar.c
42,7 → 42,7
/*
* DEBUG stuffs begin
*/
#define CBSSTAR_DEBUG
//#define CBSSTAR_DEBUG
#ifdef CBSSTAR_DEBUG
 
static __inline__ void fake_printf(char *fmt, ...) {}
109,10 → 109,7
{
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
126,17 → 123,6
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
145,6 → 131,7
... 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);
158,6 → 145,7
 
b->current = p;
 
lev = (CBSSTAR_level_des *)(level_table[b->l]);
job_task_default_model(job, b->dline);
job_task_def_noexc(job);
187,9 → 175,9
struct budget_struct *b = arg;
CBSSTAR_level_des *lev=(CBSSTAR_level_des *)level_table[b->l];
//#ifdef CBSSTAR_DEBUG
kern_printf("(CS:Rec:");
//#endif
#ifdef CBSSTAR_DEBUG
cbsstar_printf("(CS:Rec:");
#endif
 
b->vtimer = NIL;
if (b->current != NIL && iq_query_first(&(b->tasks)) != NIL) {
202,15 → 190,15
lev->Uf -= bw;
#ifdef CBSSTAR_DEBUG
kern_printf("bw=%ld, U=%u, Uf=%u",(long)bw, lev->U, lev->Uf);
cbsstar_printf("%ld",(long)bw);
#endif
 
}
 
//#ifdef CBSSTAR_DEBUG
kern_printf(")");
//#endif
#ifdef CBSSTAR_DEBUG
cbsstar_printf(")");
#endif
 
 
}
252,7 → 240,7
lev->Uf += bw;
#ifdef CBSSTAR_DEBUG
kern_printf("BW=%ld, U=%u, Uf=%u",(long)bw, lev->U, lev->Uf);
cbsstar_printf("BW=%ld",(long)bw);
#endif
}
 
260,13 → 248,12
b->flags=CBSSTAR_ACTIVE;
 
}
else {
SUBTIMESPEC(&b->dline, &t3, &t2);
b->vtimer = kern_event_post(&t2, CBSSTAR_ANC, (void *)&b);
}
 
SUBTIMESPEC(&b->dline, &t3, &t2);
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 */
b->current = p;
 
290,10 → 277,10
 
SUBTIMESPEC(&schedule_time, &cap_lasttime, &ty);
tx = TIMESPEC2USEC(&ty);
b->avail -= (int)((long long)tx * (long long)lev->Uf / (int)lev->U);
b->avail -= tx;
 
#ifdef CBSSTAR_DEBUG
kern_printf("(CS:Cap p%d av=%d Uf=%u U=%u)", p, b->avail,lev->Uf, lev->U);
kern_printf("(CS:Cap p%d av=%d)", p, b->avail);
#endif
 
if (b->avail <= 0) b->flags = CBSSTAR_NOACTIVE;
570,7 → 557,6
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;