Subversion Repositories shark

Rev

Rev 1123 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1089 pj 1
/*
2
 * Project: S.Ha.R.K.
3
 *
4
 * Coordinators:
5
 *   Giorgio Buttazzo    <giorgio@sssup.it>
6
 *   Paolo Gai           <pj@gandalf.sssup.it>
7
 *
8
 * Authors     :
9
 *   Paolo Gai           <pj@gandalf.sssup.it>
10
 *   (see the web pages for full authors list)
11
 *
12
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
13
 *
14
 * http://www.sssup.it
15
 * http://retis.sssup.it
16
 * http://shark.sssup.it
17
 */
18
 
19
/**
20
 ------------
1176 trimarchi 21
 CVS :        $Id: edfstar.c,v 1.5 2003-06-18 08:13:02 trimarchi Exp $
1089 pj 22
 
23
 File:        $File$
1176 trimarchi 24
 Revision:    $Revision: 1.5 $
25
 Last update: $Date: 2003-06-18 08:13:02 $
1089 pj 26
 ------------
27
**/
28
 
29
/*
30
 * Copyright (C) 2001 Paolo Gai
31
 *
32
 * This program is free software; you can redistribute it and/or modify
33
 * it under the terms of the GNU General Public License as published by
34
 * the Free Software Foundation; either version 2 of the License, or
35
 * (at your option) any later version.
36
 *
37
 * This program is distributed in the hope that it will be useful,
38
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
39
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
40
 * GNU General Public License for more details.
41
 *
42
 * You should have received a copy of the GNU General Public License
43
 * along with this program; if not, write to the Free Software
44
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
45
 *
46
 */
47
 
48
#include "edfstar.h"
49
#include <ll/stdio.h>
50
#include <ll/string.h>
51
#include <kernel/model.h>
52
#include <kernel/descr.h>
53
#include <kernel/var.h>
54
#include <kernel/func.h>
55
#include <kernel/trace.h>
56
 
57
/* for iqueues */
1116 pj 58
/* #include "iqueue.h" Now iqueues are the only queue type available
59
   into the kernel */
60
#include <kernel/iqueue.h>
1089 pj 61
 
62
/* for BUDGET_TASK_MODEL */
63
#include "cbsstar.h"
64
 
65
/*
66
 * DEBUG stuffs begin
67
 */
68
 
69
//#define EDFSTAR_DEBUG
70
 
71
#ifdef EDFSTAR_DEBUF
72
 
73
static __inline__ fake_printf(char *fmt, ...) {}
74
 
75
#define edfstar_printf fake_printf
76
#define edfstar_printf2 fake_printf
77
#define edfstar_printf3 fake_printf
78
 
79
//#define edfstar_printf kern_printf
80
//#define edfstar_printf2 kern_printf
81
//#define edfstar_printf3 kern_printf
82
#endif
83
 
84
/*
85
 * DEBUG stuffs end
86
 */
87
 
88
/* Status used in the level */
89
#define EDFSTAR_READY         MODULE_STATUS_BASE    /* - Ready status        */
90
#define EDFSTAR_IDLE          MODULE_STATUS_BASE+4  /* to wait the deadline  */
91
 
92
/* flags */
93
#define EDFSTAR_FLAG_NORAISEEXC  2
94
 
95
/* the level redefinition for the Earliest Deadline First level */
96
typedef struct {
97
  level_des l;     /* the standard level descriptor          */
98
 
99
  TIME period[MAX_PROC]; /* The task periods; the deadlines are
100
                       stored in the priority field           */
101
  int deadline_timer[MAX_PROC];
102
                   /* The task deadline timers               */
103
 
104
  struct timespec deadline_timespec[MAX_PROC];
105
 
106
  int dline_miss[MAX_PROC]; /* Deadline miss counter */
107
  int wcet_miss[MAX_PROC];  /* Wcet miss counter */
108
 
109
  int nact[MAX_PROC];       /* Wcet miss counter */
110
 
111
  int flag[MAX_PROC];
112
                   /* used to manage the JOB_TASK_MODEL and the
113
                       periodicity                            */
114
 
115
  IQUEUE ready;     /* the ready queue                        */
116
 
117
  PID activated;   /* the task that has been inserted into the
118
                       master module */
119
 
120
  int budget;
121
 
122
  int scheduling_level;
123
} EDFSTAR_level_des;
124
 
