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

Private GIT Repository
Add a catchall case in exception handler.
[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     const double delta = 0.001;
10
11     pneigh_sort_by_load(std::greater<double>());
12
13     print_loads_p(false, xbt_log_priority_debug);
14
15     bool found = true;
16
17     while (found) {
18         found = false;
19         for (unsigned i = 0 ; i < pneigh.size() ; ++i) {
20             if (pneigh[i]->get_load() <= get_load() - 2 * delta) {
21                 found = true;
22                 send(pneigh[i], delta);
23                 XBT_DEBUG("sent to %s", pneigh[i]->get_name());
24             }
25         }
26     }
27 }
28
29 // Local variables:
30 // mode: c++
31 // End: