00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef SSAMPLEGEN_H
00014 #define SSAMPLEGEN_H
00015
00016
00017
00018
00019 #include "STaskSystem.h"
00020 #include "../probability/SProbabilityDist.h"
00021
00027 class SSampleGen {
00028
00029 public:
00032 SSampleGen();
00033
00036 ~SSampleGen();
00037
00044 void setMachEnvironment(const leda_string& envClassifier)
00045 { _machEnvClass = envClassifier; }
00046
00049 const leda_string& getMachEnvironment() const
00050 { return _machEnvClass; }
00051
00055 void setMachNumOfMachines(int numMach)
00056 { _machNum = numMach; }
00057
00060 int getMachNumOfMachines() const
00061 { return _machNum; };
00062
00068 void setMachTopology(const leda_string& topoClassifier,
00069 int meshW = -1, int meshH = -1)
00070 {
00071 _machTopoClass = topoClassifier;
00072 _machMeshTopoW = meshW;
00073 _machMeshTopoH = meshH;
00074 }
00075
00081 const leda_string& getMachTopology(int& retMeshW, int& retMeshH) const
00082 { retMeshW = _machMeshTopoW; retMeshH = _machMeshTopoH;
00083 return _machTopoClass; }
00084
00088 void setJobNumOfJobs(int numJobs)
00089 { _jobsNum = numJobs; }
00090
00093 int getJobNumOfJobs() const
00094 { return _jobsNum; }
00095
00099 void setJobNumOfMsgs(int numMsgs)
00100 { _msgsNum = numMsgs; }
00101
00104 int getJobNumOfMsgs() const
00105 { return _msgsNum; }
00106
00109 void setProcTimeDist(SProbabilityDist::Type type, double lower, double upper);
00110
00114
00115
00118 void setRelTimeDist(SProbabilityDist *pDist);
00119
00122 SProbabilityDist::Type getJobProcTimeDist() const ;
00123
00128 void setMsgDist(bool zipf);
00129
00133 void setPrecRelation(const leda_string& precRelation)
00134 { _precRel = precRelation; }
00135
00138 const leda_string& getPrecRelation() const
00139 { return _precRel; }
00140
00160 STaskSystem* sample();
00161
00164 void reset();
00165
00174 enum ErrorCode {
00175 NOERROR ,
00176 NUMMACHLOW ,
00177 UNKNOWNENV ,
00178 MESHSIZELOW ,
00179 UNKNOWNTOPO ,
00180 UNKNOWNPREC,
00181 NUMJOBSLOW
00182 };
00183
00188 ErrorCode getError() const
00189 { return _errCode; }
00191 void setRandProcTimes(bool set);
00193 void setRandRelTimes(bool set);
00194
00195 private:
00196
00197 STaskSystem *_pTS;
00198
00199
00200 int _machNum;
00201 leda_string _machEnvClass;
00202 leda_string _machTopoClass;
00203 int _machMeshTopoW, _machMeshTopoH;
00204
00205
00206 leda_string _precRel;
00207
00208
00209 int _jobsNum;
00210 int _msgsNum;
00211 bool _randProcTimes;
00212 bool _randRelTimes;
00213
00214
00215
00216
00217 SProbabilityDist::Type _procTimeDistType;
00218 SProbabilityDist *_pRelTimeDist;
00219 bool _zipf;
00222 double _pdistval1;
00223 double _pdistval2;
00224 double _rdistval;
00225
00226
00227 ErrorCode _errCode;
00228
00229
00230 bool sampleMachEnv();
00231 bool sampleMachTopo();
00232 bool samplePrec();
00233 bool sampleJobs();
00234 bool genClassification();
00235
00236 };
00237
00238 #endif