125
static void EDFSTAR_check_preemption(EDFSTAR_level_des *lev)
126
{
127
  PID first;
128
 
129
#ifdef EDFSTAR_DEBUG
130
  edfstar_printf("(E:chk)");
131
#endif
132
 
1116 pj 133
  if ((first = iq_query_first(&lev->ready)) != lev->activated) {
1089 pj 134
    if (lev->activated != NIL)
135
      level_table[ lev->scheduling_level ]->
1123 pj 136
        private_extract(lev->scheduling_level, lev->activated);
1089 pj 137
 
138
    lev->activated = first;
139
 
140
    if (first != NIL) {
141
      BUDGET_TASK_MODEL b;
142
      budget_task_default_model(b, lev->budget);
143
 
144
      level_table[ lev->scheduling_level ]->
1123 pj 145
        private_insert(lev->scheduling_level, first, (TASK_MODEL *)&b);
1089 pj 146
    }
147
  }
148
}
149
 
150
static void EDFSTAR_timer_deadline(void *par);
151
 
1123 pj 152
static void EDFSTAR_internal_activate(EDFSTAR_level_des *lev, PID p,
153
                                      struct timespec *t)
1089 pj 154
{
155
#ifdef EDFSTAR_DEBUG
156
  edfstar_printf("(E:iact)");
157
#endif
158
 
1123 pj 159
  ADDUSEC2TIMESPEC(lev->period[p], t);
1089 pj 160
 
1123 pj 161
  *iq_query_timespec(p, &lev->ready) = *t;
162
  lev->deadline_timespec[p] = *t;
1089 pj 163
 
164
  /* Insert task in the correct position */
165
  proc_table[p].status = EDFSTAR_READY;
166
  iq_timespec_insert(p,&lev->ready);
167
 
168
  /* needed because when there is a wcet miss I disable CONTROL_CAP */
169
  proc_table[p].control |= CONTROL_CAP;
170
 
171
  /* check for preemption */
172
  EDFSTAR_check_preemption(lev);
173
}
174
 
175
static void EDFSTAR_timer_deadline(void *par)
176
{
177
  PID p = (PID) par;
178
  EDFSTAR_level_des *lev;
179
 
180
#ifdef EDFSTAR_DEBUG
181
//  edfstar_printf("(E:tdl ");
182
#endif
183
 
184
  lev = (EDFSTAR_level_des *)level_table[proc_table[p].task_level];
185
 
186
  switch (proc_table[p].status) {
187
    case EDFSTAR_IDLE:
188
#ifdef EDFSTAR_DEBUG
189
//      edfstar_printf2("I%d",p);
190
#endif
191
      /* set the request time */
1123 pj 192
      EDFSTAR_internal_activate(lev,p,iq_query_timespec(p, &lev->ready));
1089 pj 193
 
194
      event_need_reschedule();
195
      break;
196
 
197
    default:
198
#ifdef EDFSTAR_DEBUG
199
//      edfstar_printf2("D%d",p);
200
#endif
201
      /* else, a deadline miss occurred!!! */
202
      lev->dline_miss[p]++;
203
 
204
      /* the task is into another state */
205
      lev->nact[p]++;
206
 
207
      /* Set the deadline timer */
208
      ADDUSEC2TIMESPEC(lev->period[p], &lev->deadline_timespec[p]);
209
  }
210
 
211
  /* Set the deadline timer */
212
  lev->deadline_timer[p] = kern_event_post(&lev->deadline_timespec[p],
213
                                           EDFSTAR_timer_deadline,
214
                                           (void *)p);
215
 
216
#ifdef EDFSTAR_DEBUG
217
//  edfstar_printf(")");
218
#endif
219
}
220
 
221
static void EDFSTAR_timer_guest_deadline(void *par)
222
{
223
  PID p = (PID) par;
224
 
225
#ifdef EDFSTAR_DEBUG
226
  edfstar_printf("(E:gdl)");
227
#endif
228
 
229
  kern_raise(XDEADLINE_MISS,p);
230
}
231
 
