~ubuntu-branches/ubuntu/utopic/xen/utopic

« back to all changes in this revision

Viewing changes to tools/libxc/xc_sedf.c

  • Committer: Bazaar Package Importer
  • Author(s): Bastian Blank
  • Date: 2010-05-06 15:47:38 UTC
  • mto: (1.3.1) (15.1.1 sid) (4.1.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20100506154738-agoz0rlafrh1fnq7
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
13
int 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
 
 
38
int 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
}