edf.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. enum {
  10. Maxsteps = 200 * 100 * 2, /* 100 periods of 200 procs */
  11. /* Edf.flags field */
  12. Admitted = 0x01,
  13. Sporadic = 0x02,
  14. Yieldonblock = 0x04,
  15. Sendnotes = 0x08,
  16. Deadline = 0x10,
  17. Yield = 0x20,
  18. Extratime = 0x40,
  19. Infinity = ~0ULL,
  20. };
  21. typedef struct Edf Edf;
  22. struct Edf {
  23. /* All times in µs */
  24. /* time intervals */
  25. long D; /* Deadline */
  26. long Delta; /* Inherited deadline */
  27. long T; /* period */
  28. long C; /* Cost */
  29. long S; /* Slice: time remaining in this period */
  30. /* times (only low-order bits of absolute time) */
  31. long r; /* (this) release time */
  32. long d; /* (this) deadline */
  33. long t; /* Start of next period, t += T at release */
  34. long s; /* Time at which this proc was last scheduled */
  35. /* for schedulability testing */
  36. long testDelta;
  37. int testtype; /* Release or Deadline */
  38. long testtime;
  39. Proc *testnext;
  40. /* other */
  41. uint16_t flags;
  42. Timer Timer;
  43. /* Stats */
  44. long edfused;
  45. long extraused;
  46. long aged;
  47. uint32_t periods;
  48. uint32_t missed;
  49. };
  50. extern Lock edftestlock; /* for atomic admitting/expelling */
  51. /* Interface: */
  52. Edf* edflock(Proc*);
  53. void edfunlock(void);
  54. /* sched interface, used only by edf */
  55. Sched* procsched(Proc*);