00001 #ifndef LDBAL_H
00002 #define LDBAL_H
00003
00004 #include "ldbal.decl.h"
00005
00006 extern CProxy_LBgroup TheLBG;
00007 extern CProxy_LBstrategy TheLBstrategy;
00008
00009 class LoadReport : public CMessage_LoadReport {
00010 public:
00011 int PE, peLoad;
00012 };
00013
00014 typedef struct
00015 {
00016 int PE, peLoad, startPEidx, endPEidx;
00017 } balanceData;
00018
00019 class BalanceSpecs : public CMessage_BalanceSpecs {
00020 public:
00021
00022 balanceData sortArray[128];
00023 int indexArray[128];
00024 int avgLoad, totalLoad;
00025 };
00026
00027 class LBgroup : public Group {
00028
00029
00030 #ifdef POSE_STATS_ON
00031 localStat *localStats;
00032 #endif
00033 int reportTo, peLoad, busy;
00034 lbObjects objs;
00035 public:
00036 LBgroup(void);
00037 LBgroup(CkMigrateMessage *) { };
00038
00039 int computeObjectLoad(POSE_TimeType ovt, POSE_TimeType eet, double rbOh, int sync, POSE_TimeType gvt);
00040 int computePeLoad();
00041 int findHeaviestUnder(int loadDiff, int prioLoad, int **mvObjs,
00042 int pe, int *contrib);
00043 int objRegister(int arrayIdx, int sync, sim *myPtr);
00044 void objRemove(int arrayIdx);
00045 void objUpdate(int ldIdx, POSE_TimeType ovt, POSE_TimeType eet, int ne, double rbOh, int *srVec);
00046
00047 void calculateLocalLoad(void);
00048 void balance(BalanceSpecs *);
00049 };
00050
00051 class LBstrategy : public Group {
00052
00053 #ifdef POSE_STATS_ON
00054 localStat *localStats;
00055 #endif
00056 int *peLoads;
00057 public:
00058 LBstrategy(void);
00059 LBstrategy(CkMigrateMessage *) { };
00060
00061 void computeLoadMap(int avgLd, int ttlLd);
00062 int findMinPE();
00063
00064 void recvLoadReport(LoadReport *);
00065 };
00066
00067 #endif