Changeset 539 for DCWoRMS/trunk/build/classes/simulator
- Timestamp:
- 10/31/12 13:52:06 (12 years ago)
- Location:
- DCWoRMS/trunk/build/classes/simulator
- Files:
-
- 15 added
- 30 edited
Legend:
- Unmodified
- Added
- Removed
-
DCWoRMS/trunk/build/classes/simulator/ConfigurationOptions.java
r477 r539 8 8 import java.util.PropertyResourceBundle; 9 9 import java.util.ResourceBundle; 10 import java.util.logging.FileHandler;11 10 12 11 /** … … 26 25 * ============================================================================================= 27 26 */ 28 /** Grid scheduler's plugin path */ 29 public static final String GRID_SCHEDULING_PLUGIN_NAME_MODIFIER = "gridschedulingpluginname"; 30 /** Forecast finish time plugin path */ 31 public static final String EXEC_TIME_ESTIMATION_PLUGIN_NAME_MODIFIER = "exectimeestimationpluginname"; 32 /** Local allocation policy plugin path */ 33 public static final String LOCAL_ALLOC_POLICY_PLUGIN_NAME_MODIFIER = "localallocpolicypluginname"; 27 34 28 /** The path to the resource description file */ 35 29 public static final String RESOURCE_DESC_MODIFIER = "resdesc"; … … 58 52 public static final String READ_SCENARIO_INPUT_FOLDER = READ_SCENARIO_MODIFIER 59 53 + ".inputfolder"; 60 public static final String READ_SCENARIO_INPUT_TAR = READ_SCENARIO_MODIFIER+ ".tar";61 54 62 55 /** The name of the workload file */ … … 64 57 + ".workloadfilename"; 65 58 66 /** Shall a detailed history be printed */67 public static final String PRINT_HISTORY_MODIFIER = "printhistory";68 69 59 /** The default name of a workload file */ 70 60 public static final String DEFAULT_WORKLOAD_FILE_NAME = "workload.swf"; 71 61 72 62 public static final String CREATE_XML_SUPPLEMENT_FILES = "createXMLSupplement"; 73 74 public static final String PROVIDER_LIST_FILE = "in/provider.list"; 75 76 /** Network topology file path */ 77 public static final String NETWORK_TOPOLOGY_FILE_MODIFIER = "networktopologyfilename"; 63 78 64 79 65 public static final String CREATEDIAGRAMS = "creatediagrams"; 80 public static final String CREATEDIAGRAMS_PROCESSORS = CREATEDIAGRAMS +".processors"; 81 public static final String CREATEDIAGRAMS_RESERVATIONS = CREATEDIAGRAMS + ".reservations"; 82 public static final String CREATEDIAGRAMS_RESOURCES = CREATEDIAGRAMS + ".resources"; 83 public static final String CREATEDIAGRAMS_ENERGYUSAGE = CREATEDIAGRAMS + ".energyusage"; 84 public static final String CREATEDIAGRAMS_RESOURCES_SCALE = CREATEDIAGRAMS_RESOURCES + ".scale"; 66 public static final String CREATEDIAGRAMS_GANTT = CREATEDIAGRAMS +".gantt"; 85 67 public static final String CREATEDIAGRAMS_TASKS = CREATEDIAGRAMS + ".tasks"; 86 68 public static final String CREATEDIAGRAMS_TASKSWAITINGTIME = CREATEDIAGRAMS + ".taskswaitingtime"; 69 public static final String CREATEDIAGRAMS_UTILIZATION = CREATEDIAGRAMS + ".resutilization"; 70 public static final String CREATEDIAGRAMS_ENERGYUSAGE = CREATEDIAGRAMS + ".respowerusage"; 71 public static final String CREATEDIAGRAMS_AIRFLOW = CREATEDIAGRAMS + ".resairflow"; 72 public static final String CREATEDIAGRAMS_RESOURCES_SCALE = CREATEDIAGRAMS_UTILIZATION + ".scale"; 73 87 74 88 75 public static final String CREATESTATISTICS = "createstatistics"; 89 76 public static final String ACCUMULATED_RESOURCES_STATISTICS = CREATESTATISTICS + ".accumulatedresources"; 90 77 public static final String EXTENDED_TASKS_STATISTICS = CREATESTATISTICS + ".extendedtasks"; 91 public static final String GRIDLET_HISTORY_STATISTICS = CREATESTATISTICS + ".gridlethistory";92 78 public static final String JOBS_STATISTICS = CREATESTATISTICS + ".jobs"; 93 79 public static final String SIMULATION_STATISTICS = CREATESTATISTICS + ".simulation"; 94 public static final String FORMAT_STATISTICS_OUTPUT = CREATESTATISTICS + ".formatoutput";95 80 96 81 /** … … 116 101 /* =============================================================================================== */ 117 102 118 public String providerListFile = null; 119 120 /** 121 * the full grid scheduling plugin name with package prefix, e.g. 122 * simulator.plugin.gridscheduling.raPlugin.RAPlugin (the plugin is loaded 123 * using {@link Class#forName(java.lang.String)} and 124 * {@link Class#newInstance()} methods) 125 */ 126 public String gridSchedulingPluginName = null; 127 128 /** 129 * the full forecast finish time plugin name with package prefix, e.g. 130 * simulator.plugin.gridscheduling.raPlugin.RAPlugin (the plugin is loaded 131 * using {@link Class#forName(java.lang.String)} and 132 * {@link Class#newInstance()} methods) 133 */ 134 public String exectimeestimationplugin = null; 135 136 /** 137 * the full local allocation policy plugin name with package prefix, e.g. 138 * simulator.plugin.gridscheduling.raPlugin.RAPlugin (the plugin is loaded 139 * using {@link Class#forName(java.lang.String)} and 140 * {@link Class#newInstance()} methods) 141 */ 142 public String localAllocPolicyPluginName = null; 103 143 104 144 105 /** … … 180 141 public String inputWorkloadFileName = DEFAULT_WORKLOAD_FILE_NAME; 181 142 182 /**183 * a txt file name with topology description184 */185 public String networkTopologyFileName = null;186 143 187 144 /** … … 199 156 public boolean overwriteFiles = false; 200 157 201 /**202 * true if the history files are to be generated (makes the simulation203 * slower)204 */205 public boolean printHistory = false;206 158 207 159 /** … … 210 162 public int numberOfSimulations = 1; //default value 211 163 212 public boolean creatediagrams_processors = true; 213 public boolean creatediagrams_reservations = true; 214 public boolean creatediagrams_resources = true; 215 public boolean creatediagrams_energyusage = true; 216 public boolean creatediagrams_tasks = true; 217 public boolean creatediagrams_taskswaitingtime = true; 218 public double creatediagrams_resources_scale = 1; 219 220 public boolean createaccumulatedresourcesstatistics = true; 221 public boolean createextendedtasksstatistics = true; 222 public boolean creategridlethistorystatistics = true; 164 public boolean creatediagrams_gantt = false; 165 public boolean creatediagrams_tasks = false; 166 public boolean creatediagrams_taskswaitingtime = false; 167 168 public boolean creatediagrams_resutilization = false; 169 public boolean creatediagrams_respowerusage = false; 170 public boolean creatediagrams_resairflow = false; 171 public double creatediagrams_resources_scale = 1; 172 223 173 public boolean createjobsstatistics = true; 224 174 public boolean createsimulationstatistics = true; 225 public boolean formatstatisticsoutput = false; 226 227 public static final String ENV_DESC_MODIFIER = "envdesc"; 228 public String envDescFileName = null; 175 176 public String [] resForEnergyChart; 177 public String [] resForAirFlowChart; 178 public String [] resForUtilizationChart; 179 229 180 /** 230 181 * An empty constructor. … … 257 208 return null; 258 209 } 259 260 try {261 co.gridSchedulingPluginName = bundle262 .getString(GRID_SCHEDULING_PLUGIN_NAME_MODIFIER);263 } catch(MissingResourceException e){264 co.gridSchedulingPluginName = null;265 }266 267 try {268 co.exectimeestimationplugin = bundle269 .getString(EXEC_TIME_ESTIMATION_PLUGIN_NAME_MODIFIER);270 } catch(MissingResourceException e){271 co.exectimeestimationplugin = null;272 }273 274 try {275 co.localAllocPolicyPluginName = bundle276 .getString(LOCAL_ALLOC_POLICY_PLUGIN_NAME_MODIFIER);277 } catch(MissingResourceException e){278 co.localAllocPolicyPluginName = null;279 }280 281 210 282 211 co.resdescFileName = bundle.getString(RESOURCE_DESC_MODIFIER); 283 284 try {285 co.envDescFileName = bundle.getString(ENV_DESC_MODIFIER);286 } catch(MissingResourceException e){287 co.envDescFileName = null;288 }289 212 290 213 try { … … 314 237 } 315 238 316 317 try {318 co.networkTopologyFileName = bundle319 .getString(NETWORK_TOPOLOGY_FILE_MODIFIER);320 } catch(MissingResourceException e){321 co.networkTopologyFileName = null;322 }323 324 239 if (co.createScenario == false) { 325 240 // read scenario … … 329 244 } catch (MissingResourceException e) { 330 245 co.inputFolder = null; 331 }332 333 try {334 co.inputTar = getSeparatorTerminatedPath(bundle335 .getString(READ_SCENARIO_INPUT_TAR));336 } catch (MissingResourceException e) {337 co.inputTar = null;338 246 } 339 247 … … 357 265 co.createXMLSupplement = false; 358 266 } 359 360 try { 361 co.printHistory = Boolean.valueOf( 362 bundle.getString(PRINT_HISTORY_MODIFIER)).booleanValue(); 363 } catch(MissingResourceException e){ 364 co.printHistory = false; 365 } 366 267 367 268 // create diagrams 368 269 … … 372 273 bundle.getString(CREATEDIAGRAMS)).booleanValue(); 373 274 } catch(MissingResourceException e){ 374 createDiagrams = true; 375 } 376 try { 377 co.creatediagrams_processors = Boolean.valueOf( 378 bundle.getString(CREATEDIAGRAMS_PROCESSORS)).booleanValue() && createDiagrams; 379 } catch(MissingResourceException e){ 380 co.creatediagrams_processors = createDiagrams; 381 } 382 try { 383 co.creatediagrams_reservations = Boolean.valueOf( 384 bundle.getString(CREATEDIAGRAMS_RESERVATIONS)).booleanValue() && createDiagrams; 385 } catch(MissingResourceException e){ 386 co.creatediagrams_reservations = createDiagrams; 387 } 388 try { 389 co.creatediagrams_resources = Boolean.valueOf( 390 bundle.getString(CREATEDIAGRAMS_RESOURCES)).booleanValue() && createDiagrams; 391 } catch(MissingResourceException e){ 392 co.creatediagrams_resources = createDiagrams; 275 createDiagrams = false; 276 } 277 try { 278 co.creatediagrams_gantt = Boolean.valueOf( 279 bundle.getString(CREATEDIAGRAMS_GANTT)).booleanValue(); 280 } catch(MissingResourceException e){ 281 co.creatediagrams_gantt = createDiagrams; 282 } 283 284 try { 285 co.resForUtilizationChart = bundle.getString(CREATEDIAGRAMS_UTILIZATION).split(";"); 286 if(co.resForUtilizationChart.length > 0){ 287 co.creatediagrams_resutilization = true; 288 } 289 } catch(MissingResourceException e){ 290 co.creatediagrams_resutilization = createDiagrams; 393 291 } 394 292 try { … … 399 297 } 400 298 try { 401 co.creatediagrams_energyusage = Boolean.valueOf( 402 bundle.getString(CREATEDIAGRAMS_ENERGYUSAGE)).booleanValue() && createDiagrams; 403 } catch(MissingResourceException e){ 404 co.creatediagrams_energyusage = createDiagrams; 405 } 299 co.resForEnergyChart = bundle.getString(CREATEDIAGRAMS_ENERGYUSAGE).split(";"); 300 if(co.resForEnergyChart.length > 0){ 301 co.creatediagrams_respowerusage = true; 302 } 303 } catch(MissingResourceException e){ 304 co.creatediagrams_respowerusage = createDiagrams; 305 } 306 307 try { 308 co.resForAirFlowChart = bundle.getString(CREATEDIAGRAMS_AIRFLOW).split(";"); 309 if(co.resForAirFlowChart.length > 0){ 310 co.creatediagrams_resairflow = true; 311 } 312 } catch(MissingResourceException e){ 313 co.creatediagrams_resairflow = createDiagrams; 314 } 315 406 316 try { 407 317 co.creatediagrams_tasks = Boolean.valueOf( 408 bundle.getString(CREATEDIAGRAMS_TASKS)).booleanValue() && createDiagrams;318 bundle.getString(CREATEDIAGRAMS_TASKS)).booleanValue(); 409 319 } catch(MissingResourceException e){ 410 320 co.creatediagrams_tasks = createDiagrams; … … 412 322 try { 413 323 co.creatediagrams_taskswaitingtime = Boolean.valueOf( 414 bundle.getString(CREATEDIAGRAMS_TASKSWAITINGTIME)).booleanValue() && createDiagrams;324 bundle.getString(CREATEDIAGRAMS_TASKSWAITINGTIME)).booleanValue(); 415 325 } catch(MissingResourceException e){ 416 326 co.creatediagrams_taskswaitingtime = createDiagrams; 417 327 } 418 419 328 420 329 try { … … 427 336 428 337 try { 429 co.createaccumulatedresourcesstatistics = Boolean.valueOf(430 bundle.getString(ACCUMULATED_RESOURCES_STATISTICS)).booleanValue();431 } catch(MissingResourceException e){432 co.createaccumulatedresourcesstatistics = true;433 }434 try {435 co.createextendedtasksstatistics = Boolean.valueOf(436 bundle.getString(EXTENDED_TASKS_STATISTICS)).booleanValue();437 } catch(MissingResourceException e){438 co.createextendedtasksstatistics = true;439 }440 try {441 co.creategridlethistorystatistics = Boolean.valueOf(442 bundle.getString(GRIDLET_HISTORY_STATISTICS)).booleanValue();443 } catch(MissingResourceException e){444 co.creategridlethistorystatistics = true;445 }446 try {447 338 co.createjobsstatistics = Boolean.valueOf( 448 339 bundle.getString(JOBS_STATISTICS)).booleanValue(); … … 456 347 co.createsimulationstatistics = true; 457 348 } 458 try { 459 co.formatstatisticsoutput = Boolean.valueOf( 460 bundle.getString(FORMAT_STATISTICS_OUTPUT)).booleanValue(); 461 } catch(MissingResourceException e){ 462 co.formatstatisticsoutput = false; 463 } 464 349 465 350 try { 466 351 co.numberOfSimulations = Integer.valueOf(bundle.getString(NUMBER_OF_SIMULATIONS)).intValue(); … … 469 354 } 470 355 return co; 471 }472 473 /**474 * Creates a new configuration object in the CREATE_SCENARIO mode.475 *476 * @param gridSchedulingPluginName477 * @param forecastFinishTimePluginName478 * @param localAllocPolicyPluginName479 * @param resdescFileName480 * @param taskParamFileName481 * @param outputFolder482 * @param outputWorkloadFileName483 * @param overwriteFiles484 * @param printHistory485 */486 public ConfigurationOptions(String gridSchedulingPluginName,487 String exectimeestimationplugin,488 String localAllocPolicyPluginName, String resdescFileName,489 String taskParamFileName, String outputFolder,490 String outputWorkloadFileName, boolean overwriteFiles,491 boolean printHistory) {492 super();493 this.gridSchedulingPluginName = gridSchedulingPluginName;494 this.exectimeestimationplugin = exectimeestimationplugin;495 this.localAllocPolicyPluginName = localAllocPolicyPluginName;496 this.resdescFileName = resdescFileName;497 this.workloadDescFileName = taskParamFileName;498 this.outputFolder = getSeparatorTerminatedPath(outputFolder);499 this.outputWorkloadFileName = outputWorkloadFileName;500 this.overwriteFiles = overwriteFiles;501 this.printHistory = printHistory;502 503 // the create mode504 this.createScenario = true;505 }506 507 /**508 * Creates a new configuration object in the READ_SCENARIO mode.509 *510 * @param gridSchedulingPluginName511 * @param forecastFinishTimePluginName512 * @param localAllocPolicyPluginName513 * @param resdescFileName514 * @param inputFolder515 * @param inputWorkloadFileName516 * @param overwriteFiles517 * @param printHistory518 */519 public ConfigurationOptions(String gridSchedulingPluginName,520 String exectimeestimationplugin,521 String localAllocPolicyPluginName, String resdescFileName,522 String inputFolder, String inputWorkloadFileName,523 boolean overwriteFiles, boolean printHistory) {524 super();525 this.gridSchedulingPluginName = gridSchedulingPluginName;526 this.exectimeestimationplugin = exectimeestimationplugin;527 this.localAllocPolicyPluginName = localAllocPolicyPluginName;528 this.resdescFileName = resdescFileName;529 this.inputFolder = getSeparatorTerminatedPath(inputFolder);530 this.inputWorkloadFileName = inputWorkloadFileName;531 this.overwriteFiles = overwriteFiles;532 this.printHistory = printHistory;533 //FileHandler.loadDataset(new File("iris.data"), 4, ",");534 // the read mode535 this.createScenario = false;536 356 } 537 357 -
DCWoRMS/trunk/build/classes/simulator/DataCenterWorkloadSimulator.java
r477 r539 1 1 package simulator; 2 2 3 //import eduni.cloudsim.GSSIM;4 3 import java.io.File; 5 4 import java.io.FileReader; … … 26 25 import simulator.reader.ResourceReader; 27 26 import simulator.stats.AccumulatedStatistics; 28 import simulator.stats.implementation. GSSimStatistics;27 import simulator.stats.implementation.DCWormsStatistics; 29 28 import simulator.utils.LogErrStream; 30 29 import simulator.workload.WorkloadLoader; … … 40 39 * {@link #main(String[])} method used to invoke the program. This class also 41 40 * provides second possibility to start the simulator, namely one may use the 42 * {@link #performSimulation(ConfigurationOptions, GSSimStatistics)} method.41 * {@link #performSimulation(ConfigurationOptions, DCWormsStatistics)} method. 43 42 * In this case, the input parameter, describing the simulation options, must be 44 43 * earlier prepared. The results of the simulation can be acquired using the … … 98 97 */ 99 98 public static void main(String[] args) { 100 DataCenterWorkloadSimulator gssim= new DataCenterWorkloadSimulator();101 gssim.run(args);99 DataCenterWorkloadSimulator dcworms = new DataCenterWorkloadSimulator(); 100 dcworms.run(args); 102 101 } 103 102 … … 117 116 @Override 118 117 public String getDescription() { 119 return " WoRMS experiment file";118 return "DCWoRMS experiment file"; 120 119 } 121 120 }; … … 198 197 } 199 198 200 private void runMultiuser(String rootDirPath, DataCenterWorkloadSimulator gssim) {199 private void runMultiuser(String rootDirPath, DataCenterWorkloadSimulator dcworms) { 201 200 throw new RuntimeException("not supported yet"); 202 201 } … … 269 268 rc.setInitList(null); 270 269 271 WormsUsers wl = newWormsUsers("Users",270 DCWormsUsers wl = new DCWormsUsers("Users", 272 271 rc.getScheduler().get_name(), workload); 273 272 … … 275 274 long stopSimulation = System.currentTimeMillis(); 276 275 277 GSSimStatistics stats = new GSSimStatistics(simulationIdentifier,276 DCWormsStatistics stats = new DCWormsStatistics(simulationIdentifier, 278 277 options, wl, statsOutputPath, rc); 279 278 accumulatedStatistics.add(stats); -
DCWoRMS/trunk/build/classes/simulator/GenericUser.java
r477 r539 2 2 3 3 4 import gssim.schedframe.scheduling.utils.JobDescription;5 import gssim.schedframe.scheduling.utils.TaskDescription;6 4 7 5 import java.util.List; 6 7 import dcworms.schedframe.scheduling.utils.JobDescription; 8 import dcworms.schedframe.scheduling.utils.TaskDescription; 8 9 9 10 import schedframe.scheduling.tasks.Job; -
DCWoRMS/trunk/build/classes/simulator/reader/ResourceReader.java
r477 r539 11 11 import java.util.Deque; 12 12 import java.util.HashMap; 13 import java.util.LinkedHashSet; 13 14 import java.util.LinkedList; 14 15 import java.util.List; 15 16 import java.util.Map; 17 import java.util.Set; 16 18 17 19 import org.exolab.castor.types.AnyNode; … … 54 56 private String globalSchedulingPluginName; 55 57 58 private Set<String> compResLayers; 59 56 60 public ResourceReader(ConfigurationOptions options) throws IOException { 57 61 … … 59 63 globalSchedulingPluginName = "example.globalplugin.GridFCFSRoundRobinPlugin"; 60 64 prepareCalendar(); 65 compResLayers = new LinkedHashSet<String>(); 61 66 } 62 67 … … 64 69 UnknownParameter { 65 70 66 //File file = new File("src/test/rewolucja/schemas/example/coolemall/example4.xml");67 71 File file = new File(resDescFileName); 68 //File file = new File("example/tomekp/experiment1/tomExp3.xml");69 /*long s =System.currentTimeMillis();70 System.out.println("start: ");71 List<Processor> list = new ArrayList<Processor>();72 for(int i =0;i<3000000;i++){73 schemas.ComputingResource compResDef = new schemas.ComputingResource();74 compResDef.setName("a"+i);75 compResDef.setClazz("Processor");76 CompResourceDescription resDesc = new CompResourceDescription(compResDef);77 Processor proc = new Processor(resDesc);78 list.add(proc);79 }80 long e = System.currentTimeMillis();81 System.out.println("end: ");82 System.out.println(e-s);*/83 72 Environment env = Environment.unmarshal(new FileReader(file)); 84 73 … … 97 86 ResourceController rc = new ResourceController(mainScheduler, computingResources); 98 87 rc.setInitList(toInit); 88 rc.setCompResLayers(compResLayers); 99 89 return rc; 100 90 } … … 177 167 178 168 List<ComputingResource> mainCompResourceList = new ArrayList<ComputingResource>(); 179 180 169 Deque<ComputingResourceDescription> toExamine = new ArrayDeque<ComputingResourceDescription>(); 181 170 Deque<ComputingResource> resStructure = new ArrayDeque<ComputingResource>(); … … 192 181 ComputingResource parentResource = resStructure.pop(); 193 182 toInit.add(parentResource); 183 compResLayers.add(parentResource.getType().getName()); 194 184 List<AbstractResourceDescription> childrenResDesc = parentResDesc.getChildren(); 195 185 if (childrenResDesc == null){ … … 250 240 //TODO - refactor (remove - create scheduler on the basis of resource description) 251 241 Scheduler mainScheduler = null; 252 if(mainSchedulers.size() == 1 && mainSchedulers.get(0).get_name().equals("grid")){242 if(mainSchedulers.size() == 1 /*&& mainSchedulers.get(0).get_name().equals("grid")*/){ 253 243 mainScheduler = mainSchedulers.get(0); 254 244 } … … 261 251 ManagedResources managedResources = new ManagedResources(mainCompResourceList, new HashMap<ResourceUnitName, List<ResourceUnit>>()); 262 252 mainScheduler = ResourceFactory.createScheduler(StandardResourceType.GS, "grid", schedulingPlugin , execTimeEstimationPlugin, queues, managedResources); 263 /*ManagementSystem ms = new GridBroker("grid", 264 globalSchedulingPluginName, execTimeEstimationPlugin); 265 mainScheduler = new Scheduler(ms, mainCompResourceList);*/ 253 266 254 for(Scheduler lr: mainSchedulers){ 267 255 mainScheduler.addChild(lr); … … 280 268 TaskQueueList queues = new TaskQueueList(1); 281 269 282 if(schedulerDef.getQueue () != null && schedulerDef.getQueueCount() > 0){283 int queueCount = schedulerDef.getQueue Count();270 if(schedulerDef.getQueues()!= null){ 271 int queueCount = schedulerDef.getQueues().getQueueCount(); 284 272 for(int i = 0; i < queueCount; i++){ 285 schemas.QueueType queueDef = schedulerDef.getQueue (i);273 schemas.QueueType queueDef = schedulerDef.getQueues().getQueue(i); 286 274 TaskQueue queue = new TaskQueue(queueDef.getReservation()); 287 275 queue.setName(queueDef.getName()); -
DCWoRMS/trunk/build/classes/simulator/stats/AccumulatedStatistics.java
r477 r539 10 10 import java.util.List; 11 11 12 import simulator.stats.implementation. GSSimStatistics;12 import simulator.stats.implementation.DCWormsStatistics; 13 13 import gridsim.Accumulator; 14 14 -
DCWoRMS/trunk/build/classes/simulator/stats/implementation/GSSAccumulatorsStats.java
r477 r539 10 10 public GSSAccumulator meanQueueLength; 11 11 public GSSAccumulator meanEnergyUsage; 12 public GSSAccumulator meanAirFlow; 12 13 13 14 public GSSAccumulator meanTaskStartTime; … … 29 30 meanReservationLoad = new GSSAccumulator(); 30 31 meanQueueLength = new GSSAccumulator(); 31 meanEnergyUsage = new GSSAccumulator(); 32 meanEnergyUsage = new GSSAccumulator(); 33 meanAirFlow = new GSSAccumulator(); 32 34 33 35 meanTaskStartTime = new GSSAccumulator(); -
DCWoRMS/trunk/build/classes/simulator/stats/implementation/ResourceUsageStats.java
r477 r539 1 1 package simulator.stats.implementation; 2 2 3 import java.util.Map;4 import java.util.TreeMap;5 6 3 import schedframe.resources.ResourceType; 7 import schedframe.resources.StandardResourceType;8 4 import simulator.stats.implementation.out.StatsSerializer; 9 5 10 /** 11 * 12 * @author Marcin Krystek 13 * 14 */ 15 public class ResourceUsageStats implements StatsInterface { 6 public class ResourceUsageStats extends ResourceDynamicStats implements StatsInterface { 16 7 17 protected Map<Long, Integer> usage; 18 protected String resourceName; 19 protected String usageType; 20 protected ResourceType resourceType; 21 protected double meanUsage; 22 23 public void setMeanUsage(double meanUsage) { 24 this.meanUsage = meanUsage; 25 } 26 27 private String[] headers = { "resourceName", "timestamp", "usage" }; 8 private String[] headers = { "resourceName", "timestamp", "utilization" }; 28 9 29 10 public ResourceUsageStats(String resourceName, ResourceType resourceType, String usageType) { 30 this.resourceName = resourceName; 31 this.resourceType = resourceType; 32 this.usageType = usageType; 33 this.usage = new TreeMap<Long, Integer>(); 34 this.meanUsage = 0; 35 } 36 37 public double getMeanUsage() { 38 return meanUsage; 39 } 40 41 public String getResourceName() { 42 return this.resourceName; 43 } 44 45 public ResourceType getResourceType() { 46 return resourceType; 47 } 48 49 public String getUsageType() { 50 return this.usageType; 51 } 52 53 public Map<Long, Integer> getUsage() { 54 return this.usage; 11 super(resourceName, resourceType, usageType); 55 12 } 56 13 … … 62 19 return headers; 63 20 } 64 65 21 } -
DCWoRMS/trunk/build/classes/simulator/stats/implementation/TaskStats.java
r477 r539 1 1 package simulator.stats.implementation; 2 2 3 import gssim.schedframe.scheduling.Executable;4 3 5 4 import java.util.List; 5 6 import dcworms.schedframe.scheduling.Executable; 6 7 7 8 import simulator.stats.implementation.out.StatsSerializer; … … 45 46 46 47 public String getUserDN() { 47 return this.task.getUserD n();48 return this.task.getUserDN(); 48 49 } 49 50 50 51 public String getResName() { 51 String resNames[] = this.task.getAllResourceName(); 52 String resName = ""; 53 for (int i = 0; i < resNames.length; i++) { 54 resName += resNames[i]; 55 if (resNames.length > 1) 56 resName += " "; 57 } 52 String resName = this.task.getSchedulerName(); 53 58 54 return resName; 59 55 } -
DCWoRMS/trunk/build/classes/simulator/stats/implementation/out/StatsSerializer.java
r477 r539 4 4 import simulator.stats.implementation.GSSAccumulatorsStats; 5 5 import simulator.stats.implementation.JobStats; 6 import simulator.stats.implementation.ResourceEnergyStats; 6 import simulator.stats.implementation.ResourceAirFlowStats; 7 import simulator.stats.implementation.ResourcePowerStats; 7 8 import simulator.stats.implementation.ResourceStats; 8 9 import simulator.stats.implementation.ResourceUsageStats; … … 26 27 public Object visit(ResourceUsageStats arg); 27 28 28 public Object visit(Resource EnergyStats arg);29 public Object visit(ResourcePowerStats arg); 29 30 31 public Object visit(ResourceAirFlowStats arg); 30 32 31 33 public Object visit(GSSAccumulatorsStats arg); -
DCWoRMS/trunk/build/classes/simulator/stats/implementation/out/StringSerializer.java
r477 r539 11 11 import simulator.stats.implementation.GSSAccumulatorsStats; 12 12 import simulator.stats.implementation.JobStats; 13 import simulator.stats.implementation.ResourceEnergyStats; 13 import simulator.stats.implementation.ResourceAirFlowStats; 14 import simulator.stats.implementation.ResourcePowerStats; 14 15 import simulator.stats.implementation.ResourceStats; 15 16 import simulator.stats.implementation.ResourceUsageStats; … … 258 259 259 260 public Object visit(ResourceUsageStats resourceUsageStats) { 260 Map<Long, Integer> resourceUsage = resourceUsageStats.getUsage();261 Map<Long, Double> resourceUsage = resourceUsageStats.getHistory(); 261 262 262 263 int mapSize = resourceUsage.size(); … … 297 298 buffer.append(resourceUsageStats.getResourceName()); 298 299 buffer.append(fieldSeparator); 299 Integervalue = resourceUsage.get(timestamp);300 Double value = resourceUsage.get(timestamp); 300 301 buffer.append(timestamp); 301 302 buffer.append(fieldSeparator); … … 306 307 307 308 } 308 309 buffer.append("mean: " + resourceUsageStats.getMeanUsage()); 310 buffer.append(System.getProperty("line.separator")); 311 return buffer.toString(); 312 } 313 314 public Object visit(ResourceEnergyStats resourceEnergyStats) { 315 Map<Long, Double> resourceEnergy = resourceEnergyStats.getEnergy(); 309 if(resourceUsage.size() > 0){ 310 buffer.append("mean: " + resourceUsageStats.getMeanValue()); 311 buffer.append(System.getProperty("line.separator")); 312 } 313 return buffer.toString(); 314 } 315 316 public Object visit(ResourcePowerStats resourceEnergyStats) { 317 Map<Long, Double> resourceEnergy = resourceEnergyStats.getHistory(); 316 318 317 319 int mapSize = resourceEnergy.size(); … … 361 363 362 364 } 363 buffer.append("mean: "+resourceEnergyStats.getMeanUsage() + " sum: " +resourceEnergyStats.getSumUsage()); 364 buffer.append(System.getProperty("line.separator")); 365 366 if(resourceEnergy.size() > 0) { 367 buffer.append("mean: "+resourceEnergyStats.getMeanValue() + " sum: " +resourceEnergyStats.getSumValue()); 368 buffer.append(System.getProperty("line.separator")); 369 } 370 371 return buffer.toString(); 372 } 373 374 public Object visit(ResourceAirFlowStats resourceAirFlowStats) { 375 Map<Long, Double> resourceAirFlow = resourceAirFlowStats.getHistory(); 376 377 int mapSize = resourceAirFlow.size(); 378 /* 379 * FIXME: 380 * Integer.MAX_VALUE = 2147483647. We assume, that each line contains 381 * max 30 signs - this gives max 71582788 lines. If resourceUsage map 382 * contains more elements then we have a problem, because content of 383 * resourceUsage map will not fit in the buffer. 384 * This will need further attention in the future. 385 */ 386 int maxSize = (Integer.MAX_VALUE / 30 ) - 1; 387 if(mapSize >= maxSize){ 388 log.error("Resource usage data is to long to fit in the buffer."); 389 return null; 390 } 391 392 int size = 30 * resourceAirFlow.size(); 393 394 StringBuffer buffer = null; 395 396 if(printedHeaders.add(resourceAirFlowStats.getUsageType())) { 397 buffer = new StringBuffer(size + 42); 398 String[] headers = resourceAirFlowStats.getHeaders(); 399 for(int i = 0; i < headers.length; i++) 400 { 401 buffer.append(headers[i]); 402 buffer.append(fieldSeparator); 403 } 404 buffer.append(System.getProperty("line.separator")); 405 } else { 406 buffer = new StringBuffer(size); 407 } 408 409 410 for (Long timestamp : resourceAirFlow.keySet()) { 411 412 buffer.append(resourceAirFlowStats.getResourceName()); 413 buffer.append(fieldSeparator); 414 Double value = resourceAirFlow.get(timestamp); 415 buffer.append(timestamp); 416 buffer.append(fieldSeparator); 417 buffer.append(DataCenterWorkloadSimulator.DFAULT_NUMBER_FORMAT 418 .format(value)); 419 buffer.append(fieldSeparator); 420 buffer.append(System.getProperty("line.separator")); 421 422 } 423 424 if(resourceAirFlow.size() > 0) { 425 buffer.append("mean: "+resourceAirFlowStats.getMeanValue() + " sum: " +resourceAirFlowStats.getSumValue()); 426 buffer.append(System.getProperty("line.separator")); 427 } 365 428 366 429 return buffer.toString(); -
DCWoRMS/trunk/build/classes/simulator/utils/XsltTransformations.java
r477 r539 1 1 package simulator.utils; 2 2 3 import gssim.schedframe.scheduling.utils.JobDescription;4 import gssim.schedframe.scheduling.utils.TaskDescription;5 3 6 4 import java.io.IOException; … … 20 18 import javax.xml.transform.stream.StreamSource; 21 19 import javax.xml.xpath.XPathExpressionException; 20 21 import dcworms.schedframe.scheduling.utils.JobDescription; 22 import dcworms.schedframe.scheduling.utils.TaskDescription; 22 23 23 24 /** -
DCWoRMS/trunk/build/classes/simulator/workload/WorkloadLoader.java
r477 r539 2 2 3 3 import org.qcg.broker.schemas.jobdesc.QcgJob; 4 import gssim.schedframe.scheduling.utils.JobDescription;5 import gssim.schedframe.scheduling.utils.TaskDescription;6 4 7 5 import java.io.IOException; … … 24 22 import org.exolab.castor.xml.MarshalException; 25 23 import org.exolab.castor.xml.ValidationException; 24 25 import dcworms.schedframe.scheduling.utils.JobDescription; 26 import dcworms.schedframe.scheduling.utils.TaskDescription; 26 27 27 28 -
DCWoRMS/trunk/build/classes/simulator/workload/generator/impl/QcgJobGenerator.java
r477 r539 58 58 import org.xml.sax.InputSource; 59 59 60 import simulator. WormsConstants;60 import simulator.DCWormsConstants; 61 61 import simulator.utils.GSSimXML; 62 62 import simulator.utils.XsltTransformations; … … 259 259 260 260 //initially - a standard value 261 taskCountToBeGenerated = WormsConstants.DEFAULT_TASK_COUNT_IN_SINGLE_JOB;261 taskCountToBeGenerated = DCWormsConstants.DEFAULT_TASK_COUNT_IN_SINGLE_JOB; 262 262 263 263 try {
Note: See TracChangeset
for help on using the changeset viewer.