#ifndef PROCESS_H
#define PROCESS_H
+#define USE_UNORDERED_MAP 1
+//#undef USE_UNORDERED_MAP
+
#include <vector>
-#include <xbt/log.h>
+#ifdef USE_UNORDERED_MAP
+# include <tr1/unordered_map>
+# define MAP_TEMPLATE std::tr1::unordered_map
+#else
+# include <map>
+# define MAP_TEMPLATE std::map
+#endif
+#include <msg/msg.h>
#include "communicator.h"
#include "neighbor.h"
class process {
public:
- process(int argc, char *argv[]);
- ~process() { };
- void print_loads(e_xbt_log_priority_t logp = xbt_log_priority_info);
+ process(int argc, char* argv[]);
+ ~process();
int run();
+protected:
+ typedef std::vector<neighbor> neigh_type;
+ typedef std::vector<neighbor*> pneigh_type;
+
+ neigh_type neigh;
+ pneigh_type pneigh;
+
private:
+ typedef MAP_TEMPLATE<m_host_t, neighbor*> rev_neigh_type;
+ enum recv_wait_mode { NO_WAIT = 0, WAIT, WAIT_FOR_CLOSE };
+
+ rev_neigh_type rev_neigh;
+
communicator comm;
- std::vector<neighbor> neigh;
+ int ctrl_close_pending;
+ int data_close_pending;
+
+ unsigned iter;
+
+ double prev_load_broadcast;
double load;
+ double expected_load;
+
+ double sum_of_to_send() const;
+ virtual double load_balance(double my_load);
+
+ void compute();
+ void send1_no_bookkeeping(neighbor& nb);
+ void send1_bookkeeping(neighbor& nb);
+ void send();
+ bool receive(recv_wait_mode wait);
+ void finalize1(neighbor& nb);
+ void finalize();
+ void print_loads(e_xbt_log_priority_t logp = xbt_log_priority_info);
};
#endif // !PROCESS_H