bitkeeper revision 1.1159.221.1 (41ebbfeezjfpGp20MD6f6Xl2r6Wd3Q)

Added new simple EDF scheduler
This commit is contained in:
sd386@font.cl.cam.ac.uk committed 2005-01-17 13:38:54 +00:00
1 parent 18bbf10459
commit 990e73cba7
12 files changed
+687 -1

No files matched your search

+64
View File
@@ -758,6 +758,50 @@ static PyObject *pyxc_rrobin_global_set(PyObject *self,
return zero;
}
static PyObject *pyxc_sedf_domain_set(PyObject *self,
PyObject *args,
PyObject *kwds)
{
XcObject *xc = (XcObject *)self;
u32 domid;
u64 period, slice;
static char *kwd_list[] = { "dom", "period", "slice", NULL };
if( !PyArg_ParseTupleAndKeywords(args, kwds, "iLL", kwd_list, &domid,
&period, &slice) )
return NULL;
if ( xc_sedf_domain_set(xc->xc_handle, domid, period, slice) != 0 )
return PyErr_SetFromErrno(xc_error);
Py_INCREF(zero);
return zero;
}
static PyObject *pyxc_sedf_domain_get(PyObject *self,
PyObject *args,
PyObject *kwds)
{
XcObject *xc = (XcObject *)self;
u32 domid;
u64 period, slice;
static char *kwd_list[] = { "dom", NULL };
if( !PyArg_ParseTupleAndKeywords(args, kwds, "i", kwd_list, &domid) )
return NULL;
if ( xc_sedf_domain_get( xc->xc_handle, domid, &period,
&slice) )
return PyErr_SetFromErrno(xc_error);
return Py_BuildValue("{s:i,s:L,s:L}",
"domain", domid,
"period", period,
"slice", slice);
}
static PyObject *pyxc_shadow_control(PyObject *self,
PyObject *args,
PyObject *kwds)
@@ -984,6 +1028,26 @@ static PyMethodDef pyxc_methods[] = {
"Get Round Robin scheduler settings\n"
"Returns [dict]:\n"
" slice [long]: Scheduler time slice.\n" },
{ "sedf_domain_set",
(PyCFunction)pyxc_sedf_domain_set,
METH_KEYWORDS, "\n"
"Set the scheduling parameters for a domain when running with Atropos.\n"
" dom [int]: domain to set\n"
" period [long]: domain's scheduling period\n"
" slice [long]: domain's slice per period\n"
"Returns: [int] 0 on success; -1 on error.\n" },
{ "sedf_domain_get",
(PyCFunction)pyxc_sedf_domain_get,
METH_KEYWORDS, "\n"
"Get the current scheduling parameters for a domain when running with\n"
"the Atropos scheduler."
" dom [int]: domain to query\n"
"Returns: [dict]\n"
" domain [int]: domain ID\n"
" period [long]: scheduler period\n"
" slice [long]: CPU reservation per period\n"},
{ "evtchn_alloc_unbound",
(PyCFunction)pyxc_evtchn_alloc_unbound,
+6
View File
@@ -272,6 +272,12 @@ class Xend:
'latency' : latency,
'xtratime': xtratime })
def xend_domain_cpu_sedf_set(self, id, period, slice):
return self.xendPost(self.domainurl(id),
{'op' : 'cpu_sedf_set',
'period' : period,
'slice' : slice })
def xend_domain_maxmem_set(self, id, memory):
return self.xendPost(self.domainurl(id),
{ 'op' : 'maxmem_set',
+18
View File
@@ -659,6 +659,24 @@ class XendDomain:
return xc.atropos_domain_get(dominfo.dom)
except Exception, ex:
raise XendError(str(ex))
def domain_cpu_sedf_set(self, id, period, slice):
"""Set Atropos scheduler parameters for a domain.
"""
dominfo = self.domain_lookup(id)
try:
return xc.sedf_domain_set(dominfo.dom, period, slice)
except Exception, ex:
raise XendError(str(ex))
def domain_cpu_sedf_get(self, id):
"""Get Atropos scheduler parameters for a domain.
"""
dominfo = self.domain_lookup(id)
try:
return xc.sedf_domain_get(dominfo.dom)
except Exception, ex:
raise XendError(str(ex))
def domain_device_create(self, id, devconfig):
"""Create a new device for a domain.
@@ -132,6 +132,14 @@ class SrvDomain(SrvDir):
['xtratime', 'int']])
val = fn(req.args, {'dom': self.dom.id})
return val
def op_cpu_sedf_set(self, op, req):
fn = FormFn(self.xd.domain_cpu_sedf_set,
[['dom', 'str'],
['period', 'int'],
['slice', 'int']])
val = fn(req.args, {'dom': self.dom.id})
return val
def op_maxmem_set(self, op, req):
fn = FormFn(self.xd.domain_maxmem_set,
+17
View File
@@ -587,6 +587,23 @@ class ProgRrobin(Prog):
xm.prog(ProgRrobin)
class ProgSedf(Prog):
group = 'scheduler'
name= "sedf"
info = """Set simple EDF parameters."""
def help(self, args):
print args[0], "DOM PERIOD SLICE"
print "\nSet simple EDF parameters."
def main(self, args):
if len(args) != 4: self.err("%s: Invalid argument(s)" % args[0])
dom = args[1]
v = map(int, args[2:4])
server.xend_domain_cpu_sedf_set(dom, *v)
xm.prog(ProgSedf)
class ProgInfo(Prog):
group = 'host'
name = "info"
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.