aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_rrobin.c
blob: ad37962f3be7ed3c43097a7023ee0115899caad5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/******************************************************************************
 * xc_rrobin.c
 * 
 * API for manipulating parameters of the Round Robin scheduler
 * 
 * by Mark Williamson, Copyright (c) 2004 Intel Research Cambridge.
 */

#include "xc_private.h"

int xc_rrobin_global_set(int xc_handle, u64 slice)
{
    dom0_op_t op;
    op.cmd = DOM0_SCHEDCTL;
    op.u.schedctl.sched_id = SCHED_RROBIN;
    op.u.schedctl.direction = SCHED_INFO_PUT;

    op.u.schedctl.u.rrobin.slice = slice;
    return do_dom0_op(xc_handle, &op);
}


int xc_rrobin_global_get(int xc_handle, u64 *slice)
{
    dom0_op_t op;
    int ret;

    op.cmd = DOM0_SCHEDCTL;
    op.u.schedctl.sched_id = SCHED_RROBIN;
    op.u.schedctl.direction = SCHED_INFO_GET;

    ret = do_dom0_op(xc_handle, &op);

    *slice = op.u.schedctl.u.rrobin.slice;

    return ret;
}