Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 343 → Rev 342

/shark/trunk/ports/first/modules/grubstar.c
36,7 → 36,6
*
*/
 
#include "ll/i386/64bit.h"
#include "grubstar.h"
 
//#define GRUBSTAR_DEBUG
155,7 → 154,7
GRUBSTAR_level_des *lev=(GRUBSTAR_level_des *)level_table[b->l];
#ifdef GRUBSTAR_DEBUG
kern_printf("(GS:Rec:");
//kern_printf("(GS:Rec:");
#endif
 
b->vtimer = NIL;
182,7 → 181,7
TIME t;
struct timespec t2,t3;
 
mul32div32to32(b->T,b->avail,b->Q,t);
t = (b->T * b->avail) / b->Q;
t3.tv_sec = t / 1000000;
t3.tv_nsec = (t % 1000000) * 1000;
 
236,13 → 235,8
SUBTIMESPEC(&schedule_time, &lev->cap_lasttime, &ty);
tx = TIMESPEC2USEC(&ty);
 
if ((lev->U - lev->Uf) < 0) {
kern_printf("Error (U - Uf) < 0\n");
sys_end();
}
b->last_reclaiming = (unsigned int)((long long)(tx) * (long long)(lev->U - lev->Uf)/MAX_BANDWIDTH);
 
mul32div32to32(tx,(lev->U - lev->Uf),MAX_BANDWIDTH,b->last_reclaiming);
 
b->avail -= tx - b->last_reclaiming;
 
#ifdef GRUBSTAR_DEBUG
260,7 → 254,7
if (b->flags == GRUBSTAR_NOACTIVE && b->dline_timer == NIL) {
b->dline_timer=kern_event_post(&b->dline, GRUBSTAR_deadline_timer_hardreservation, b);
} else {
mul32div32to32(b->T,b->avail,b->Q,t);
t = (b->T * b->avail) / b->Q;
t3.tv_sec = t / 1000000;
t3.tv_nsec = (t % 1000000) * 1000;
SUBTIMESPEC(&b->dline, &t3, &t2);
602,7 → 596,7
 
if (r != lev->n) {
bandwidth_t b;
mul32div32to32(MAX_BANDWIDTH,Q,T,b);
b = (MAX_BANDWIDTH / T) * Q;
/* really update lev->U, checking an overflow... */
if (Q< T && MAX_BANDWIDTH - lev->U > b) {
636,7 → 630,7
 
bandwidth_t b;
mul32div32to32(MAX_BANDWIDTH,lev->b[budget].Q,lev->b[budget].T,b);
b = (MAX_BANDWIDTH / lev->b[budget].T) * lev->b[budget].Q;
 
lev->U -= b;
lev->Uf -= b;
661,7 → 655,7
GRUBSTAR_level_des *lev = (GRUBSTAR_level_des *)(level_table[l]);
bandwidth_t b;
 
mul32div32to32(MAX_BANDWIDTH,lev->b[budget].Q,lev->b[budget].T,b);
b = (MAX_BANDWIDTH / lev->b[budget].T) * lev->b[budget].Q;
 
lev->U -= b;
lev->Uf -= b;
668,7 → 662,7
 
lev->b[budget].Q = Q;
lev->b[budget].T = T;
mul32div32to32(MAX_BANDWIDTH,Q,T,lev->b[budget].Ub);
lev->b[budget].Ub = (MAX_BANDWIDTH / T) * Q;
 
lev->U += lev->b[budget].Ub;
lev->Uf += lev->b[budget].Ub;
/shark/trunk/ports/first/modules/mpegstar.c
51,10 → 51,7
/*+ Status used in the level +*/
#define MPEGSTAR_READY MODULE_STATUS_BASE
 
#define FRAME_IDLE 0
#define FRAME_DECODING 1
#define FRAME_SKIPPED 2
 
/*+ the level redefinition for the Round Robin level +*/
typedef struct {
level_des l; /*+ the standard level descriptor +*/
 
63,7 → 60,6
 
int budget;
int current;
int status;
int scheduling_level;
 
91,7 → 87,6
if (lev->current != NIL) return -1;
 
lev->current = p;
lev->status = FRAME_IDLE;
proc_table[p].avail_time = lev->server_Q;
proc_table[p].wcet = lev->server_Q;
119,7 → 114,6
static void MPEGSTAR_public_epilogue(LEVEL l, PID p)
{
MPEGSTAR_level_des *lev = (MPEGSTAR_level_des *)(level_table[l]);
int r;
 
#ifdef MPEGSTAR_DEBUG
kern_printf("(MS:Epi:%d)",p);
127,21 → 121,7
 
level_table[ lev->scheduling_level ] ->
private_epilogue(lev->scheduling_level,p);
 
r = SERVER_get_remain_capacity(lev->scheduling_level,lev->budget);
if (r < 0) {
 
#ifdef MPEGSTAR_DEBUG
kern_printf("(MS:FRAME SKIP %d)",p);
#endif
 
lev->status = FRAME_SKIPPED;
 
level_table[ lev->scheduling_level ]->
private_extract(lev->scheduling_level, p);
 
}
 
}
 
static void MPEGSTAR_public_activate(LEVEL l, PID p)
155,8 → 135,6
kern_printf("(MP:Act:%d:%d)",p,lev->budget);
#endif
 
lev->status = FRAME_DECODING;
 
level_table[ lev->scheduling_level ]->
private_insert(lev->scheduling_level, p, (TASK_MODEL *)&b);
 
187,8 → 165,6
kern_printf("(MS:EndCycle:%d)",p);
#endif
 
lev->status = FRAME_IDLE;
 
level_table[ lev->scheduling_level ]->
private_extract(lev->scheduling_level, p);
 
220,9 → 196,7
kern_printf("(MS:End:%d)", p);
#endif
 
lev->current = NIL;
lev->status = FRAME_IDLE;
proc_table[p].status = FREE;
lev->current = NIL; proc_table[p].status = FREE;
 
}
 
252,7 → 226,6
 
lev->budget = NIL;
lev->current = NIL;
lev->status = FRAME_IDLE;
lev->server_Q = 0;
lev->server_T = 0;
 
312,19 → 285,7
return SERVER_get_remain_capacity(fsf_get_server_level(),budget);
}
 
int MPEGSTAR_get_last_reclaiming(int budget)
int MPEGSTAR_get_last_reclaiming()
{
return SERVER_get_last_reclaiming(fsf_get_server_level(),exec_shadow);
}
 
int MPEGSTAR_is_frame_skipped(int budget)
{
LEVEL l = SERVER_get_local_scheduler_level_from_budget(fsf_get_server_level(),budget);
MPEGSTAR_level_des *lev = (MPEGSTAR_level_des *)(level_table[l]);
 
if (lev->status == FRAME_SKIPPED)
return 1;
else
return 0;
 
}
/shark/trunk/ports/first/include/mpegstar.h
51,8 → 51,7
 
int MPEGSTAR_rescale(int budget, TIME Q, TIME T);
int MPEGSTAR_get_remain_capacity(int budget);
int MPEGSTAR_get_last_reclaiming(int budget);
int MPEGSTAR_is_frame_skipped(int budget);
int MPEGSTAR_get_last_reclaiming(void);
 
#endif