Changeset 1434 for DCWoRMS/branches
- Timestamp:
- 09/15/14 17:00:03 (11 years ago)
- Location:
- DCWoRMS/branches/coolemall/src
- Files:
-
- 9 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/EnergyExtension.java
r1423 r1434 218 218 } 219 219 220 public AirflowProfile getAir FlowProfile() {220 public AirflowProfile getAirflowProfile() { 221 221 return airflowProfile; 222 222 } -
DCWoRMS/branches/coolemall/src/schedframe/resources/units/ProcessingElements.java
r1423 r1434 227 227 else if(delta < 0) { 228 228 for(int i = this.resources.size() - 1; i >= 0 && delta < 0; i--){ 229 ComputingResource r = this.resources.get(i);230 if( r.getStatus() == ResourceStatus.BUSY){231 if(new JobRegistryImpl( r.getFullName()).getRunningTasks().size() == 0){232 r.setStatus(ResourceStatus.FREE);229 ComputingResource cr = this.resources.get(i); 230 if(cr.getStatus() == ResourceStatus.BUSY){ 231 if(new JobRegistryImpl(cr).getRunningTasks().size() == 0){ 232 cr.setStatus(ResourceStatus.FREE); 233 233 delta++; 234 234 } -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/ResourceItem.java
r1423 r1434 17 17 protected Map<ResourceUnitName, ResourceUnit> usedResources; 18 18 protected Set<String> resourceNames; 19 protected Set<ComputingResource> compResource; 19 20 20 21 public ResourceItem(Map<ResourceUnitName, ResourceUnit> usedResources){ 21 22 this.usedResources = usedResources; 22 23 this.resourceNames = saveResourceNames(); 24 this.compResource = saveResources(); 23 25 } 24 26 … … 29 31 public Set<String> getResourceNames(){ 30 32 return resourceNames; 33 } 34 35 public Set<ComputingResource> getResources(){ 36 return compResource; 31 37 } 32 38 … … 57 63 return resourceNames; 58 64 } 65 66 private Set<ComputingResource> saveResources(){ 67 Set<ComputingResource> compResources; 68 ProcessingElements pes = (ProcessingElements) usedResources.get(StandardResourceUnitName.PE); 69 compResources = new HashSet<ComputingResource>(pes.size(), 1); 70 for (ComputingResource resource: pes) { 71 72 LinkedList<ComputingResource> toExamine = new LinkedList<ComputingResource>(); 73 toExamine.push(resource); 74 75 while (!toExamine.isEmpty()) { 76 ComputingResource compResource = toExamine.pop(); 77 List<ComputingResource> resources = compResource.getChildren(); 78 if(resources.isEmpty()){ 79 if(!compResources.contains(compResource)){ 80 compResources.add(compResource); 81 } 82 } else { 83 for (int i = 0; i < resources.size(); i++) { 84 ComputingResource resourceChild = resources.get(i); 85 toExamine.addLast(resourceChild); 86 } 87 } 88 } 89 } 90 return compResources; 91 } 59 92 } -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/tasks/JobRegistryImpl.java
r1415 r1434 7 7 import java.util.Set; 8 8 9 import org.apache.commons.logging.Log;10 import org.apache.commons.logging.LogFactory;11 9 import org.qcg.broker.schemas.resreqs.ParentType; 12 10 import org.qcg.broker.schemas.resreqs.Workflow; 13 11 import org.qcg.broker.schemas.resreqs.types.TaskStatesName; 14 12 15 import dcworms.schedframe.scheduling.ExecTask;16 17 13 import qcg.shared.constants.BrokerConstants; 18 14 import schedframe.ExecutablesList; 15 import schedframe.resources.computing.ComputingResource; 19 16 import schedframe.scheduling.tasks.JobInterface; 20 17 import schedframe.scheduling.tasks.Task; 18 import dcworms.schedframe.scheduling.ExecTask; 21 19 22 20 public class JobRegistryImpl extends AbstractJobRegistry { 23 21 24 private static Log log = LogFactory.getLog(JobRegistryImpl.class);25 26 22 private String context; 27 23 private ComputingResource cr; 28 24 //TO DO - consider data structure 29 25 protected static final ExecutablesList executables = new ExecutablesList(); 26 30 27 //protected static final List<ExecTask> executables = Collections.synchronizedList(new ArrayList<ExecTask>());; 31 28 //protected static final List<ExecTaskInterface> executables = new CopyOnWriteArrayList<ExecTaskInterface>(); … … 34 31 this.context = context; 35 32 } 36 33 34 public JobRegistryImpl(ComputingResource cr) { 35 this.cr = cr; 36 } 37 38 public JobRegistryImpl() { 39 this(""); 40 } 41 37 42 public boolean addExecTask(ExecTask newTask) { 38 43 if(getTask(newTask.getJobId(), newTask.getId()) == null) { 39 synchronized (executables) 44 synchronized (executables) { 40 45 executables.add(newTask); 41 46 } … … 53 58 for (ExecTask task: executables) { 54 59 if (task.getStatus() == status) { 55 Set<String> visitedResource = task.getAllocatedResources().getLast().getResourceNames();56 for(String res: visitedResource){57 if( res.equals(context) || res.substring(0, res.lastIndexOf("/")).contains(context)){60 if(cr != null){ 61 Set<ComputingResource> visitedResource = task.getAllocatedResources().getLast().getResources(); 62 if(visitedResource.contains(cr)){ 58 63 taskList.add(task); 59 break; 60 } 61 } 62 if(task.getSchedulerName().equals(context)) { 63 taskList.add(task); 64 } 65 } 66 } 67 } 64 } else { 65 for(ComputingResource res: visitedResource){ 66 if(cr.contains(res)){ 67 taskList.add(task); 68 break; 69 } 70 } 71 } 72 } else { 73 Set<String> visitedResource = task.getAllocatedResources().getLast().getResourceNames(); 74 for(String res: visitedResource){ 75 if(res.equals(context) || res.substring(0, res.lastIndexOf("/")).contains(context)){ 76 taskList.add(task); 77 break; 78 } 79 } 80 81 if(task.getSchedulerName().equals(context)) { 82 taskList.add(task); 83 } 84 } 85 } 86 } 87 } 88 68 89 return taskList; 69 90 } -
DCWoRMS/branches/coolemall/src/simulator/stats/implementation/DCWormsStatistics.java
r1423 r1434 133 133 protected static final String STATS_FILE_NAME_PREFIX = "Stats_"; 134 134 135 protected static final String TASK_SEPARATOR = ";"; 136 protected static final String JOB_SEPARATOR = ";"; 135 protected static final String SEPARATOR = ";"; 137 136 138 137 protected String outputFolderName; … … 152 151 153 152 //RESOURCES 154 protected Map<String, List<ResStat>> pesStats; 155 protected Map<String, Double> basicResLoad; 156 157 protected Map<String, TimetableEventSource> peGanttMap; 158 protected Map<String, TimetableEventGroup> taskGanttMap; 159 153 protected Map<ComputingResource, List<ResStat>> peStats; 154 155 160 156 protected Timetable ganttDiagramTimetable; 161 157 protected Map<String, List<XYDataset>> resourcePowerUsageDiagrams; 162 protected Map<String, List<XYDataset>> resourceAir FlowDiagrams;158 protected Map<String, List<XYDataset>> resourceAirflowDiagrams; 163 159 protected Map<String, List<XYDataset>> resourceTemperatureDiagrams; 164 160 protected Map<String, List<XYDataset>> resourceOccupancyDiagrams; … … 173 169 protected TaskSeriesCollection ganttDiagramTaskSeriesCollection; 174 170 protected TaskSeriesCollection ganttDiagramWaitingTimeSeriesCollection; 175 protected Map<String, Set<ComputingResource>> task _processorsMap;176 177 protected JobRegistry j r;171 protected Map<String, Set<ComputingResource>> taskToPEMap; 172 173 protected JobRegistry jobRegistry; 178 174 protected MetricsCalculator metCalc; 179 175 … … 183 179 this.configuration = co; 184 180 this.users = users; 185 186 181 this.outputFolderName = outputFolderName; 187 182 this.resourceController = resourceController; 188 this.j r = new JobRegistryImpl("");183 this.jobRegistry = new JobRegistryImpl(); 189 184 190 185 if(users.isSimStartTimeDefined()) … … 196 191 197 192 init(); 193 } 194 195 private void init() { 196 taskToPEMap = new HashMap<String, Set<ComputingResource>>(jobRegistry.getFinishedTasks().size()); 197 198 statsData = new HashMap<String, DCwormsAccumulator>(2); 199 accStats = new GSSAccumulatorsStats(); 200 201 this.serializer = new StringSerializer(); 202 this.metCalc = new DCwormsMetricsCalculator(startSimulationTime, endSimulationTime, endSimulationTime); 203 204 if(DataCenterWorkloadSimulator.MODE.equals("CoolEmAll")){ 205 this.serializer = new CoolEmAllStringSerializer(); 206 this.metCalc = new CoolEmAllMetricsCalculator(startSimulationTime, endSimulationTime, endSimulationTime); 207 } 208 209 this.serializer.setDefaultNumberFormat(DataCenterWorkloadSimulator.DFAULT_NUMBER_FORMAT); 198 210 } 199 211 … … 225 237 public String getOutputFolderName() { 226 238 return outputFolderName; 227 }228 229 private void init() {230 task_processorsMap = new HashMap<String, Set<ComputingResource>>();231 accStats = new GSSAccumulatorsStats();232 statsData = new HashMap<String, DCwormsAccumulator>();233 234 this.serializer = new StringSerializer();235 this.metCalc = new DCwormsMetricsCalculator(startSimulationTime, endSimulationTime, endSimulationTime);236 237 if(DataCenterWorkloadSimulator.MODE.equals("CoolEmAll")){238 this.serializer = new CoolEmAllStringSerializer();239 this.metCalc = new CoolEmAllMetricsCalculator(startSimulationTime, endSimulationTime, endSimulationTime);240 }241 this.serializer.setDefaultNumberFormat(DataCenterWorkloadSimulator.DFAULT_NUMBER_FORMAT);242 239 } 243 240 … … 273 270 System.out.println("#STATS " + "System load: " + df.format(accStats.meanTotalLoad.getMean() * 100) + " [%]"); 274 271 275 276 272 simulationStatsFile.println(txt); 277 273 } … … 303 299 if(ArrayUtils.contains(configuration.compResForEnergyChart, resourceTypeName)) 304 300 cStats.add(Stats.chartEnergy); 305 cStats.add(Stats.textAir Flow);301 cStats.add(Stats.textAirflow); 306 302 if(ArrayUtils.contains(configuration.compResForAirflowChart, resourceTypeName)) 307 cStats.add(Stats.chartAir Flow);303 cStats.add(Stats.chartAirflow); 308 304 cStats.add(Stats.textTemperature); 309 305 if(ArrayUtils.contains(configuration.compResForTemperatureChart, resourceTypeName)) … … 316 312 resourceUtilizationDiagrams = new HashMap<String, List<XYDataset>>(2); 317 313 resourcePowerUsageDiagrams = new HashMap<String, List<XYDataset>>(2); 318 resourceAir FlowDiagrams = new HashMap<String, List<XYDataset>>(2);314 resourceAirflowDiagrams = new HashMap<String, List<XYDataset>>(2); 319 315 resourceTemperatureDiagrams = new HashMap<String, List<XYDataset>>(2); 320 316 … … 353 349 } 354 350 355 PrintStream air FlowStatsFile = null;351 PrintStream airflowStatsFile = null; 356 352 try { 357 353 File file = new File(outputFolderName + STATS_FILE_NAME_PREFIX 358 354 + simulationIdentifier + "_" 359 355 + AIRFLOW_STATISTICS_OUTPUT_FILE_NAME); 360 air FlowStatsFile = new PrintStream(new FileOutputStream(file));356 airflowStatsFile = new PrintStream(new FileOutputStream(file)); 361 357 } catch (IOException e) { 362 air FlowStatsFile = null;358 airflowStatsFile = null; 363 359 } 364 360 … … 383 379 } 384 380 385 PrintStream nodesAvailabilityStatsFile = null;381 /*PrintStream nodesAvailabilityStatsFile = null; 386 382 try { 387 383 File file = new File(outputFolderName + STATS_FILE_NAME_PREFIX … … 391 387 } catch (IOException e) { 392 388 nodesAvailabilityStatsFile = null; 393 } 389 }*/ 394 390 395 391 PrintStream metricsStatsFile = null; … … 413 409 } 414 410 415 pesStats = gatherPEStatsMulti(jr.getTasks()); 416 peStatsPostProcessing(pesStats); 417 basicResLoad = calculatePELoad(pesStats); 411 peStats = gatherPEStatsMulti(jobRegistry.getTasks()); 412 peStatsPostProcessing(peStats); 418 413 419 414 if (configuration.creatediagrams_gantt) { 420 createPEGanttDiagram(pesStats); 421 } 422 423 List<ComputingResource> compResources = null; 415 createGanttDiagram(peStats); 416 } 417 424 418 for(String resourceTypeName: resourceController.getComputingResourceLayers()){ 425 419 DCwormsAccumulator resourceEnergyAccumulator = new DCwormsAccumulator(); 426 420 DCwormsAccumulator maxResourceEnergyAccumulator = new DCwormsAccumulator(); 427 421 DCwormsAccumulator calculationsEnergyAccumulator = new DCwormsAccumulator(); 428 compResources = new ArrayList<ComputingResource>();422 List<ComputingResource> compResources = new ArrayList<ComputingResource>(); 429 423 for(ComputingResource compRes: resourceController.getComputingResources() ){ 430 424 compResources.addAll(compRes.getDescendantsByType(new CustomResourceType(resourceTypeName))); … … 439 433 ResourceUsageStats resourceOccupancy = null; 440 434 ResourcePowerStats energyUsage = null; 441 ResourceAir FlowStats airFlow = null;435 ResourceAirflowStats airflow = null; 442 436 ResourceTemperatureStats temperature = null; 443 437 ResourceUsefulWorkStats usefulWork = null; 438 444 439 if(type_stats.get(resourceTypeName).contains(Stats.textLoad)){ 445 resourceOccupancy = gatherResourceOccupancyStats(compResource, pe sStats);440 resourceOccupancy = gatherResourceOccupancyStats(compResource, peStats); 446 441 resourceOccupancy.setMeanValue(calculateMeanValue(resourceOccupancy)); 447 442 if (resourceOccupancyStatsFile != null) { … … 457 452 } 458 453 } 454 459 455 if(type_stats.get(resourceTypeName).contains(Stats.chartLoad)){ 460 456 if (configuration.creatediagrams_resutilization) { … … 463 459 } 464 460 } 461 465 462 if(type_stats.get(resourceTypeName).contains(Stats.textEnergy)){ 466 463 energyUsage = gatherResourcePowerConsumptionStats(compResource); … … 548 545 } 549 546 } 547 550 548 if(type_stats.get(resourceTypeName).contains(Stats.chartEnergy)){ 551 549 if (configuration.creatediagrams_respowerusage) { … … 553 551 } 554 552 } 555 556 if(type_stats.get(resourceTypeName).contains(Stats.textAir Flow)){557 air Flow = gatherResourceAirFlowStats(compResource);558 air Flow.setMeanValue(calculateMeanValue(airFlow));559 air Flow.setSumValue(airFlow.getMeanValue() * (endSimulationTime - startSimulationTime) / (60 * MILLI_SEC));553 554 if(type_stats.get(resourceTypeName).contains(Stats.textAirflow)){ 555 airflow = gatherResourceAirflowStats(compResource); 556 airflow.setMeanValue(calculateMeanValue(airflow)); 557 airflow.setSumValue(airflow.getMeanValue() * (endSimulationTime - startSimulationTime) / (60 * MILLI_SEC)); 560 558 561 559 EnergyExtension een = (EnergyExtension)(compResource.getExtensionList().getExtension(ExtensionType.ENERGY_EXTENSION)); 562 560 if(resourceController.getComputingResources().contains(compResource)) { 563 if( een != null && een.getAir FlowProfile() != null && een.getPowerProfile().getEnergyEstimationPlugin() != null){564 accStats.meanAir Flow.add(airFlow.getMeanValue());561 if( een != null && een.getAirflowProfile() != null && een.getPowerProfile().getEnergyEstimationPlugin() != null){ 562 accStats.meanAirflow.add(airflow.getMeanValue()); 565 563 } 566 564 567 } else if( een != null && een.getAir FlowProfile() != null ){565 } else if( een != null && een.getAirflowProfile() != null ){ 568 566 ComputingResource parent = compResource.getParent(); 569 567 een = (EnergyExtension)(parent.getExtensionList().getExtension(ExtensionType.ENERGY_EXTENSION)); 570 568 boolean top = true; 571 569 while(parent != null){ 572 if(een != null && een.getAir FlowProfile() != null) {570 if(een != null && een.getAirflowProfile() != null) { 573 571 top = false; 574 572 break; … … 577 575 } 578 576 if(top == true){ 579 accStats.meanAir Flow.add(airFlow.getMeanValue());577 accStats.meanAirflow.add(airflow.getMeanValue()); 580 578 } 581 579 } 582 if (air FlowStatsFile != null) {583 Object txt = air Flow.serialize(serializer);584 air FlowStatsFile.print(txt);580 if (airflowStatsFile != null) { 581 Object txt = airflow.serialize(serializer); 582 airflowStatsFile.print(txt); 585 583 } 586 584 587 585 for(Device device: compResource.getResourceCharacteristic().getDevices()){ 588 ResourceAir FlowStats deviceAirFlow = gatherResourceAirFlowStats(device);589 deviceAir Flow.setMeanValue(calculateMeanValue(deviceAirFlow));590 deviceAir Flow.setSumValue(deviceAirFlow.getMeanValue() * (endSimulationTime - startSimulationTime) / (60 * MILLI_SEC));586 ResourceAirflowStats deviceAirflow = gatherResourceAirflowStats(device); 587 deviceAirflow.setMeanValue(calculateMeanValue(deviceAirflow)); 588 deviceAirflow.setSumValue(deviceAirflow.getMeanValue() * (endSimulationTime - startSimulationTime) / (60 * MILLI_SEC)); 591 589 592 590 if (deviceStatsFile != null) { 593 Object txt = deviceAir Flow.serialize(serializer);591 Object txt = deviceAirflow.serialize(serializer); 594 592 deviceStatsFile.print(txt); 595 593 } … … 597 595 if(ArrayUtils.contains(configuration.compResForAirflowChart, device.getType().getName())){ 598 596 if (configuration.creatediagrams_resairflow) { 599 createResourceAir FlowDiagramData(deviceAirFlow);597 createResourceAirflowDiagramData(deviceAirflow); 600 598 } 601 599 } 602 600 } 603 601 } 604 if(type_stats.get(resourceTypeName).contains(Stats.chartAirFlow)){ 602 603 if(type_stats.get(resourceTypeName).contains(Stats.chartAirflow)){ 605 604 606 605 if (configuration.creatediagrams_resairflow) { 607 createResourceAir FlowDiagramData(airFlow);606 createResourceAirflowDiagramData(airflow); 608 607 } 609 608 } 610 609 611 610 if(type_stats.get(resourceTypeName).contains(Stats.textTemperature)){ 612 611 temperature = gatherResourceTemperatureStats(compResource); … … 657 656 } 658 657 } 658 659 659 if(type_stats.get(resourceTypeName).contains(Stats.chartTemperature)){ 660 660 if (configuration.creatediagrams_restemperature) { … … 662 662 } 663 663 } 664 664 665 665 if(type_stats.get(resourceTypeName).contains(Stats.textLoad)){ 666 666 usefulWork = gatherResourceUsefulWorkStats(compResource); … … 670 670 } 671 671 } 672 673 674 if (nodesAvailabilityStatsFile != null) { 672 /*if (nodesAvailabilityStatsFile != null) { 675 673 ResourceAvailabilityStats ras = new ResourceAvailabilityStats(compResource.getFullName(), compResource.getType(), "availableNodes", compResource.getChildren().size(), endSimulationTime); 676 674 Object txt = ras.serialize(serializer); … … 679 677 txt = ras.serialize(serializer); 680 678 nodesAvailabilityStatsFile.print(txt); 681 } 679 }*/ 682 680 683 681 } … … 708 706 temperatureStatsFile.close(); 709 707 } 710 if (air FlowStatsFile != null) {711 air FlowStatsFile.close();708 if (airflowStatsFile != null) { 709 airflowStatsFile.close(); 712 710 } 713 711 if (energyStatsFile != null) { … … 728 726 } 729 727 730 if (nodesAvailabilityStatsFile != null) {728 /*if (nodesAvailabilityStatsFile != null) { 731 729 nodesAvailabilityStatsFile.close(); 732 } 730 }*/ 733 731 734 732 if (metricsStatsFile != null) { … … 739 737 740 738 741 private void peStatsPostProcessing(Map< String, List<ResStat>> basicResStats){739 private void peStatsPostProcessing(Map<ComputingResource, List<ResStat>> basicResStats){ 742 740 ResourceType resType = null; 743 741 744 for( String key: basicResStats.keySet()){745 List<ResStat> resStats = basicResStats.get( key);742 for(ComputingResource pe: basicResStats.keySet()){ 743 List<ResStat> resStats = basicResStats.get(pe); 746 744 resType = resStats.get(0).getResType(); 747 745 break; … … 757 755 } 758 756 for(ComputingResource resource: resources){ 759 if(!basicResStats.containsKey(resource.getFullName())){ 760 basicResStats.put(resource.getFullName(), new ArrayList<ResStat>()); 761 } 762 } 763 } 764 765 private Map<String, List<ResStat>> gatherPEStats(ExecutablesList executables) { 766 767 Map<String, List<ResStat>> basicResStats = new TreeMap<String, List<ResStat>>(new MapPEIdComparator()); 757 if(!basicResStats.containsKey(resource)){ 758 basicResStats.put(resource, new ArrayList<ResStat>()); 759 } 760 } 761 } 762 763 //TO DELETE 764 /*private Map<ComputingResource, List<ResStat>> gatherPEStats(ExecutablesList executables) { 765 766 Map<ComputingResource, List<ResStat>> basicResStats = new TreeMap<ComputingResource, List<ResStat>>(new peIdComparator()); 768 767 for (ExecTask execTask:executables) { 769 768 Executable exec = (Executable) execTask; … … 787 786 ResStat resStat = new ResStat(peName, pe.getType(), startDate, endDate, appID); 788 787 789 List<ResStat> resStats = basicResStats.get(pe Name);788 List<ResStat> resStats = basicResStats.get(pe); 790 789 if (resStats == null) { 791 790 resStats = new ArrayList<ResStat>(); 792 791 resStats.add(resStat); 793 basicResStats.put(pe Name, resStats);792 basicResStats.put(pe, resStats); 794 793 } else { 795 794 resStats.add(resStat); … … 798 797 String uniqueTaskID = getUniqueTaskId(execTask); 799 798 800 Set<ComputingResource> peNames = task _processorsMap.get(uniqueTaskID);799 Set<ComputingResource> peNames = taskToPEMap.get(uniqueTaskID); 801 800 if (peNames == null) { 802 801 peNames = new HashSet<ComputingResource>(); 803 802 peNames.add(pe); 804 task _processorsMap.put(uniqueTaskID, peNames);803 taskToPEMap.put(uniqueTaskID, peNames); 805 804 } else { 806 805 peNames.add(pe); … … 827 826 } 828 827 return basicResStats; 829 } 830 831 private Map< String, List<ResStat>> gatherPEStatsMulti(ExecutablesList executables) {832 833 Map< String, List<ResStat>> basicResStats = new TreeMap<String, List<ResStat>>(new MapPEIdComparator());828 }*/ 829 830 private Map<ComputingResource, List<ResStat>> gatherPEStatsMulti(ExecutablesList executables) { 831 832 Map<ComputingResource, List<ResStat>> basicResStats = new TreeMap<ComputingResource, List<ResStat>>(new peIdComparator()); 834 833 for (ExecTask execTask:executables) { 835 834 Executable exec = (Executable) execTask; … … 839 838 continue; 840 839 841 for(int i = 0; i < resourceHistory 840 for(int i = 0; i < resourceHistory.size(); i++){ 842 841 ResourceItem resHistItem = resourceHistory.get(i); 843 842 Map<ResourceUnitName, ResourceUnit> res = resHistItem.getResourceUnits(); … … 875 874 ResStat resStat = new ResStat(peName, pe.getType(), startDate, endDate, appID); 876 875 877 List<ResStat> resStats = basicResStats.get(pe Name);876 List<ResStat> resStats = basicResStats.get(pe); 878 877 if (resStats == null) { 879 878 resStats = new ArrayList<ResStat>(); 880 879 resStats.add(resStat); 881 basicResStats.put(pe Name, resStats);880 basicResStats.put(pe, resStats); 882 881 } else { 883 882 resStats.add(resStat); … … 886 885 String uniqueTaskID = getUniqueTaskId(execTask); 887 886 888 Set<ComputingResource> peNames = task _processorsMap.get(uniqueTaskID);887 Set<ComputingResource> peNames = taskToPEMap.get(uniqueTaskID); 889 888 if (peNames == null) { 890 889 peNames = new HashSet<ComputingResource>(); 891 890 peNames.add(pe); 892 task _processorsMap.put(uniqueTaskID, peNames);891 taskToPEMap.put(uniqueTaskID, peNames); 893 892 } else { 894 893 peNames.add(pe); … … 910 909 911 910 } 912 913 911 } 914 912 } … … 949 947 } 950 948 951 952 private ResourceUsageStats gatherResourceOccupancyStats(ComputingResource resource, Map<String, List<ResStat>> basicStats) {949 //TO DELETE 950 /*private ResourceUsageStats gatherResourceOccupancyStatsOld(ComputingResource resource, Map<String, List<ResStat>> basicStats) { 953 951 String usageType = null; 954 if(resource.getResourceCharacteristic().getParameters().get("load-sensor") != null){952 if(resource.getResourceCharacteristic().getParameters().get("load-sensor") != null){ 955 953 usageType = resource.getResourceCharacteristic().getParameters().get("load-sensor").get(0).getContent(); 956 954 } 957 955 ResourceUsageStats usageStats = new ResourceUsageStats(resource.getFullName(), resource.getType(), usageType); 958 956 int cnt = 0; 957 System.out.println("a: " + System.currentTimeMillis()); 959 958 for(String resName: basicStats.keySet()){ 960 959 … … 964 963 } 965 964 } 965 System.out.println("b: " + System.currentTimeMillis()); 966 966 for(Long key: usageStats.getHistory().keySet()){ 967 967 Double value = usageStats.getHistory().get(key)/cnt; … … 971 971 return usageStats; 972 972 } 973 974 private ResourceUsageStats gatherResourceOccupancyStats New(ComputingResource resource, Map<String, List<ResStat>> basicStats) {973 */ 974 private ResourceUsageStats gatherResourceOccupancyStats(ComputingResource compRes, Map<ComputingResource, List<ResStat>> basicStats) { 975 975 976 976 String usageType = null; 977 if( resource.getResourceCharacteristic().getParameters().get("load-sensor")!= null){978 usageType = resource.getResourceCharacteristic().getParameters().get("load-sensor").get(0).getContent();979 } 980 ResourceUsageStats usageStats = new ResourceUsageStats( resource.getFullName(), resource.getType(), usageType);977 if(compRes.getResourceCharacteristic().getParameters().get("load-sensor")!= null){ 978 usageType = compRes.getResourceCharacteristic().getParameters().get("load-sensor").get(0).getContent(); 979 } 980 ResourceUsageStats usageStats = new ResourceUsageStats(compRes.getFullName(), compRes.getType(), usageType); 981 981 int cnt = 0; 982 983 ResourceType resType = null; 984 985 for(String key: basicStats.keySet()){ 986 List<ResStat> resStats = basicStats.get(key); 987 resType = resStats.get(0).getResType(); 988 break; 989 } 990 List<ComputingResource> resources = null; 991 try { 992 resources = new ArrayList<ComputingResource>(); 993 for(ComputingResource compRes: resourceController.getComputingResources()){ 994 resources.addAll(compRes.getDescendantsByType(resType)); 995 } 996 } catch (Exception e) { 997 998 } 999 1000 List<String> resourcesNames = new ArrayList<String>(resources.size()); 1001 for(ComputingResource compRes: resources){ 1002 resourcesNames.add(compRes.getFullName()); 1003 } 1004 1005 1006 for(String resName: basicStats.keySet()){ 1007 if( resourcesNames.contains(resName) || resource.getFullName().compareTo(resName) == 0){ 1008 createResourceLoadData(usageStats, basicStats.get(resName)); 982 983 if(basicStats.containsKey(compRes)){ 984 createResourceLoadData(usageStats, basicStats.get(compRes)); 985 cnt++; 986 } else { 987 for(ComputingResource pe: basicStats.keySet()){ 988 if(compRes.contains(pe)){ 989 createResourceLoadData(usageStats, basicStats.get(pe)); 1009 990 cnt++; 1010 991 } 1011 } 992 } 993 } 994 1012 995 for(Long key: usageStats.getHistory().keySet()){ 1013 996 Double value = usageStats.getHistory().get(key)/cnt; … … 1022 1005 int usedResources = 0; 1023 1006 for(ComputingResource compResource: resource.getChildren()){ 1024 double meanLoad = calculateMeanValue(gatherResourceOccupancyStats(compResource, pe sStats));1007 double meanLoad = calculateMeanValue(gatherResourceOccupancyStats(compResource, peStats)); 1025 1008 if(meanLoad > 0){ 1026 1009 usedResources++; … … 1034 1017 String usageType = "usefulWork"; 1035 1018 double usefulWork = 0; 1036 JobRegistry jr = new JobRegistryImpl(compResource .getFullName());1019 JobRegistry jr = new JobRegistryImpl(compResource); 1037 1020 for(ExecTask task: jr.getFinishedTasks()){ 1038 1021 usefulWork = usefulWork + task.getExecutionProfile().getUsefulWork(); … … 1162 1145 } 1163 1146 1164 private ResourceAir FlowStats gatherResourceAirFlowStats(PhysicalResource resource) {1147 private ResourceAirflowStats gatherResourceAirflowStats(PhysicalResource resource) { 1165 1148 1166 1149 String usageType = null; … … 1168 1151 usageType = resource.getResourceCharacteristic().getParameters().get("airflow_volume-sensor").get(0).getContent(); 1169 1152 } 1170 ResourceAir FlowStats resAirFlow = new ResourceAirFlowStats(resource.getFullName(), resource.getType(), usageType);1171 Map<Long, Double> air Flow = resAirFlow.getHistory();1153 ResourceAirflowStats resAirflow = new ResourceAirflowStats(resource.getFullName(), resource.getType(), usageType); 1154 Map<Long, Double> airflow = resAirflow.getHistory(); 1172 1155 1173 1156 ExtensionList extensionList = resource.getExtensionList(); … … 1176 1159 if (extension.getType() == ExtensionType.ENERGY_EXTENSION) { 1177 1160 EnergyExtension ee = (EnergyExtension)extension; 1178 if(ee.getAir FlowProfile() == null)1161 if(ee.getAirflowProfile() == null) 1179 1162 break; 1180 List<AirflowValue> air FlowHistory = ee.getAirFlowProfile().getAirflowHistory();1181 if(air FlowHistory.size() == 0)1163 List<AirflowValue> airflowHistory = ee.getAirflowProfile().getAirflowHistory(); 1164 if(airflowHistory.size() == 0) 1182 1165 break; 1183 1166 long endSimulationTime = DateTimeUtilsExt.currentTimeMillis(); 1184 air FlowHistory.add(new AirflowValue(endSimulationTime, ee.getAirFlowProfile().getAirflowHistory().get(ee.getAirFlowProfile().getAirflowHistory().size()-1).getValue()));1185 for(AirflowValue af:air FlowHistory){1186 air Flow.put(af.getTimestamp(), af.getValue());1167 airflowHistory.add(new AirflowValue(endSimulationTime, ee.getAirflowProfile().getAirflowHistory().get(ee.getAirflowProfile().getAirflowHistory().size()-1).getValue())); 1168 for(AirflowValue af:airflowHistory){ 1169 airflow.put(af.getTimestamp(), af.getValue()); 1187 1170 } 1188 1171 } 1189 1172 } 1190 1173 } 1191 return resAir Flow;1174 return resAirflow; 1192 1175 } 1193 1176 … … 1293 1276 } 1294 1277 1295 private void createResourceAir FlowDiagramData(ResourceDynamicStats airFlowStats) {1296 1297 XYDataset dataset = createResourceChartDataSet(air FlowStats,1278 private void createResourceAirflowDiagramData(ResourceDynamicStats airflowStats) { 1279 1280 XYDataset dataset = createResourceChartDataSet(airflowStats, 1298 1281 startSimulationTime, endSimulationTime); 1299 1282 1300 List<XYDataset> air FlowDiagramData = resourceAirFlowDiagrams.get(airFlowStats.getResourceType().getName());1301 if(air FlowDiagramData == null){1302 air FlowDiagramData = new ArrayList<XYDataset>();1303 air FlowDiagramData.add(dataset);1304 resourceAir FlowDiagrams.put(airFlowStats.getResourceType().getName(), airFlowDiagramData);1283 List<XYDataset> airflowDiagramData = resourceAirflowDiagrams.get(airflowStats.getResourceType().getName()); 1284 if(airflowDiagramData == null){ 1285 airflowDiagramData = new ArrayList<XYDataset>(); 1286 airflowDiagramData.add(dataset); 1287 resourceAirflowDiagrams.put(airflowStats.getResourceType().getName(), airflowDiagramData); 1305 1288 } else { 1306 air FlowDiagramData.add(dataset);1289 airflowDiagramData.add(dataset); 1307 1290 } 1308 1291 } … … 1399 1382 chartName = "Air flow diagram for " 1400 1383 + DataCenterWorkloadSimulator.SIMULATOR_NAME; 1401 JFreeChart resourceAir FlowDiagram = null;1384 JFreeChart resourceAirflowDiagram = null; 1402 1385 if (configuration.creatediagrams_resairflow) { 1403 1386 String axisName = "AIR FLOW [m^3/min]"; 1404 for(String resType: resourceAir FlowDiagrams.keySet()){1405 resourceAir FlowDiagram = getResourceDynamicDiagram(resourceAirFlowDiagrams.get(resType), simulationTime, chartName,1387 for(String resType: resourceAirflowDiagrams.keySet()){ 1388 resourceAirflowDiagram = getResourceDynamicDiagram(resourceAirflowDiagrams.get(resType), simulationTime, chartName, 1406 1389 subtitle, axisName); 1407 if (!saveXYPlotChart(resourceAir FlowDiagram, fileName + "Airflow_" + resType))1390 if (!saveXYPlotChart(resourceAirflowDiagram, fileName + "Airflow_" + resType)) 1408 1391 return false; 1409 1392 } … … 1524 1507 } 1525 1508 1526 private void create PEGanttDiagram(Map<String,List<ResStat>> basicResStats) {1527 peGanttMap = new HashMap<String, TimetableEventSource>();1528 taskGanttMap = new HashMap<String, TimetableEventGroup>();1529 for( String peName: basicResStats.keySet()){1530 TimetableEventSource pe = new TimetableEventSource(peName);1531 ganttDiagramTimetable.addEventSource(pe );1532 peGanttMap.put(pe Name, pe);1533 for(ResStat resStat: basicResStats.get(pe Name)){1534 1535 pe = peGanttMap.get(resStat.getPeName());1536 if(pe == null){1509 private void createGanttDiagram(Map<ComputingResource, List<ResStat>> basicResStats) { 1510 Map<String, TimetableEventSource> peGanttMap = new HashMap<String, TimetableEventSource>(); 1511 Map<String, TimetableEventGroup> taskGanttMap = new HashMap<String, TimetableEventGroup>(); 1512 for(ComputingResource pe: basicResStats.keySet()){ 1513 TimetableEventSource peES = new TimetableEventSource(pe.getFullName()); 1514 ganttDiagramTimetable.addEventSource(peES); 1515 peGanttMap.put(pe.getFullName(), peES); 1516 for(ResStat resStat: basicResStats.get(pe)){ 1517 1518 peES = peGanttMap.get(resStat.getPeName()); 1519 if(peES == null){ 1537 1520 //pe = new TimetableEventSource(resStat.getPeName()); 1538 1521 // ganttDiagramPeTimetable.addEventSource(pe); 1539 1522 // peGanttMap.put(resStat.getPeName(), pe); 1540 1523 } 1541 TimetableEventGroup task = taskGanttMap.get(resStat.getTaskID());1524 TimetableEventGroup taskEG = taskGanttMap.get(resStat.getTaskID()); 1542 1525 long startDate = resStat.getStartDate(); 1543 1526 long endDate = resStat.getEndDate(); 1544 if (task == null) {1545 task = new TimetableEventGroup(resStat.getTaskID());1546 taskGanttMap.put(resStat.getTaskID(), task );1547 ganttDiagramTimetable.addEventGroup(task );1527 if (taskEG == null) { 1528 taskEG = new TimetableEventGroup(resStat.getTaskID()); 1529 taskGanttMap.put(resStat.getTaskID(), taskEG); 1530 ganttDiagramTimetable.addEventGroup(taskEG); 1548 1531 } 1549 ganttDiagramTimetable.addEvent(pe , task,1532 ganttDiagramTimetable.addEvent(peES, taskEG, 1550 1533 new FixedMillisecond(startDate), new FixedMillisecond(endDate)); 1551 1534 } … … 1556 1539 //TO DO 1557 1540 private void createAccumulatedResourceSimulationStatistic() { 1541 Map<ComputingResource, Double> basicResLoad = calculatePELoad(peStats); 1558 1542 1559 1543 List<ComputingResource> resources = resourceController.getComputingResources(); … … 1575 1559 } 1576 1560 1577 private Map< String, Double> calculatePELoad(Map<String, List<ResStat>> basicResStats){1578 Map< String, Double> peLoad = new HashMap<String, Double>();1579 for( String resName: basicResStats.keySet()){1580 List<ResStat> resStats = basicResStats.get( resName);1561 private Map<ComputingResource, Double> calculatePELoad(Map<ComputingResource, List<ResStat>> basicResStats){ 1562 Map<ComputingResource, Double> peLoad = new HashMap<ComputingResource, Double>(); 1563 for(ComputingResource compRes: basicResStats.keySet()){ 1564 List<ResStat> resStats = basicResStats.get(compRes); 1581 1565 double sum = 0; 1582 1566 for(ResStat resStat:resStats){ … … 1584 1568 } 1585 1569 double load = sum / (endSimulationTime - startSimulationTime); 1586 peLoad.put( resName, load);1570 peLoad.put(compRes, load); 1587 1571 } 1588 1572 return peLoad; 1589 1573 } 1590 1574 1591 private Double calculateResourceLoad(ComputingResource resource, Map<String, Double> peLoad ){1575 private Double calculateResourceLoad(ComputingResource compRes, Map<ComputingResource, Double> peLoad ){ 1592 1576 int peCnt = 0; 1593 1577 double sum = 0; 1594 for( String resName: peLoad.keySet()){1595 1596 if( resource.getDescendantByName(resName) != null || resource.getFullName().compareTo(resName) == 0){1597 Double load = peLoad.get( resName);1578 for(ComputingResource pe: peLoad.keySet()){ 1579 1580 if(compRes.contains(pe)){ 1581 Double load = peLoad.get(pe); 1598 1582 sum += load; 1599 1583 peCnt++; … … 1674 1658 Job job = (Job) jobs.get(i); 1675 1659 1676 List<ExecTask> execList = j r.getTasks().getExecutables(job.getId());1660 List<ExecTask> execList = jobRegistry.getTasks().getExecutables(job.getId()); 1677 1661 List<TaskStats> taskStatsList = new ArrayList<TaskStats>(); 1678 1662 1679 this.serializer.setFieldSeparator( TASK_SEPARATOR);1663 this.serializer.setFieldSeparator(SEPARATOR); 1680 1664 1681 1665 for (int j = 0; j < execList.size(); j++) { … … 1706 1690 if (configuration.createjobsstatistics && taskStatsList.size() > 0) { 1707 1691 1708 this.serializer.setFieldSeparator( JOB_SEPARATOR);1692 this.serializer.setFieldSeparator(SEPARATOR); 1709 1693 JobStats jobStats = createJobStats(taskStatsList); 1710 1694 if (jobStatsFile != null) { … … 1756 1740 TaskStats taskStats = new TaskStats(task, startSimulationTime); 1757 1741 String uniqueTaskID = getUniqueTaskId(task); 1758 taskStats.setProcessors(task _processorsMap.get(uniqueTaskID));1742 taskStats.setProcessors(taskToPEMap.get(uniqueTaskID)); 1759 1743 return taskStats; 1760 1744 } … … 2016 2000 } 2017 2001 2018 private static class MapPEIdComparator implements Comparator<String> {2019 2020 public int compare( String o1, Stringo2) {2002 private static class peIdComparator implements Comparator<ComputingResource> { 2003 2004 public int compare(ComputingResource o1, ComputingResource o2) { 2021 2005 Integer o1int = 0; 2022 2006 Integer o2int = 0; 2023 String o1string ;2007 String o1string = null; 2024 2008 String o2string = null; 2025 2026 if(o1.contains("_")){ 2027 o1string = o1.substring(0, o1.lastIndexOf("_")); 2028 o1int = Integer.parseInt(o1.substring(o1.lastIndexOf("_")+1)); 2029 } else { 2030 o1string = o1; 2031 } 2032 2033 if(o2.contains("_")){ 2034 o2string = o2.substring(0, o2.lastIndexOf("_")); 2035 o2int = Integer.parseInt(o2.substring(o2.lastIndexOf("_")+1)); 2036 }else { 2037 o2string = o2; 2038 } 2009 try { 2010 if(o1.getFullName().contains("_")){ 2011 o1string = o1.getFullName().substring(0, o1.getFullName().lastIndexOf("_")); 2012 o1int = Integer.parseInt(o1.getFullName().substring(o1.getFullName().lastIndexOf("_") + 1)); 2013 } else { 2014 o1string = o1.getFullName(); 2015 } 2016 2017 if(o2.getFullName().contains("_")){ 2018 o2string = o2.getFullName().substring(0, o2.getFullName().lastIndexOf("_")); 2019 o2int = Integer.parseInt(o2.getFullName().substring(o2.getFullName().lastIndexOf("_") + 1)); 2020 }else { 2021 o2string = o2.getFullName(); 2022 } 2023 } catch (Exception e) { 2024 o1int = 0; 2025 o2int = 0; 2026 o1string = o1.getFullName(); 2027 o2string = o2.getFullName(); 2028 } 2029 2039 2030 2040 2031 if(o1int.compareTo(o2int) != 0) … … 2077 2068 2078 2069 public ResStat(String peName, long startDate, long endDate, String taskID) { 2079 super();2080 2070 this.startDate = startDate; 2081 2071 this.endDate = endDate; … … 2090 2080 } 2091 2081 public ResStat(String peName, ResourceType resType, long startDate, long endDate, String taskID) { 2092 super();2093 2082 this.peName = peName; 2094 2083 this.resType = resType; … … 2116 2105 textEnergy, 2117 2106 chartEnergy, 2118 textAir Flow,2119 chartAir Flow,2107 textAirflow, 2108 chartAirflow, 2120 2109 textTemperature, 2121 2110 chartTemperature, -
DCWoRMS/branches/coolemall/src/simulator/stats/implementation/GSSAccumulatorsStats.java
r1396 r1434 10 10 public DCwormsAccumulator meanQueueLength; 11 11 public DCwormsAccumulator meanEnergyUsage; 12 public DCwormsAccumulator meanAir Flow;12 public DCwormsAccumulator meanAirflow; 13 13 public DCwormsAccumulator meanTemperature; 14 14 … … 32 32 meanQueueLength = new DCwormsAccumulator(); 33 33 meanEnergyUsage = new DCwormsAccumulator(); 34 meanAir Flow = new DCwormsAccumulator();34 meanAirflow = new DCwormsAccumulator(); 35 35 meanTemperature = new DCwormsAccumulator(); 36 36 -
DCWoRMS/branches/coolemall/src/simulator/stats/implementation/ResourceAirflowStats.java
r1207 r1434 4 4 import simulator.stats.implementation.out.StatsSerializer; 5 5 6 public class ResourceAir FlowStats extends ResourceDynamicStats implements StatsInterface{6 public class ResourceAirflowStats extends ResourceDynamicStats implements StatsInterface{ 7 7 8 8 protected double sumValue; 9 9 10 private String[] headers = { "resourceName", "timestamp", "air Flow" };10 private String[] headers = { "resourceName", "timestamp", "airflow" }; 11 11 12 public ResourceAir FlowStats (String resourceName, ResourceType resourceType, String usageType) {12 public ResourceAirflowStats (String resourceName, ResourceType resourceType, String usageType) { 13 13 super(resourceName, resourceType, usageType); 14 14 if(usageType == null){ -
DCWoRMS/branches/coolemall/src/simulator/stats/implementation/out/CoolEmAllStringSerializer.java
r1396 r1434 11 11 import schedframe.resources.StandardResourceType; 12 12 import simulator.stats.implementation.MetricsStats; 13 import simulator.stats.implementation.ResourceAir FlowStats;13 import simulator.stats.implementation.ResourceAirflowStats; 14 14 import simulator.stats.implementation.ResourceAvailabilityStats; 15 15 import simulator.stats.implementation.ResourceHistoryStats; … … 139 139 } 140 140 141 public Object visit(ResourceAir FlowStats resourceAirFlowStats) {141 public Object visit(ResourceAirflowStats resourceAirFlowStats) { 142 142 Map<Long, Double> resourceAirFlow = resourceAirFlowStats.getHistory(); 143 143 //String nodeMetricName = "airflow_volume"; -
DCWoRMS/branches/coolemall/src/simulator/stats/implementation/out/StatsSerializer.java
r1207 r1434 5 5 import simulator.stats.implementation.JobStats; 6 6 import simulator.stats.implementation.MetricsStats; 7 import simulator.stats.implementation.ResourceAir FlowStats;7 import simulator.stats.implementation.ResourceAirflowStats; 8 8 import simulator.stats.implementation.ResourceAvailabilityStats; 9 9 import simulator.stats.implementation.ResourceHistoryStats; … … 34 34 public Object visit(ResourcePowerStats arg); 35 35 36 public Object visit(ResourceAir FlowStats arg);36 public Object visit(ResourceAirflowStats arg); 37 37 38 38 public Object visit(ResourceTemperatureStats arg); -
DCWoRMS/branches/coolemall/src/simulator/stats/implementation/out/StringSerializer.java
r1207 r1434 12 12 import simulator.stats.implementation.JobStats; 13 13 import simulator.stats.implementation.MetricsStats; 14 import simulator.stats.implementation.ResourceAir FlowStats;14 import simulator.stats.implementation.ResourceAirflowStats; 15 15 import simulator.stats.implementation.ResourceAvailabilityStats; 16 16 import simulator.stats.implementation.ResourceHistoryStats; … … 387 387 } 388 388 389 public Object visit(ResourceAir FlowStats resourceAirFlowStats) {389 public Object visit(ResourceAirflowStats resourceAirFlowStats) { 390 390 Map<Long, Double> resourceAirFlow = resourceAirFlowStats.getHistory(); 391 391 String metricName = "airFlow";
Note: See TracChangeset
for help on using the changeset viewer.