Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 867 → Rev 866

/shark/trunk/ports/first/modules/grubstar.c
47,12 → 47,6
TIME Q; /* Budget */
TIME T; /* Period */
TIME D; /* Deadline */
 
/* Negotiate parameter */
TIME N_Q; /* Negotiate budget */
TIME N_T; /* Negotiate Period */
TIME N_D; /* Negotiate Deadline */
 
bandwidth_t Ub; /* Bandwidth */
 
struct timespec dline; /* deadline */
69,7 → 63,6
PID current; /* the task currently put in execution */
int flags;
int negotiation;
 
IQUEUE tasks; /* a FIFO queue for the tasks handled
using the budget */
94,7 → 87,6
 
int cap_lev;
struct timespec cap_lasttime;
int negotiation_in_progress;
 
LEVEL scheduling_level;
 
116,19 → 108,6
b->replenish_timer = NIL;
 
b->last_reclaiming = 0;
if (b->negotiation) {
lev->negotiation_in_progress--;
b->negotiation=0;
b->Q=b->N_Q;
b->T=b->N_T;
b->D=b->N_D;
 
b->N_Q=0;
b->N_T=0;
b->N_D=0;
}
 
b->avail += b->Q;
if (b->avail > b->Q) b->avail = b->Q;
 
235,18 → 214,6
ADDUSEC2TIMESPEC(b->T, &b->replenish);
TIMESPEC_ASSIGN(&b->dline, acttime);
ADDUSEC2TIMESPEC(b->D, &b->dline);
if (b->negotiation) {
lev->negotiation_in_progress--;
b->negotiation=0;
b->Q=b->N_Q;
b->T=b->N_T;
b->D=b->N_D;
b->N_Q=0;
b->N_T=0;
b->N_D=0;
}
 
b->avail = b->Q;
b->last_reclaiming = 0;
}
355,17 → 322,6
ADDUSEC2TIMESPEC(b->T, &b->replenish);
 
/* and the capacity */
if (b->negotiation) {
lev->negotiation_in_progress--;
b->negotiation=0;
b->Q=b->N_Q;
b->T=b->N_T;
b->D=b->N_D;
b->N_Q=0;
b->N_T=0;
b->N_D=0;
}
b->avail = b->Q;
b->last_reclaiming = 0;
644,11 → 600,6
lev->b[i].Q = 0;
lev->b[i].T = 0;
lev->b[i].D = 0;
lev->b[i].N_Q = 0;
lev->b[i].N_T = 0;
lev->b[i].N_D = 0;
 
lev->b[i].Ub = 0;
NULL_TIMESPEC(&lev->b[i].dline);
NULL_TIMESPEC(&lev->b[i].replenish);
659,7 → 610,6
lev->b[i].flags = GRUBSTAR_ACTIVE;
lev->b[i].l = l;
lev->b[i].last_reclaiming = 0;
lev->b[i].negotiation = 0;
iq_init(&lev->b[i].tasks, NULL, 0);
}
 
669,7 → 619,6
for (i=0; i<MAX_PROC; i++)
lev->tb[i] = NIL;
 
lev->negotiation_in_progress=0;
lev->U = 0;
lev->Uf = 0;
lev->cap_lev = NIL;
706,18 → 655,12
lev->b[r].Q = Q;
lev->b[r].T = T;
lev->b[r].D = D;
 
lev->b[r].N_Q = 0;
lev->b[r].N_T = 0;
lev->b[r].N_D = 0;
lev->b[r].negotiation=0;
 
lev->b[r].Ub = b;
lev->b[r].avail = Q;
lev->b[r].flags = GRUBSTAR_RECLAIMING;
lev->b[r].loc_sched_id = scheduler_id;
lev->b[r].loc_sched_level = local_scheduler_level;
lev->b[r].last_reclaiming = 0;
lev->b[r].last_reclaiming = 0;
 
return r;
}
743,13 → 686,6
lev->b[budget].Q = 0;
lev->b[budget].T = 0;
lev->b[budget].D = 0;
 
lev->b[budget].N_Q = 0;
lev->b[budget].N_T = 0;
lev->b[budget].N_D = 0;
 
lev->b[budget].negotiation=0;
 
lev->b[budget].Ub = 0;
NULL_TIMESPEC(&lev->b[budget].dline);
NULL_TIMESPEC(&lev->b[budget].replenish);
778,24 → 714,10
lev->U -= b;
if (lev->b[budget].flags != GRUBSTAR_RECLAIMING) lev->Uf -= b;
 
lev->b[budget].N_Q = Q;
lev->b[budget].N_T = T;
lev->b[budget].N_D = D;
lev->b[budget].Q = Q;
lev->b[budget].T = T;
lev->b[budget].D = D;
 
if (lev->b[budget].current!=NIL) {
lev->b[budget].N_Q = Q;
lev->b[budget].N_T = T;
lev->b[budget].N_D = D;
if (!lev->b[budget].negotiation) {
lev->negotiation_in_progress++;
lev->b[budget].negotiation=1;
}
} else {
lev->b[budget].Q = Q;
lev->b[budget].T = T;
lev->b[budget].D = D;
}
 
mul32div32to32(MAX_BANDWIDTH,Q,T,lev->b[budget].Ub);
 
lev->U += lev->b[budget].Ub;
818,16 → 740,13
{
 
GRUBSTAR_level_des *lev = (GRUBSTAR_level_des *)(level_table[l]);
*Q = lev->b[budget].Q;
*T = lev->b[budget].T;
*D = lev->b[budget].D;
 
if (lev->b[budget].Q) {
if (Q) *Q = lev->b[budget].Q;
if (T) *T = lev->b[budget].T;
if (D) *D = lev->b[budget].D;
return 0;
}
return 0;
 
return -1;
 
}
 
int GRUBSTAR_get_last_reclaiming(LEVEL l, PID p)
916,10 → 835,4
}
 
int GRUBSTAR_get_renegotiation_status(LEVEL l, int budget)
{
GRUBSTAR_level_des *lev = (GRUBSTAR_level_des *)(level_table[l]);
if (lev->negotiation_in_progress) return 1;
else return 0;
}