1123 pj 232
static int EDFSTAR_public_create(LEVEL l, PID p, TASK_MODEL *m)
1089 pj 233
{
234
  EDFSTAR_level_des *lev = (EDFSTAR_level_des *)(level_table[l]);
235
 
1123 pj 236
  /* if the EDFSTAR_task_create is called, then the pclass must be a
237
     valid pclass. */
238
  HARD_TASK_MODEL *h;
1089 pj 239
 
1123 pj 240
  if (m->pclass != HARD_PCLASS) return -1;
241
  if (m->level != 0 && m->level != l) return -1;
242
  h = (HARD_TASK_MODEL *)m;
243
  if (!h->wcet || !h->mit || h->periodicity != PERIODIC) return -1;
244
  /* now we know that m is a valid model */
1089 pj 245
 
246
 
247
#ifdef EDFSTAR_DEBUG
248
  edfstar_printf("(E:tcr)");
249
#endif
250
 
251
  lev->period[p] = h->mit;
252
 
253
  lev->flag[p] = 0;
254
  lev->deadline_timer[p] = -1;
255
  lev->dline_miss[p]     = 0;
256
  lev->wcet_miss[p]      = 0;
257
  lev->nact[p]           = 0;
258
 
259
  /* Enable wcet check */
260
  proc_table[p].avail_time = h->wcet;
261
  proc_table[p].wcet       = h->wcet;
262
  proc_table[p].control |= CONTROL_CAP;
263
 
264
  return 0; /* OK, also if the task cannot be guaranteed... */
265
}
266
 
1176 trimarchi 267
static int EDFSTAR_public_eligible(LEVEL l, PID p)
1089 pj 268
{
1123 pj 269
  EDFSTAR_level_des *lev = (EDFSTAR_level_des *)(level_table[l]);
1089 pj 270
 
271
#ifdef EDFSTAR_DEBUG
272
  edfstar_printf2("(E:eli)");
273
#endif
274
 
1123 pj 275
  return level_table[ lev->scheduling_level ]->
276
    private_eligible(lev->scheduling_level,p);
1089 pj 277
}
278
 
1123 pj 279
static void EDFSTAR_public_dispatch(LEVEL l, PID p, int nostop)
1089 pj 280
{
281
  EDFSTAR_level_des *lev = (EDFSTAR_level_des *)(level_table[l]);
282
 
283
#ifdef EDFSTAR_DEBUG
284
  edfstar_printf("(E:dis)");
285
 
286
  edfstar_printf3("(%d %d)",
287
                  iq_query_timespec(p, &lev->ready)->tv_nsec/1000000,
288
                  schedule_time.tv_nsec/1000000);
289
#endif
290
 
291
  level_table[ lev->scheduling_level ]->
1123 pj 292
    private_dispatch(lev->scheduling_level,p,nostop);
1089 pj 293
}
294
 
1123 pj 295
static void EDFSTAR_public_epilogue(LEVEL l, PID p)
1089 pj 296
{
297
  EDFSTAR_level_des *lev = (EDFSTAR_level_des *)(level_table[l]);
298
 
299
#ifdef EDFSTAR_DEBUG
300
  edfstar_printf("(E:epi ");
301
#endif
302
 
303
  /* check if the wcet is finished... */
304
  if (proc_table[p].avail_time <= 0 && proc_table[p].control&CONTROL_CAP) {
305
    /* wcet finished: disable wcet event and count wcet miss */
306
#ifdef EDFSTAR_DEBUG
307
    edfstar_printf2("W%d",p);
308
#endif
309
    proc_table[p].control &= ~CONTROL_CAP;
310
    lev->wcet_miss[p]++;
311
  }
312
#ifdef EDFSTAR_DEBUG
313
  edfstar_printf(")");
314
#endif
315
 
316
  level_table[ lev->scheduling_level ]->
1123 pj 317
    private_epilogue(lev->scheduling_level,p);
1089 pj 318
 
319
  proc_table[p].status = EDFSTAR_READY;
320
}
321
 
1123 pj 322
static void EDFSTAR_public_activate(LEVEL l, PID p)
1089 pj 323
{
324
  EDFSTAR_level_des *lev = (EDFSTAR_level_des *)(level_table[l]);
1123 pj 325
  struct timespec t;
1089 pj 326
 
327
#ifdef EDFSTAR_DEBUG
328
  edfstar_printf("(E:act)");
329
#endif
330
 
331
  /* Test if we are trying to activate a non sleeping task    */
332
  /* save activation (only if needed... */
333
  if (proc_table[p].status != SLEEP) {
334
    /* a periodic task cannot be activated when it is already active */
335
    kern_raise(XACTIVATION,p);
336
    return;
337
  }
338
 
1123 pj 339
  kern_gettime(&t);
1089 pj 340
 
1123 pj 341
  EDFSTAR_internal_activate(lev,p, &t);
1089 pj 342
 
343
  /* Set the deadline timer */
344
  lev->deadline_timer[p] = kern_event_post(&lev->deadline_timespec[p],
345
                                           EDFSTAR_timer_deadline,
346
                                           (void *)p);
347
 
348
}
349
 
