00001 00005 00006 #ifndef _REFINER_H_ 00007 #define _REFINER_H_ 00008 00009 #include "elements.h" 00010 #include "ckheap.h" 00011 #include "CentralLB.h" 00012 00013 class Refiner { 00014 public: 00015 Refiner(double _overload) { 00016 overLoad = _overload; computes=0; processors=0; 00017 }; 00018 ~Refiner() {} 00019 00020 static int* AllocProcs(int count, BaseLB::LDStats* stats); 00021 static void FreeProcs(int* bufs); 00022 void Refine(int count, BaseLB::LDStats* stats, int* cur_p, int* new_p); 00023 00024 double computeAverageLoad(); 00025 double computeMax(); 00026 00027 protected: 00028 void create(int count, BaseLB::LDStats* stats, int* cur_p); 00029 virtual int refine(); 00030 int multirefine(bool reset = 1); 00031 void assign(computeInfo *c, int p); 00032 void assign(computeInfo *c, processorInfo *p); 00033 void deAssign(computeInfo *c, processorInfo *pRec); 00034 virtual void computeAverage(); 00035 bool isHeavy(processorInfo *p); 00036 bool isLight(processorInfo *p); 00037 void removeComputes(); 00038 00039 double overLoad; 00040 double averageLoad; 00041 int P; 00042 int numAvail; 00043 int numComputes; 00044 computeInfo* computes; 00045 processorInfo* processors; 00046 }; 00047 00048 #endif /* _REFINER_H_ */ 00049 00050