Subversion Repositories shark

Rev

Blame | Last modification | View Log | RSS feed

//fsf_spare_capacity.h
//===================================================
//       FFFFFFIII   RRRRR      SSTTTTTTT
//      FF         IIR   RR    SS
//     FF           IR        SS
//    FFFFFF         RRRR    SSSSST
//   FF       FI       RRR  SS
//  FF         II     RRR  SS
// FF           IIIIIR    RS
//
// FSF(FIRST Scheduling Framework)
// spare capacity sharing functionality
//===================================================

#include "fsf_basic_types.h"
#include "fsf_core.h"
#include "fsf_server.h"
#include <ll/sys/types.h>

#ifndef _FSF_SPARE_CAPACITY_H_
#define _FSF_SPARE_CAPACITY_H_

#define FSF_SPARE_CAPACITY_MODULE_SUPPORTED       1

typedef DWORD        uint32_t;

//// The definition of this types is in fsf_basic_types.h
//
//// Granularity of spare capacity requirements
//typedef enum {FSF_CONTINUOUS, FSF_DISCRETE} fsf_granularity_t;
//
//// Utilization (budget and period) value
//typedef struct {
//  struct timespec    budget;    // Execution time
//  struct timespec    period;    // Period
//} fsf_utilization_value_t;
//
////List of utilization values
//typedef struct {
//  int                         size; // = 0
//  fsf_utilization_value_t    
//      value[FSF_MAX_N_UTILIZATION_VALUES];
//      //unit change to value.....
//} fsf_utilization_set_t;
//
//
//// Constants for assigning default values
//#define FSF_DEFAULT_GRANULARITY         FSF_CONTINUOUS
//#define FSF_DEFAULT_QUALITY             0
//#define FSF_DEFAULT_IMPORTANCE          1
//
//
//// Constants for omitting the assignment of values to specific
//// arguments in calls to initialization functions
//
//#define FSF_NULL_UTILIZATION_SET     (fsf_utilization_set_t *)NULL
//

//fsf_set_contract_reclamation_parameters: The operation updates the
//specified contract parameters object by setting its maximum usable
//budget, minimum period, granularity, utilization set, quality, and
//importance to the specified input parameters.

int
fsf_set_contract_reclamation_parameters
  (fsf_contract_parameters_t   *contract,
   const struct timespec       *budget_max,
   const struct timespec       *period_min,
   fsf_granularity_t            granularity,
   const fsf_utilization_set_t *utilization_set,
   int                          quality,
   int                          importance);


//fsf_get_contract_reclamation_parameters: The operation obtains from
//the specified contract parameters object its granularity,
//utilization set, quality, and importance. Then copies them to the
//variables pointed to by the specified input parameters.  Only the
//utilization_values of the utilization_set that are in use, are
//copied (according to its size field).

int
fsf_get_contract_reclamation_parameters
  (const fsf_contract_parameters_t *contract,
   struct timespec                 *budget_max,
   struct timespec                 *period_min,
   fsf_granularity_t               *granularity,
   fsf_utilization_set_t           *utilization_set,
   int                             *quality,
   int                             *importance);


//fsf_request_change_quality_and_importance: The operation enqueues a
//request to change the quality and importance parameters of the
//specified server, and returns immediately.  The change operation is
//performed as soon as it is practical; meanwhile the system operation
//will continue normally.

int
fsf_request_change_quality_and_importance
  (fsf_server_id_t server,
   int new_importance,
   int new_quality);


//fsf_get_total_quality: This operation calculates the sum of the
//quality parameters for all servers in the system of importance level
//equal to that of the specified server, and stores it in the variable
//pointed to by total_quality.

int
fsf_get_total_quality
   (fsf_server_id_t server, int *total_quality);


//fsf_get_available_capacity: This operation stores in the variable
//pointed to by capacity the spare capacity currently assigned to the
//importance level of the specified server. The capacity is the number
//obtained divided by UINT32_MAX, and it represents the processor or
//network utilization.

int
fsf_get_available_capacity (
    fsf_server_id_t server, uint32_t *capacity);


#endif // _FSF_SPARE_CAPACITY_H_