1123 pj 350
static void EDFSTAR_public_unblock(LEVEL l, PID p)
1089 pj 351
{
352
  EDFSTAR_level_des *lev = (EDFSTAR_level_des *)(level_table[l]);
353
 
354
#ifdef EDFSTAR_DEBUG
355
  edfstar_printf("(E:ins)");
356
#endif
357
 
358
  /* Insert task in the correct position */
359
  proc_table[p].status = EDFSTAR_READY;
360
  iq_timespec_insert(p,&lev->ready);
361
 
362
  /* and check for preemption! */
363
  EDFSTAR_check_preemption(lev);
364
}
365
 
1123 pj 366
static void EDFSTAR_public_block(LEVEL l, PID p)
1089 pj 367
{
368
  EDFSTAR_level_des *lev = (EDFSTAR_level_des *)(level_table[l]);
369
 
370
#ifdef EDFSTAR_DEBUG
371
  edfstar_printf("(E:ext)");
372
#endif
373
 
374
  /* the task is blocked on a synchronization primitive. we have to
375
     remove it from the master module -and- from the local queue! */
376
  iq_extract(p,&lev->ready);
377
 
378
  /* and finally, a preemption check! (it will also call guest_end) */
379
  EDFSTAR_check_preemption(lev);
380
}
381
 
1123 pj 382
static int EDFSTAR_public_message(LEVEL l, PID p, void *m)
1089 pj 383
{
384
  EDFSTAR_level_des *lev = (EDFSTAR_level_des *)(level_table[l]);
385
  struct timespec temp;
386
 
387
#ifdef EDFSTAR_DEBUG
388
  edfstar_printf("(E:ecy ");
389
#endif
390
 
391
  /* we call guest_end directly here because the same task may
392
     be reinserted in the queue before calling the preemption check! */
393
  level_table[ lev->scheduling_level ]->
1123 pj 394
    private_extract(lev->scheduling_level,p);
1089 pj 395
  lev->activated = NIL;
396
 
397
  iq_extract(p,&lev->ready);
398
 
399
  /* we reset the capacity counters... */
400
  proc_table[p].avail_time = proc_table[p].wcet;
401
 
402
  if (lev->nact[p] > 0) {
403
#ifdef EDFSTAR_DEBUG
404
    edfstar_printf2("E%d",p);
405
#endif
406
 
407
    /* Pending activation: reactivate the thread!!! */
408
    lev->nact[p]--;
409
 
410
    /* see also EDFSTAR_timer_deadline */
1123 pj 411
    kern_gettime(&temp);
1089 pj 412
 
1123 pj 413
    EDFSTAR_internal_activate(lev,p, &temp);
1089 pj 414
 
415
    /* check if the deadline has already expired */
416
    temp = *iq_query_timespec(p, &lev->ready);
417
    if (TIMESPEC_A_LT_B(&temp, &schedule_time)) {
418
      /* count the deadline miss */
419
      lev->dline_miss[p]++;
1123 pj 420
      kern_event_delete(lev->deadline_timer[p]);
1089 pj 421
    }
422
 
423
  }
424
  else {
425
#ifdef EDFSTAR_DEBUG
426
    edfstar_printf("e%d",p);
427
#endif
428
 
429
    /* the task has terminated his job before it consume the wcet. All OK! */
430
    proc_table[p].status = EDFSTAR_IDLE;
431
 
432
    /* and finally, a preemption check! */
433
    EDFSTAR_check_preemption(lev);
434
 
435
    /* when the deadline timer fire, it recognize the situation and set
1123 pj 436
       correctly all the stuffs (like reactivation, etc... ) */
1089 pj 437
  }
438
#ifdef EDFSTAR_DEBUG
439
  edfstar_printf(")");
440
#endif
1123 pj 441
 
442
  jet_update_endcycle(); /* Update the Jet data... */
443
  trc_logevent(TRC_ENDCYCLE,&exec_shadow); /* tracer stuff */
444
 
445
  return 0;
1089 pj 446
}
447
 
1123 pj 448
static void EDFSTAR_public_end(LEVEL l, PID p)
1089 pj 449
{
450
  EDFSTAR_level_des *lev = (EDFSTAR_level_des *)(level_table[l]);
451
 
452
#ifdef EDFSTAR_DEBUG
453
  edfstar_printf("(E:end)");
454
#endif
455
 
456
  iq_extract(p,&lev->ready);
457
 
458
  /* we finally put the task in the ready queue */
459
  proc_table[p].status = FREE;
460
 
1116 pj 461
  iq_insertfirst(p,&freedesc);
1089 pj 462
 
463
  if (lev->deadline_timer[p] != -1) {
1123 pj 464
    kern_event_delete(lev->deadline_timer[p]);
1089 pj 465
  }
466
 
467
  /* and finally, a preemption check! (it will also call guest_end) */
468
  EDFSTAR_check_preemption(lev);
469
}
470
 
