Access the metric values through macros
To simplify the access to some specific values defined inside the SeD , you can
use these macros:
- -
- TOTALTIME(SeD)
- -
- COMMTIME(SeD)
- -
- TCOMP(SeD)
- -
- TIMESINCELASTSOLVE(SeD)
- -
- COMMPROXIMITY(SeD)
- -
- TRANSFEREFFORT(SeD)
- -
- FREECPU(SeD)
- -
- FREEMEM(SeD)
- -
- NBCPU(SeD)
- -
- CPUSPEED(SeD, idx)
- -
- TOTALMEM(SeD)
- -
- AVGFREEMEM(SeD)
- -
- AVGFREECPU(SeD)
- -
- BOGOMIPS(SeD, idx)
- -
- CACHECPU(SeD, idx)
- -
- TOTALSIZEDISK(SeD)
- -
- FREESIZEDISK(SeD)
- -
- DISKACCESSREAD(SeD)
- -
- DISKACCESSWRITE(SeD)
- -
- USERDEFINED(SeD, idx)
The macros taking two arguments need an index to choose which CPU measurement
is needed. Two extra macros are defined:
- HOSTNAME(server): The hostname of the SeD .
- SED_REF(server): A CORBA reference to the SeD .
Here is an example of an aggregate function using these macros:
SORTFUN(compBogo, BOGOMIPS)
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);
ServerList chosen;
ServerList::iterator it;
for (it=candidates.begin(); it!=candidates.end(); ++it)
if (NBCPU(*it)>=2) chosen.push_back(*it);
SORT(chosen, compBogo);
STL_to_CORBA(chosen, aggrResp);
return 0;
}
This aggregation method first selects only the SeD which have more than 1 CPU
and sorts them according to their number of Bogomips.
The DIET Team - Mer 29 nov 2017 15:13:36 EST