Subversion Repositories shark

Rev

Blame | Last modification | View Log | RSS feed

#include "kernel/kern.h"
#include "fsf_server.h"
#include "fsf_contract.h"
#include "func.h"

extern struct loader_contract loader_contract_list[];
extern int total_loader_contract;

void fsfinit()
{

  struct loader_contract *c;
  fsf_contract_parameters_t contract;
  fsf_server_id_t server;
  int i;
  long long bw;

  for (i=0;i<total_loader_contract;i++) {

    c = &loader_contract_list[i];

    fsf_initialize_contract(&contract);

    fsf_set_contract_basic_parameters(&contract,&c->cmin,&c->tmax,&c->cmax,&c->tmin,c->workload);

    if (c->local_scheduler != PAR_POSIX) {
 
      switch (c->local_scheduler) {
         case PAR_EDF:
           fsf_set_local_scheduler_parameter(&contract,FSF_SCHEDULER_EDF);
           break;
         case PAR_RM:
           fsf_set_local_scheduler_parameter(&contract,FSF_SCHEDULER_RM);
           break;
      }

    }
 
    fsf_negotiate_contract(&contract,&server);
    c->server = server;
    bw = (long long)(MAX_BANDWIDTH) * TIMESPEC2USEC(&c->cmin) / TIMESPEC2USEC(&c->tmax);
    cprintf("FSF CONTRACT %d SERVER %d MIN BW %d.%03d\n", c->number, c->server,
             (int)(bw * 100 / MAX_BANDWIDTH),
             (int)(bw * 100000 / MAX_BANDWIDTH % 1000));
 
  }

}