471
/* Guest Functions
472
   These functions manages a JOB_TASK_MODEL, that is used to put
473
   a guest task in the EDFSTAR ready queue. */
474
 
1123 pj 475
static void EDFSTAR_private_insert(LEVEL l, PID p, TASK_MODEL *m)
1089 pj 476
{
477
  EDFSTAR_level_des *lev = (EDFSTAR_level_des *)(level_table[l]);
1123 pj 478
  JOB_TASK_MODEL *job;
1089 pj 479
 
1123 pj 480
  if (m->pclass != JOB_PCLASS || (m->level != 0 && m->level != l) ) {
481
    kern_raise(XINVALID_TASK, p);
482
    return;
483
  }
484
 
485
  job = (JOB_TASK_MODEL *)m;
486
 
1089 pj 487
  /* if the EDFSTAR_guest_create is called, then the pclass must be a
488
     valid pclass. */
489
 
490
  *iq_query_timespec(p, &lev->ready) = job->deadline;
491
 
492
  lev->deadline_timer[p] = -1;
493
  lev->dline_miss[p]     = 0;
494
  lev->wcet_miss[p]      = 0;
495
  lev->nact[p]           = 0;
496
 
497
  if (job->noraiseexc)
498
    lev->flag[p] = EDFSTAR_FLAG_NORAISEEXC;
1123 pj 499
  else {
1089 pj 500
    lev->flag[p] = 0;
1123 pj 501
    lev->deadline_timer[p] = kern_event_post(iq_query_timespec(p, &lev->ready),
502
                                             EDFSTAR_timer_guest_deadline,
503
                                             (void *)p);
504
  }
1089 pj 505
 
506
  lev->period[p] = job->period;
507
 
508
  /* Insert task in the correct position */
509
  iq_timespec_insert(p,&lev->ready);
510
  proc_table[p].status = EDFSTAR_READY;
511
 
512
  /* check for preemption */
513
  EDFSTAR_check_preemption(lev);
514
 
1123 pj 515
  /* there is no bandwidth guarantee at this level, it is performed
516
     by the level that inserts guest tasks... */
1089 pj 517
}
518
 
1123 pj 519
static void EDFSTAR_private_dispatch(LEVEL l, PID p, int nostop)
1089 pj 520
{
521
  EDFSTAR_level_des *lev = (EDFSTAR_level_des *)(level_table[l]);
522
 
1123 pj 523
  level_table[ lev->scheduling_level ]->
524
    private_dispatch(lev->scheduling_level,p,nostop);
1089 pj 525
}
526
 
1123 pj 527
static void EDFSTAR_private_epilogue(LEVEL l, PID p)
1089 pj 528
{
529
  EDFSTAR_level_des *lev = (EDFSTAR_level_des *)(level_table[l]);
530
 
1123 pj 531
  /* the task has been preempted. it returns into the ready queue... */
532
  level_table[ lev->scheduling_level ]->
533
    private_epilogue(lev->scheduling_level,p);
1089 pj 534
 
1123 pj 535
  proc_table[p].status = EDFSTAR_READY;
1089 pj 536
}
537
 
1123 pj 538
static void EDFSTAR_private_extract(LEVEL l, PID p)
1089 pj 539
{
540
  EDFSTAR_level_des *lev = (EDFSTAR_level_des *)(level_table[l]);
541
 
542
#ifdef EDFSTAR_DEBUG
543
  //kern_printf("EDFSTAR_guest_end: dline timer %d\n",lev->deadline_timer[p]);
544
#endif
545
 
546
  iq_extract(p, &lev->ready);
547
 
548
  /* we remove the deadline timer, because the slice is finished */
549
  if (lev->deadline_timer[p] != NIL) {
550
#ifdef EDFSTAR_DEBUG
551
//    kern_printf("EDFSTAR_guest_end: dline timer %d\n",lev->deadline_timer[p]);
552
#endif
1123 pj 553
    kern_event_delete(lev->deadline_timer[p]);
1089 pj 554
    lev->deadline_timer[p] = NIL;
555
  }
556
 
557
  /* and finally, a preemption check! (it will also call guest_end() */
558
  EDFSTAR_check_preemption(lev);
559
}
560
 
