edf.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. enum {
  2. Maxsteps = 200 * 100 * 2, /* 100 periods of 200 procs */
  3. /* Edf.flags field */
  4. Admitted = 0x01,
  5. Sporadic = 0x02,
  6. Yieldonblock = 0x04,
  7. Sendnotes = 0x08,
  8. Deadline = 0x10,
  9. Yield = 0x20,
  10. Extratime = 0x40,
  11. Infinity = ~0ULL,
  12. };
  13. typedef struct Edf Edf;
  14. struct Edf {
  15. /* All times in µs */
  16. /* time intervals */
  17. long D; /* Deadline */
  18. long Delta; /* Inherited deadline */
  19. long T; /* period */
  20. long C; /* Cost */
  21. long S; /* Slice: time remaining in this period */
  22. /* times (only low-order bits of absolute time) */
  23. long r; /* (this) release time */
  24. long d; /* (this) deadline */
  25. long t; /* Start of next period, t += T at release */
  26. long s; /* Time at which this proc was last scheduled */
  27. /* for schedulability testing */
  28. long testDelta;
  29. int testtype; /* Release or Deadline */
  30. long testtime;
  31. Proc *testnext;
  32. /* other */
  33. ushort flags;
  34. Timer;
  35. /* Stats */
  36. long edfused;
  37. long extraused;
  38. long aged;
  39. ulong periods;
  40. ulong missed;
  41. };
  42. extern Lock edftestlock; /* for atomic admitting/expelling */
  43. #pragma varargck type "t" long
  44. #pragma varargck type "U" uvlong
  45. /* Interface: */
  46. Edf* edflock(Proc*);
  47. void edfunlock(void);