Subversion Repositories shark

Compare Revisions

Regard whitespace Rev 1175 → Rev 1176

/demos/trunk/first/cbsstar.c
20,11 → 20,11
 
/*
------------
CVS : $Id: cbsstar.c,v 1.4 2003-01-07 17:10:16 pj Exp $
CVS : $Id: cbsstar.c,v 1.5 2003-06-18 08:13:01 trimarchi Exp $
 
File: $File$
Revision: $Revision: 1.4 $
Last update: $Date: 2003-01-07 17:10:16 $
Revision: $Revision: 1.5 $
Last update: $Date: 2003-06-18 08:13:01 $
------------
 
Read CBSSTAR.h for general details.
75,10 → 75,8
* DEBUG stuffs begin
*/
 
//#define CBSSTAR_DEBUG
#ifdef CBSSTAR_DEBUG_OLD
 
#ifdef CBSSTAR_DEBUG
 
static __inline__ void fake_printf(char *fmt, ...) {}
 
//#define cbsstar_printf kern_printf
90,7 → 88,7
#define cbsstar_printf3 fake_printf
 
#if 0
void cbsstar_printq(QQUEUE *q)
void cbsstar_printq(IQUEUE *q)
{
PID p;
kern_printf("[");
145,6 → 143,8
 
bandwidth_t U; /*+ the used bandwidth by the server +*/
 
int cap_lev;
 
LEVEL scheduling_level;
 
} CBSSTAR_level_des;
189,6 → 189,7
/* and the capacity */
b->avail = b->Q;
 
 
#ifdef CBSSTAR_DEBUG
cbsstar_printf3("±%d±",lev->tb[p]);
cbsstar_printblob(lev->tb[p]);
201,7 → 202,7
#ifdef CBSSTAR_DEBUG
cbsstar_printf("(C:iact p%d %ld.%ld av=%d)",p,b->dline.tv_sec,b->dline.tv_nsec/1000, b->avail);
#endif
 
//kern_printf("Pid %d, Act %d, Dd %d", p,acttime->tv_nsec/1000,(b->dline).tv_nsec/1000);
/* and, finally, we reinsert the task in the master level */
job_task_default_model(job, b->dline);
job_task_def_noexc(job);
276,7 → 277,6
cbsstar_printf3("±%d±",lev->tb[p]);
cbsstar_printblob(lev->tb[p]);
#endif
 
/* and, finally, we reinsert the task in the master level */
job_task_default_model(job, b->dline);
job_task_def_noexc(job);
292,6 → 292,7
return 0;
}
 
 
static void CBSSTAR_private_insert(LEVEL l, PID p, TASK_MODEL *m)
{
/* A task has been activated for some reason. Basically, the task is
381,6 → 382,14
iq_extract(p, &lev->b[lev->tb[p]].tasks);
}
 
static void capacity_handler()
{
//kern_printf("!");
event_need_reschedule();
}
 
 
static void CBSSTAR_private_dispatch(LEVEL l, PID p, int nostop)
{
CBSSTAR_level_des *lev = (CBSSTAR_level_des *)(level_table[l]);
404,7 → 413,7
if (!nostop) {
TIMESPEC_ASSIGN(&ty, &schedule_time);
ADDUSEC2TIMESPEC(lev->b[lev->tb[p]].avail,&ty);
cap_timer = kern_event_post(&ty, capacity_timer, NULL);
lev->cap_lev = kern_event_post(&ty, capacity_handler, NULL);
}
}
 
419,6 → 428,10
 
CBSSTAR_account_capacity(lev,p);
 
if (lev->cap_lev!=NIL)
kern_event_delete(lev->cap_lev);
lev->cap_lev=NIL;
 
/* we have to check if the capacity is still available */
if (b->avail > 0) {
/* there is capacity available, maybe it is simply a preemption;
426,9 → 439,10
level_table[ lev->scheduling_level ]->
private_epilogue(lev->scheduling_level,p);
#ifdef CBSSTAR_DEBUG
cbsstar_printf2(" *av=%d", b->avail);
cbsstar_printf(" *av=%d", b->avail);
#endif
} else {
 
/* The capacity is exausted; the deadline have to be postponed and
the task have to be reinserted in the master module */
JOB_TASK_MODEL job;
444,13 → 458,12
ADDUSEC2TIMESPEC(b->T, &b->dline);
b->avail += b->Q;
#ifdef CBSSTAR_DEBUG
cbsstar_printf3("±%d±",lev->tb[p]);
cbsstar_printblob(lev->tb[p]);
cbsstar_printf("±%d±",b->avail);
#endif
}
 
#ifdef CBSSTAR_DEBUG
cbsstar_printf2(" %ld.%ld av=%d",b->dline.tv_sec,b->dline.tv_nsec/1000, b->avail);
kern_printf(" %ld.%ld av=%d",b->dline.tv_sec,b->dline.tv_nsec/1000, b->avail);
#endif
/* and, finally, we reinsert the task in the master level */
462,6 → 475,7
#ifdef CBSSTAR_DEBUG
cbsstar_printf(")");
#endif
}
 
 
510,12 → 524,11
 
lev->n = n;
lev->freebudgets = 0;
 
for (i=0; i<MAX_PROC; i++)
lev->tb[i] = NIL;
 
lev->U = 0;
 
lev->cap_lev=NIL;
lev->scheduling_level = master;
 
return l;