Blame |
Last modification |
View Log
| RSS feed
#include "kernel/kern.h"
#include "fsf_server.h"
#include "fsf_contract.h"
void fsfinit()
{
struct timespec period1 = {0,10000000}; //30%
struct timespec period2 = {0,30000000}; //20%
struct timespec period3 = {0,30000000}; //10%
struct timespec budget1 = {0,3000000};
struct timespec budget2 = {0,6000000};
struct timespec budget3 = {0,3000000};
fsf_server_id_t server1 = -1;
fsf_server_id_t server2 = -1;
fsf_server_id_t server3 = -1;
fsf_server_id_t server4 = -1;
fsf_contract_parameters_t contract;
int bw;
fsf_initialize_contract(&contract);
fsf_set_contract_basic_parameters(&contract,&budget1,&period1,NULL,NULL,FSF_DEFAULT_WORKLOAD);
fsf_negotiate_contract(&contract,&server1);
bw = MAX_BANDWIDTH / TIMESPEC2USEC(&period1) * TIMESPEC2USEC(&budget1);
cprintf("FSF SERVER LEVEL %d BW %d.%03d\n",server1, (int)( (long long)bw * 100 / MAX_BANDWIDTH),
(int)( (long long)bw * 100000 / MAX_BANDWIDTH % 1000));
fsf_set_contract_basic_parameters(&contract,&budget2,&period2,NULL,NULL,FSF_DEFAULT_WORKLOAD);
fsf_negotiate_contract(&contract,&server2);
bw = MAX_BANDWIDTH / TIMESPEC2USEC(&period2) * TIMESPEC2USEC(&budget2);
cprintf("FSF SERVER LEVEL %d BW %d.%03d\n",server2, (int)( (long long)bw * 100 / MAX_BANDWIDTH),
(int)( (long long)bw * 100000 / MAX_BANDWIDTH % 1000));
fsf_set_contract_basic_parameters(&contract,&budget3,&period3,NULL,NULL,FSF_DEFAULT_WORKLOAD);
fsf_negotiate_contract(&contract,&server3);
bw = MAX_BANDWIDTH / TIMESPEC2USEC(&period3) * TIMESPEC2USEC(&budget3);
cprintf("FSF SERVER LEVEL %d BW %d.%03d\n",server3, (int)( (long long)bw * 100 / MAX_BANDWIDTH),
(int)( (long long)bw * 100000 / MAX_BANDWIDTH % 1000));
fsf_set_contract_basic_parameters(&contract,&budget2,&period2,NULL,NULL,FSF_DEFAULT_WORKLOAD);
fsf_set_local_scheduler_parameter(&contract, FSF_SCHEDULER_EDF);
fsf_negotiate_contract(&contract,&server4);
bw = MAX_BANDWIDTH / TIMESPEC2USEC(&period2) * TIMESPEC2USEC(&budget2);
cprintf("FSF SERVER LEVEL %d BW %d.%03d\n",server4, (int)( (long long)bw * 100 / MAX_BANDWIDTH),
(int)( (long long)bw * 100000 / MAX_BANDWIDTH % 1000));
}