Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 765 → Rev 766

/shark/trunk/kernel/modules/cbs.c
20,11 → 20,11
 
/**
------------
CVS : $Id: cbs.c,v 1.11 2004-05-17 15:03:51 anton Exp $
CVS : $Id: cbs.c,v 1.12 2004-06-23 15:13:02 anton Exp $
 
File: $File$
Revision: $Revision: 1.11 $
Last update: $Date: 2004-05-17 15:03:51 $
Revision: $Revision: 1.12 $
Last update: $Date: 2004-06-23 15:13:02 $
------------
 
This file contains the aperiodic server CBS (Total Bandwidth Server)
130,28 → 130,24
activating a new task or an old task... */
 
/* check 1: if the deadline is before than the actual scheduling time */
 
/* check 2: if ( avail_time >= (cbs_dline - acttime)* (wcet/period) )
(rule 7 in the CBS article!) */
 
/* CHANGES by Anton Cervin 2004-06-23:
a) only check: if ( acttime + (avail_time * period) / wcet > cbs_dline )
b) without (long long) in the computation we can have an overflow!! */
TIME t;
struct timespec t2,t3;
struct timespec t2;
 
t = (lev->period[p] * proc_table[p].avail_time) / proc_table[p].wcet;
t3.tv_sec = t / 1000000;
t3.tv_nsec = (t % 1000000) * 1000;
t = ((long long)lev->period[p] * (long long)proc_table[p].avail_time)
/ (long long)proc_table[p].wcet;
t2 = *acttime;
ADDUSEC2TIMESPEC(t, &t2);
 
SUBTIMESPEC(&lev->cbs_dline[p], acttime, &t2);
if (TIMESPEC_A_GT_B(&t2, &lev->cbs_dline[p])) {
 
if (/* 1 */ TIMESPEC_A_LT_B(&lev->cbs_dline[p], acttime) ||
/* 2 */ TIMESPEC_A_GT_B(&t3, &t2) ) {
/* if (TIMESPEC_A_LT_B(&lev->cbs_dline[p], acttime) )
kern_printf("$");
else
kern_printf("(Ûdline%d.%d act%d.%d wcet%d per%d avail%dÛ)",
lev->cbs_dline[p].tv_sec,lev->cbs_dline[p].tv_nsec/1000,
acttime->tv_sec, acttime->tv_nsec/1000,
proc_table[p].wcet, lev->period[p], proc_table[p].avail_time);
*/ /* we modify the deadline ... */
/* we modify the deadline ... */
TIMESPEC_ASSIGN(&lev->cbs_dline[p], acttime);
ADDUSEC2TIMESPEC(lev->period[p], &lev->cbs_dline[p]);