]> AND Private Git Repository - loba.git/blob - loba_fairstrategy.cpp
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
Add log message about number of hosts in platform file.
[loba.git] / loba_fairstrategy.cpp
1 #include <xbt/log.h>
2
3 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(loba);
4
5 #include "loba_fairstrategy.h"
6
7 void loba_fairstrategy::load_balance()
8 {
9     pneigh_sort_by_load(std::greater<double>());
10     print_loads_p(false, xbt_log_priority_debug);
11
12     const double delta = 0.001;
13     bool found = true;
14     while (found) {
15         found = false;
16         for (unsigned i = 0 ; i < pneigh.size() ; ++i) {
17             if (pneigh[i]->get_load() <= get_load() - 2 * delta) {
18                 found = true;
19                 send(pneigh[i], delta);
20                 XBT_DEBUG("sent to %s", pneigh[i]->get_name());
21             }
22         }
23     }
24 }
25
26 // Local variables:
27 // mode: c++
28 // End: