20,11 → 20,11 |
|
/* |
------------ |
CVS : $Id: cbsstar.c,v 1.5 2003-06-18 08:13:01 trimarchi Exp $ |
CVS : $Id: cbsstar.c,v 1.4 2003-01-07 17:10:16 pj Exp $ |
|
File: $File$ |
Revision: $Revision: 1.5 $ |
Last update: $Date: 2003-06-18 08:13:01 $ |
Revision: $Revision: 1.4 $ |
Last update: $Date: 2003-01-07 17:10:16 $ |
------------ |
|
Read CBSSTAR.h for general details. |
75,8 → 75,10 |
* DEBUG stuffs begin |
*/ |
|
#ifdef CBSSTAR_DEBUG_OLD |
//#define CBSSTAR_DEBUG |
|
#ifdef CBSSTAR_DEBUG |
|
static __inline__ void fake_printf(char *fmt, ...) {} |
|
//#define cbsstar_printf kern_printf |
88,7 → 90,7 |
#define cbsstar_printf3 fake_printf |
|
#if 0 |
void cbsstar_printq(IQUEUE *q) |
void cbsstar_printq(QQUEUE *q) |
{ |
PID p; |
kern_printf("["); |
143,8 → 145,6 |
|
bandwidth_t U; /*+ the used bandwidth by the server +*/ |
|
int cap_lev; |
|
LEVEL scheduling_level; |
|
} CBSSTAR_level_des; |
189,7 → 189,6 |
/* and the capacity */ |
b->avail = b->Q; |
|
|
#ifdef CBSSTAR_DEBUG |
cbsstar_printf3("±%d±",lev->tb[p]); |
cbsstar_printblob(lev->tb[p]); |
202,7 → 201,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); |
277,6 → 276,7 |
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,7 → 292,6 |
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 |
382,14 → 381,6 |
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]); |
413,7 → 404,7 |
if (!nostop) { |
TIMESPEC_ASSIGN(&ty, &schedule_time); |
ADDUSEC2TIMESPEC(lev->b[lev->tb[p]].avail,&ty); |
lev->cap_lev = kern_event_post(&ty, capacity_handler, NULL); |
cap_timer = kern_event_post(&ty, capacity_timer, NULL); |
} |
} |
|
428,10 → 419,6 |
|
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; |
439,10 → 426,9 |
level_table[ lev->scheduling_level ]-> |
private_epilogue(lev->scheduling_level,p); |
#ifdef CBSSTAR_DEBUG |
cbsstar_printf(" *av=%d", b->avail); |
cbsstar_printf2(" *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; |
458,12 → 444,13 |
ADDUSEC2TIMESPEC(b->T, &b->dline); |
b->avail += b->Q; |
#ifdef CBSSTAR_DEBUG |
cbsstar_printf("±%d±",b->avail); |
cbsstar_printf3("±%d±",lev->tb[p]); |
cbsstar_printblob(lev->tb[p]); |
#endif |
} |
|
#ifdef CBSSTAR_DEBUG |
kern_printf(" %ld.%ld av=%d",b->dline.tv_sec,b->dline.tv_nsec/1000, b->avail); |
cbsstar_printf2(" %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 */ |
475,7 → 462,6 |
#ifdef CBSSTAR_DEBUG |
cbsstar_printf(")"); |
#endif |
|
} |
|
|
524,11 → 510,12 |
|
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; |