1 /**************************************************************************/
2 /* ---------------------------------------------------------------------- */
3 /* Copyright (C) 2006 - 2008 FRESCOR consortium partners: */
5 /* Universidad de Cantabria, SPAIN */
6 /* University of York, UK */
7 /* Scuola Superiore Sant'Anna, ITALY */
8 /* Kaiserslautern University, GERMANY */
9 /* Univ. Politécnica Valencia, SPAIN */
10 /* Czech Technical University in Prague, CZECH REPUBLIC */
12 /* Thales Communication S.A. FRANCE */
13 /* Visual Tools S.A. SPAIN */
14 /* Rapita Systems Ltd UK */
17 /* See http://www.frescor.org for a link to partners' websites */
19 /* FRESCOR project (FP6/2005/IST/5-034026) is funded */
20 /* in part by the European Union Sixth Framework Programme */
21 /* The European Union is not liable of any use that may be */
22 /* made of this code. */
25 /* This file is part of FRSH (FRescor ScHeduler) */
27 /* FRSH is free software; you can redistribute it and/or modify it */
28 /* under terms of the GNU General Public License as published by the */
29 /* Free Software Foundation; either version 2, or (at your option) any */
30 /* later version. FRSH is distributed in the hope that it will be */
31 /* useful, but WITHOUT ANY WARRANTY; without even the implied warranty */
32 /* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */
33 /* General Public License for more details. You should have received a */
34 /* copy of the GNU General Public License along with FRSH; see file */
35 /* COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, */
36 /* Cambridge, MA 02139, USA. */
38 /* As a special exception, including FRSH header files in a file, */
39 /* instantiating FRSH generics or templates, or linking other files */
40 /* with FRSH objects to produce an executable application, does not */
41 /* by itself cause the resulting executable application to be covered */
42 /* by the GNU General Public License. This exception does not */
43 /* however invalidate any other reasons why the executable file might be */
44 /* covered by the GNU Public License. */
45 /**************************************************************************/
48 * @file frsh_feedback.c
49 * @author Dario Faggioli <faggioli@gandalf.sssup.it>
50 * @date Wed Feb 20 14:53:22 2009
52 * @brief Feedback module of FRSH_FORB framework
56 #include <frsh_core.h>
57 #include <fra_generic.h>
58 #include "frsh_forb.h"
59 #include <frsh_resources.h>
62 #include <aqcpu_res.h>
65 #include <cpucg_res.h>
68 #include <diskbfq_res.h>
71 static frsh_vres_id_t spare_vres;
73 int frsh_feedback_get_spare(frsh_contract_t *spare_contract)
75 return frsh_vres_get_contract(spare_vres, spare_contract);
78 int frsh_feedback_set_spare
79 (const frsh_contract_t *spare_contract)
82 frsh_vres_id_t spare_vres;
84 if (!spare_contract || !*spare_contract)
85 return FRSH_ERR_BAD_ARGUMENT;
87 ret = frsh_contract_negotiate(spare_contract, &spare_vres);
91 if (spare_vres->allocator->set_spare_bandwidth) {
92 ret = spare_vres->allocator->set_spare_bandwidth(spare_vres);
94 ret = FRSH_ERR_NOT_IMPLEMENTED;
100 int frsh_feedback_get_desired_budget
101 (frsh_vres_id_t vres_id,
102 frsh_rel_time_t *p_budget_out)
104 if (vres_id->allocator->get_desired_budget) {
105 return vres_id->allocator->get_desired_budget(vres_id, p_budget_out);
107 return FRSH_ERR_NOT_IMPLEMENTED;
111 int frsh_feedback_set_desired_budget
112 (frsh_vres_id_t vres_id,
113 frsh_rel_time_t *p_budget_in)
115 if (vres_id->allocator->set_desired_budget) {
116 return vres_id->allocator->set_desired_budget(vres_id, p_budget_in);
118 return FRSH_ERR_NOT_IMPLEMENTED;
122 int frsh_feedback_get_actual_budget
123 (frsh_vres_id_t vres_id,
124 frsh_rel_time_t *budget)
126 if (vres_id->allocator->get_actual_budget) {
127 return vres_id->allocator->get_actual_budget(vres_id, budget);
129 return FRSH_ERR_NOT_IMPLEMENTED;