Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 267 → Rev 266

/shark/trunk/ports/first/modules/grubstar.c
6,8 → 6,9
* Paolo Gai <pj@gandalf.sssup.it>
*
* Authors :
* Giacomo Guidi <giacomo@gandalf.sssup.it>
* Michael Trimarchi <trimarchi@gandalf.sssup.it>
* Paolo Gai <pj@gandalf.sssup.it>
* Massimiliano Giorgi <massy@gandalf.sssup.it>
* Luca Abeni <luca@gandalf.sssup.it>
* (see the web pages for full authors list)
*
* ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
75,11 → 76,9
 
int tb[MAX_PROC]; /* link task->budget (used in guest_end) */
 
bandwidth_t U; /*+ the used bandwidth by the server +*/
bandwidth_t Uf; /*+ the actual used bandwidth by the server +*/
bandwidth_t U; /*+ the used bandwidth by the server +*/
bandwidth_t Uf; /*+ the actual used bandwidth by the server +*/
 
int last_reclaiming;
 
int cap_lev;
 
LEVEL scheduling_level;
166,7 → 165,7
#endif
 
b->vtimer = NIL;
if (b->current == NIL && iq_query_first(&(b->tasks)) == NIL && b->flags != GRUBSTAR_RECLAIMING) {
if (b->current == NIL && iq_query_first(&(b->tasks)) == NIL) {
bandwidth_t bw;
 
b->flags=GRUBSTAR_RECLAIMING;
258,10 → 257,8
kern_printf("(GS:Cap p%d av=%d)", p, b->avail);
#endif
 
lev->last_reclaiming = (unsigned int)((long long)(tx) * (long long)(lev->U - lev->Uf)/MAX_BANDWIDTH);
b->avail -= (tx-(unsigned int)((long long)tx * (long long)(lev->U - lev->Uf)/MAX_BANDWIDTH));
 
b->avail -= tx - lev->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,tx);
#endif
496,38 → 493,6
 
}
 
static int GRUBSTAR_public_message(LEVEL l, PID p, void *m)
{
GRUBSTAR_level_des *lev = (GRUBSTAR_level_des *)(level_table[l]);
struct budget_struct *b = &lev->b[lev->tb[p]];
 
switch((long)(m)) {
 
case (long)(NULL):
 
if (b->current == NIL && iq_query_first(&(b->tasks)) == NIL && b->flags != GRUBSTAR_RECLAIMING) {
bandwidth_t bw;
b->flags = GRUBSTAR_RECLAIMING;
bw = (MAX_BANDWIDTH / b->T) * b->Q;
lev->Uf -= bw;
 
}
 
break;
 
case 1:
 
break;
 
}
 
return 0;
 
}
 
/* Registration functions }*/
 
LEVEL GRUBSTAR_register_level(int n, LEVEL master)
551,7 → 516,6
lev->l.private_epilogue = GRUBSTAR_private_epilogue;
 
lev->l.public_guarantee = GRUBSTAR_public_guarantee;
lev->l.public_message = GRUBSTAR_public_message;
 
lev->b = (struct budget_struct *)kern_alloc(sizeof(struct budget_struct)*n);
 
576,7 → 540,6
 
lev->U = 0;
lev->Uf = 0;
lev->last_reclaiming = 0;
lev->cap_lev = NIL;
lev->scheduling_level = master;
 
670,15 → 633,6
 
}
 
int GRUBSTAR_get_last_reclaiming(LEVEL l)
{
 
GRUBSTAR_level_des *lev = (GRUBSTAR_level_des *)(level_table[l]);
 
return lev->last_reclaiming;
 
}
 
int GRUBSTAR_is_active(LEVEL l, int budget)
{
GRUBSTAR_level_des *lev = (GRUBSTAR_level_des *)(level_table[l]);
/shark/trunk/ports/first/include/grubstar.h
6,8 → 6,9
* Paolo Gai <pj@gandalf.sssup.it>
*
* Authors :
* Giacomo Guidi <giacomo@gandalf.sssup.it>
* Michael Trimarchi <trimarchi@gandalf.sssup.it>
* Paolo Gai <pj@gandalf.sssup.it>
* Massimiliano Giorgi <massy@gandalf.sssup.it>
* Luca Abeni <luca@gandalf.sssup.it>
* (see the web pages for full authors list)
*
* ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
92,7 → 93,5
 
int GRUBSTAR_get_local_scheduler_id_from_pid(LEVEL l, PID p);
 
int GRUBSTAR_get_last_reclaiming(LEVEL l);
 
#endif
 
/shark/trunk/ports/first/first-server.c
142,8 → 142,10
NRT_TASK_MODEL nrt;
int local_scheduler_level,scheduler_id;
 
/* Move thread from the posix module to local scheduler */
 
#ifdef FSF_DEBUG
kern_printf("(FSF:Insert thread = %d to Server = %d)",*thread,server);
kern_printf("(FSF:Insert thread = %d to Server = %d)",thread,server);
#endif
 
/* Check if server and thread exsist */
166,12 → 168,8
 
*thread = task_create("POSIXSTAR", thread_code, &nrt, NULL);
}
if (*thread == NIL) {
#ifdef FSF_DEBUG
kern_printf("(FSF:Error creating thread)");
#endif
if (*thread == NIL)
return FSF_ERR_CREATE_THREAD;
}
 
POSIXSTAR_setbudget(local_scheduler_level, *thread, (int)(server));