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