An example of aggregate method definition

We will now present an example of an aggregate method using the functions and macro defined in the UserScheduler.hh file.
SORTFUN(compCPU, NBCPU)
SORTFUN_NB(compCache, CACHECPU, 0)
REV_SORTFUN(compDiskRead, DISKACCESSREAD)

int MyScheduler::aggregate(corba_response_t* aggrResp, size_t max_srv,
                           const size_t nb_responses,
                           const corba_response_t* responses)
{
  ServerList candidates = CORBA_to_STL(responses, nb_responses);

  SORT(candidates, compCache);
  SORT(candidates, compCPU);
  SORT(candidates, compDiskRead);

  STL_to_CORBA(candidates, aggrResp);

  return 0;
}
This function returns a list sorted by increasing disk access for first criteria and by decreasing CPU number and decreasing CPU cache.



The DIET Team - Mer 29 nov 2017 15:13:36 EST