Subversion Repositories shark

Rev

Rev 881 | Rev 928 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
881 trimarchi 1
//fsf_spare_capacity.h
2
//===================================================
3
//       FFFFFFIII   RRRRR      SSTTTTTTT
4
//      FF         IIR   RR    SS
5
//     FF           IR        SS
6
//    FFFFFF         RRRR    SSSSST
7
//   FF       FI       RRR  SS
8
//  FF         II     RRR  SS
9
// FF           IIIIIR    RS
10
//
11
// FSF(FIRST Scheduling Framework) 
12
// spare capacity sharing functionality
13
//===================================================
14
 
15
#include <time.h>
16
#include <stdint.h>
17
#include "fsf_basic_types.h"
18
#include "fsf_core.h"
19
 
20
#ifndef _FSF_SPARE_CAPACITY_H_
21
#define _FSF_SPARE_CAPACITY_H_
22
 
23
#define FSF_SPARE_CAPACITY_MODULE_SUPPORTED       1
24
 
25
//// The definition of this types is in fsf_basic_types.h
26
//
27
//// Granularity of spare capacity requirements
28
//typedef enum {FSF_CONTINUOUS, FSF_DISCRETE} fsf_granularity_t;
29
//
30
//// Utilization (budget and period) value
31
//typedef struct {
32
//  struct timespec    budget;    // Execution time
33
//  struct timespec    period;    // Period
34
//} fsf_utilization_value_t;
35
//
36
////List of utilization values
37
//typedef struct {
38
//  int                         size; // = 0
39
//  fsf_utilization_value_t     
40
//      value[FSF_MAX_N_UTILIZATION_VALUES]; 
41
//      //unit change to value.....
42
//} fsf_utilization_set_t;
43
//
44
//
45
//// Constants for assigning default values
46
//#define FSF_DEFAULT_GRANULARITY         FSF_CONTINUOUS
47
//#define FSF_DEFAULT_QUALITY             0
48
//#define FSF_DEFAULT_IMPORTANCE          1
49
//
50
//
51
//// Constants for omitting the assignment of values to specific
52
//// arguments in calls to initialization functions
53
//
54
//#define FSF_NULL_UTILIZATION_SET     (fsf_utilization_set_t *)NULL
55
//
56
 
889 trimarchi 57
//fsf_set_contract_reclamation_parameters: The operation updates the
58
//specified contract parameters object by setting its maximum usable
59
//budget, minimum period, granularity, utilization set, quality, and
60
//importance to the specified input parameters.
61
/*
62
    [ERR@RETURNED:
63
     FSF_ERR_BAD_ARGUMENT :  if contract is NULL or  
64
       (budget_max value is grater than period_max or smaller than budget_min)  or
65
       (period_min is smaller than budget_mint or larger than period_max)       or
66
       (granularity is neither FSF_CONTINUOUS nor FSF_DISCRETE)                 or
67
       (granularity is FSF_CONTINUOUS and
68
        utilization_set is not FSF_NULL_UTILIZATION_SET)                        or
69
       (granularity is FSF_DISCRETE and
70
        utilization_set is FSF_NULL_UTILIZATION_SET)                            or
71
       (utilization_set is not FSF_NULL_UTILIZATION_SET and
72
        (size of utilization_set less than 2 or greater
73
         than FSF_MAX_N_UTILIZATION_VALUES)                )                    or
74
       (quality < 0)                                                            or
75
       (importance is less than 1 or greater than FSF_N_IMPORTANCE_LEVELS)      or
76
       (the utilization_set elements are not in increasing utilization order)   or
77
       (the first utilization value in the utilization_set does not match
78
        the pair (budget_min, period_max) of the contract)                      or
79
       (the last utilization value in the utilization_set does not match
80
        the pair (budget_max, period_min) of the contract)
81
    ]
881 trimarchi 82
 
83
*/
84
int
85
fsf_set_contract_reclamation_parameters
86
  (fsf_contract_parameters_t   *contract,
87
   const struct timespec       *budget_max,
88
   const struct timespec       *period_min,
89
   fsf_granularity_t            granularity,
90
   const fsf_utilization_set_t *utilization_set,
91
   int                          quality,
92
   int                          importance);
93
 
94
 
889 trimarchi 95
//fsf_get_contract_reclamation_parameters: The operation obtains from
96
//the specified contract parameters object its granularity,
97
//utilization set, quality, and importance. Then copies them to the
98
//variables pointed to by the specified input parameters.  Only the
99
//utilization_values of the utilization_set that are in use, are
100
//copied (according to its size field).
101
/*
102
    [ERR@RETURNED:
103
     FSF_ERR_BAD_ARGUMENT :  if contract is NULL
104
    ]
881 trimarchi 105
*/
106
int
107
fsf_get_contract_reclamation_parameters
108
  (const fsf_contract_parameters_t *contract,
109
   struct timespec                 *budget_max,
110
   struct timespec                 *period_min,
111
   fsf_granularity_t               *granularity,
112
   fsf_utilization_set_t           *utilization_set,
113
   int                             *quality,
114
   int                             *importance);
115
 
116
 
889 trimarchi 117
//fsf_request_change_quality_and_importance: The operation enqueues a
118
//request to change the quality and importance parameters of the
119
//specified server, and returns immediately.  The change operation is
120
//performed as soon as it is practical; meanwhile the system operation
121
//will continue normally.
122
/*
123
    [ERR@RETURNED:
124
     FSF_ERR_BAD_ARGUMENT : if the value of the server argument is not in range or
125
       (quality < 0)                                                            or
126
       (importance is less than 1 or greater than FSF_N_IMPORTANCE_LEVELS)
127
     FSF_ERR_NOT_SCHEDULED_CALLING_THREAD : if the calling thread is not
881 trimarchi 128
       scheduled under the FSF
889 trimarchi 129
     FSF_ERR_INVALID_SCHEDULER_REPLY : the scheduler is wrong or not running
130
     FSF_ERR_NOT_CONTRACTED_SERVER : if the server has been cancelled or it
131
       is not valid
132
    ]
881 trimarchi 133
*/
134
int
135
fsf_request_change_quality_and_importance
136
  (fsf_server_id_t server,
137
   int new_importance,
138
   int new_quality);
139
 
140
 
889 trimarchi 141
//fsf_get_total_quality: This operation calculates the sum of the
142
//quality parameters for all servers in the system of importance level
143
//equal to that of the specified server, and stores it in the variable
144
//pointed to by total_quality.
145
/*
146
    [ERR@RETURNED:
147
     FSF_ERR_BAD_ARGUMENT : if the value of the server argument is not in range or
148
       total_quality is NULL
149
     FSF_ERR_NOT_SCHEDULED_CALLING_THREAD : if the calling thread is not
881 trimarchi 150
       scheduled under the FSF
889 trimarchi 151
     FSF_ERR_INVALID_SCHEDULER_REPLY : the scheduler is wrong or not running
152
     FSF_ERR_NOT_CONTRACTED_SERVER : if the server has been cancelled or it
153
       is not valid
154
    ]
881 trimarchi 155
*/
889 trimarchi 156
 
881 trimarchi 157
int
158
fsf_get_total_quality
159
   (fsf_server_id_t server, int *total_quality);
160
 
161
 
889 trimarchi 162
//fsf_get_available_capacity: This operation stores in the variable
163
//pointed to by capacity the spare capacity currently assigned to the
164
//importance level of the specified server. The capacity is the number
165
//obtained divided by UINT32_MAX, and it represents the processor or
166
//network utilization.
167
/*
168
    [ERR@RETURNED:
169
     FSF_ERR_BAD_ARGUMENT : if the value of the server argument is not in range or
170
       capacity is NULL
171
     FSF_ERR_NOT_SCHEDULED_CALLING_THREAD : if the calling thread is not
172
       scheduled under the FSF
173
     FSF_ERR_INVALID_SCHEDULER_REPLY : the scheduler is wrong or not running
174
     FSF_ERR_NOT_CONTRACTED_SERVER : if the server has been cancelled or it
175
       is not valid
176
    ]
177
*/
881 trimarchi 178
 
179
int
180
fsf_get_available_capacity (
181
    fsf_server_id_t server, uint32_t *capacity);
182
 
183
 
184
#endif // _FSF_SPARE_CAPACITY_H_