source: trunk/packages/xen-3.1/xen-3.1/tools/libxc/xc_sedf.c @ 34

Last change on this file since 34 was 34, checked in by hartmans, 17 years ago

Add xen and xen-common

File size: 1.6 KB
Line 
1/******************************************************************************
2 * xc_sedf.c
3 *
4 * API for manipulating parameters of the Simple EDF scheduler.
5 *
6 * changes by Stephan Diestelhorst
7 * based on code
8 * by Mark Williamson, Copyright (c) 2004 Intel Research Cambridge.
9 */
10
11#include "xc_private.h"
12
13int xc_sedf_domain_set(
14    int xc_handle,
15    uint32_t domid,
16    uint64_t period,
17    uint64_t slice,
18    uint64_t latency,
19    uint16_t extratime,
20    uint16_t weight)
21{
22    DECLARE_DOMCTL;
23    struct xen_domctl_sched_sedf *p = &domctl.u.scheduler_op.u.sedf;
24
25    domctl.cmd = XEN_DOMCTL_scheduler_op;
26    domctl.domain  = (domid_t)domid;
27    domctl.u.scheduler_op.sched_id = XEN_SCHEDULER_SEDF;
28    domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_putinfo;
29
30    p->period    = period;
31    p->slice     = slice;
32    p->latency   = latency;
33    p->extratime = extratime;
34    p->weight    = weight;
35    return do_domctl(xc_handle, &domctl);
36}
37
38int xc_sedf_domain_get(
39    int xc_handle,
40    uint32_t domid,
41    uint64_t *period,
42    uint64_t *slice,
43    uint64_t *latency,
44    uint16_t *extratime,
45    uint16_t *weight)
46{
47    DECLARE_DOMCTL;
48    int ret;
49    struct xen_domctl_sched_sedf *p = &domctl.u.scheduler_op.u.sedf;
50
51    domctl.cmd = XEN_DOMCTL_scheduler_op;
52    domctl.domain = (domid_t)domid;
53    domctl.u.scheduler_op.sched_id = XEN_SCHEDULER_SEDF;
54    domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_getinfo;
55
56    ret = do_domctl(xc_handle, &domctl);
57
58    *period    = p->period;
59    *slice     = p->slice;
60    *latency   = p->latency;
61    *extratime = p->extratime;
62    *weight    = p->weight;
63    return ret;
64}
Note: See TracBrowser for help on using the repository browser.