561
/* Registration functions */
562
 
563
/* Registration function:
564
    int flags                 the init flags ... see EDFSTAR.h */
565
LEVEL EDFSTAR_register_level(int budget, int master)
566
{
567
  LEVEL l;            /* the level that we register */
568
  EDFSTAR_level_des *lev;  /* for readableness only */
569
  PID i;              /* a counter */
570
 
571
#ifdef EDFSTAR_DEBUG
572
  printk("EDFSTAR_register_level\n");
573
#endif
574
 
575
  /* request an entry in the level_table */
1123 pj 576
  l = level_alloc_descriptor(sizeof(EDFSTAR_level_des));
1089 pj 577
 
1123 pj 578
  lev = (EDFSTAR_level_des *)level_table[l];
1089 pj 579
 
580
  printk("    lev=%d\n",(int)lev);
581
 
582
  /* fill the standard descriptor */
1123 pj 583
  lev->l.private_insert   = EDFSTAR_private_insert;
584
  lev->l.private_extract  = EDFSTAR_private_extract;
585
  lev->l.private_dispatch = EDFSTAR_private_dispatch;
586
  lev->l.private_epilogue = EDFSTAR_private_epilogue;
1089 pj 587
 
1123 pj 588
  lev->l.public_guarantee = NULL;
1176 trimarchi 589
  lev->l.public_eligible  = EDFSTAR_public_eligible;
1123 pj 590
  lev->l.public_create    = EDFSTAR_public_create;
591
  lev->l.public_end       = EDFSTAR_public_end;
592
  lev->l.public_dispatch  = EDFSTAR_public_dispatch;
593
  lev->l.public_epilogue  = EDFSTAR_public_epilogue;
594
  lev->l.public_activate  = EDFSTAR_public_activate;
595
  lev->l.public_unblock   = EDFSTAR_public_unblock;
596
  lev->l.public_block     = EDFSTAR_public_block;
597
  lev->l.public_message   = EDFSTAR_public_message;
1089 pj 598
 
599
  /* fill the EDFSTAR descriptor part */
600
  for(i=0; i<MAX_PROC; i++) {
601
    lev->period[i]         = 0;
602
    lev->deadline_timer[i] = -1;
603
    lev->flag[i]           = 0;
604
    lev->dline_miss[i]     = 0;
605
    lev->wcet_miss[i]      = 0;
606
    lev->nact[i]           = 0;
607
  }
608
 
609
  iq_init(&lev->ready, NULL, IQUEUE_NO_PRIORITY);
610
  lev->activated = NIL;
611
 
612
  lev->budget = budget;
613
  lev->scheduling_level = master;
614
 
615
  return l;
616
}
617
 
618
int EDFSTAR_get_dline_miss(PID p)
619
{
620
  LEVEL l = proc_table[p].task_level;
621
  EDFSTAR_level_des *lev = (EDFSTAR_level_des *)(level_table[l]);
1123 pj 622
 
623
  return lev->dline_miss[p];
1089 pj 624
}
625
 
626
int EDFSTAR_get_wcet_miss(PID p)
627
{
628
  LEVEL l = proc_table[p].task_level;
629
  EDFSTAR_level_des *lev = (EDFSTAR_level_des *)(level_table[l]);
1123 pj 630
 
631
  return lev->wcet_miss[p];
1089 pj 632
}
633
 
634
int EDFSTAR_get_nact(PID p)
635
{
636
  LEVEL l = proc_table[p].task_level;
637
  EDFSTAR_level_des *lev = (EDFSTAR_level_des *)(level_table[l]);
1123 pj 638
 
639
  return lev->nact[p];
1089 pj 640
}
641
 
642
int EDFSTAR_reset_dline_miss(PID p)
643
{
644
  LEVEL l = proc_table[p].task_level;
645
  EDFSTAR_level_des *lev = (EDFSTAR_level_des *)(level_table[l]);
1123 pj 646
 
647
  lev->dline_miss[p] = 0;
648
  return 0;
1089 pj 649
}
650
 
651
int EDFSTAR_reset_wcet_miss(PID p)
652
{
653
  LEVEL l = proc_table[p].task_level;
654
  EDFSTAR_level_des *lev = (EDFSTAR_level_des *)(level_table[l]);
1123 pj 655
 
656
  lev->wcet_miss[p] = 0;
657
  return 0;
1089 pj 658
}
659