00001 #ifndef CK_LOC_REC_H 00002 #define CK_LOC_REC_H 00003 00004 class CkArray;//Array manager 00005 class CkLocMgr;//Location manager 00006 class CkMigratable;//Migratable object 00007 00013 class CkLocRec { 00014 private: 00015 CkLocMgr *myLocMgr; 00016 CkArrayIndex idx; 00017 CmiUInt8 id; 00018 bool *deletedMarker; 00019 bool running; 00020 #if CMK_LBDB_ON 00021 bool asyncMigrate; 00022 bool readyMigrate; 00023 bool enable_measure; 00024 int nextPe; 00025 LBDatabase *the_lbdb; 00026 MetaBalancer *the_metalb; 00027 LDObjHandle ldHandle; 00028 #endif 00029 00030 public: 00031 00032 //Creation and Destruction: 00033 CkLocRec(CkLocMgr *mgr,bool fromMigration,bool ignoreArrival, const CkArrayIndex &idx_, CmiUInt8 id); 00034 void migrateMe(int toPe); //Leave this processor 00035 void destroy(void); //User called destructor 00036 ~CkLocRec(); 00037 00043 bool invokeEntry(CkMigratable *obj,void *msg,int idx,bool doFree); 00044 00045 #if CMK_LBDB_ON //For load balancing: 00047 void startTiming(int ignore_running=0); 00048 void stopTiming(int ignore_running=0); 00049 void setObjTime(double cputime); 00050 double getObjTime(); 00051 void *getObjUserData(int idx); 00052 #else 00053 inline void startTiming(int ignore_running=0) { } 00054 inline void stopTiming(int ignore_running=0) { } 00055 #endif 00056 inline const CkArrayIndex &getIndex(void) const {return idx;} 00057 inline CmiUInt8 getID() const { return id; } 00058 00059 #if CMK_LBDB_ON 00060 public: 00061 inline LBDatabase *getLBDB(void) const {return the_lbdb;} 00062 inline MetaBalancer *getMetaBalancer(void) const {return the_metalb;} 00063 inline LDObjHandle getLdHandle() const{return ldHandle;} 00064 static void staticMigrate(LDObjHandle h, int dest); 00065 static void staticMetaLBResumeWaitingChares(LDObjHandle h, int lb_ideal_period); 00066 static void staticMetaLBCallLBOnChares(LDObjHandle h); 00067 void recvMigrate(int dest); 00068 void setMigratable(int migratable); 00069 void setPupSize(size_t obj_pup_size); 00070 void AsyncMigrate(bool use); 00071 bool isAsyncMigrate() { return asyncMigrate; } 00072 void ReadyMigrate(bool ready) { readyMigrate = ready; } 00073 bool isReadyMigrate() { return readyMigrate; } 00074 bool checkBufferedMigration(); // check and execute pending migration 00075 int MigrateToPe(); 00076 #if (defined(_FAULT_MLOG_) || defined(_FAULT_CAUSAL_)) 00077 void Migrated(); 00078 #endif 00079 inline void setMeasure(bool status) { enable_measure = status; } 00080 #else 00081 void AsyncMigrate(bool use){}; 00082 #endif 00083 00084 #if CMK_FAULT_EVAC 00085 private: 00086 bool asyncEvacuate; //can the element be evacuated anytime, false for tcharm 00087 bool bounced; //did this element try to immigrate into a processor which was evacuating 00088 // and was bounced away to some other processor. This is assumed to happen 00089 //only if this object was migrated by a load balancer, but the processor 00090 // started crashing soon after 00091 public: 00092 bool isAsyncEvacuate(){return asyncEvacuate;} 00093 void AsyncEvacuate(bool set){asyncEvacuate = set;} 00094 bool isBounced(){return bounced;} 00095 void Bounced(bool set){bounced = set;} 00096 #endif 00097 }; 00098 00099 #endif // CK_LOC_REC_H 00100