Ignore:
Timestamp:
06/26/14 14:18:01 (11 years ago)
Author:
wojtekp
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • DCWoRMS/branches/coolemall/src/simulator/stats/implementation/DCWormsStatistics.java

    r1374 r1396  
    5959import schedframe.ExecutablesList; 
    6060import schedframe.SimulatedEnvironment; 
    61 import schedframe.exceptions.ResourceException; 
     61import schedframe.resources.CustomResourceType; 
    6262import schedframe.resources.ResourceType; 
    63 import schedframe.resources.UserResourceType; 
    6463import schedframe.resources.computing.ComputingResource; 
    65 import schedframe.resources.computing.Processor; 
    6664import schedframe.resources.computing.extensions.Extension; 
    6765import schedframe.resources.computing.extensions.ExtensionList; 
     
    6967import schedframe.resources.computing.profiles.energy.EnergyExtension; 
    7068import schedframe.resources.computing.profiles.energy.MeasurementHistory; 
    71 import schedframe.resources.computing.profiles.energy.airthroughput.AirFlowValue; 
     69import schedframe.resources.computing.profiles.energy.airthroughput.AirflowValue; 
    7270import schedframe.resources.computing.profiles.energy.power.PowerUsage; 
    7371import schedframe.resources.computing.profiles.energy.thermal.TemperatureValue; 
     
    8078import schedframe.resources.units.StandardResourceUnitName; 
    8179import schedframe.scheduling.ExecutionHistoryItem; 
    82 import schedframe.scheduling.ResourceHistoryItem; 
     80import schedframe.scheduling.ResourceItem; 
    8381import schedframe.scheduling.Scheduler; 
    8482import schedframe.scheduling.manager.tasks.JobRegistry; 
     
    9189import simulator.GenericUser; 
    9290import simulator.stats.CoolEmAllMetricsCalculator; 
     91import simulator.stats.DCwormsAccumulator; 
    9392import simulator.stats.DCwormsMetricsCalculator; 
    94 import simulator.stats.GSSAccumulator; 
    9593import simulator.stats.MetricsCalculator; 
    9694import simulator.stats.SimulationStatistics; 
     
    124122        protected static final String RESOURCEUTILIZATION_STATISTICS_OUTPUT_FILE_NAME = "ResourceUtilization.txt"; 
    125123        protected static final String ENERGYUSAGE_STATISTICS_OUTPUT_FILE_NAME = "EnergyUsage.txt"; 
    126         protected static final String AIRFLOW_STATISTICS_OUTPUT_FILE_NAME = "AirThroughput.txt"; 
     124        protected static final String AIRFLOW_STATISTICS_OUTPUT_FILE_NAME = "Airflow.txt"; 
    127125        protected static final String TEMPERATURE_STATISTICS_OUTPUT_FILE_NAME = "Temperature.txt"; 
    128126        protected static final String USEFUL_WORK_STATISTICS_OUTPUT_FILE_NAME = "UsefulWork.txt"; 
     
    144142 
    145143        protected GSSAccumulatorsStats accStats; 
    146         protected Map<String, GSSAccumulator> statsData; 
     144        protected Map<String, DCwormsAccumulator> statsData; 
    147145         
    148146        protected GenericUser users; 
     
    232230                task_processorsMap = new HashMap<String, Set<ComputingResource>>(); 
    233231                accStats = new GSSAccumulatorsStats(); 
    234                 statsData = new HashMap<String, GSSAccumulator>(); 
     232                statsData = new HashMap<String, DCwormsAccumulator>(); 
    235233                 
    236234                this.serializer = new StringSerializer();                
     
    298296                                cStats.add(Stats.chartEnergy); 
    299297                        cStats.add(Stats.textAirFlow); 
    300                         if(ArrayUtils.contains(configuration.resForAirFlowChart, resourceTypeName)) 
     298                        if(ArrayUtils.contains(configuration.resForAirflowChart, resourceTypeName)) 
    301299                                cStats.add(Stats.chartAirFlow); 
    302300                        cStats.add(Stats.textTemperature); 
     
    420418                List<ComputingResource> compResources = null; 
    421419                for(String resourceTypeName: resourceController.getComputingResourceLayers()){ 
    422                         GSSAccumulator resourceEnergyAccumulator = new GSSAccumulator(); 
    423                         GSSAccumulator maxResourceEnergyAccumulator = new GSSAccumulator(); 
    424                         GSSAccumulator calculationsEnergyAccumulator = new GSSAccumulator(); 
     420                        DCwormsAccumulator resourceEnergyAccumulator = new DCwormsAccumulator(); 
     421                        DCwormsAccumulator maxResourceEnergyAccumulator = new DCwormsAccumulator(); 
     422                        DCwormsAccumulator calculationsEnergyAccumulator = new DCwormsAccumulator(); 
    425423                        compResources = new ArrayList<ComputingResource>(); 
    426424                        for(ComputingResource compRes: resourceController.getComputingResources() ){ 
    427                                 compResources.addAll(compRes.getDescendantsByType(new UserResourceType(resourceTypeName))); 
     425                                compResources.addAll(compRes.getDescendantsByType(new CustomResourceType(resourceTypeName))); 
    428426                        } 
    429427                        if(resourceController.getComputingResources().get(0).getType().getName().equals(resourceTypeName)) 
     
    526524                                                 
    527525                                                for(Device device: compResource.getResourceCharacteristic().getDevices()){ 
    528                                                         GSSAccumulator devAccumulator = new GSSAccumulator(); 
     526                                                        DCwormsAccumulator devAccumulator = new DCwormsAccumulator(); 
    529527                                                        ResourcePowerStats deviceEnergyUsage = gatherResourcePowerConsumptionStats(device); 
    530528                                                        deviceEnergyUsage.setMeanValue(calculateMeanValue(deviceEnergyUsage)); 
     
    592590                                                        } 
    593591                                                         
    594                                                         if(ArrayUtils.contains(configuration.resForAirFlowChart, device.getType().getName())){ 
     592                                                        if(ArrayUtils.contains(configuration.resForAirflowChart, device.getType().getName())){ 
    595593                                                                if (configuration.creatediagrams_resairflow) { 
    596594                                                                        createResourceAirFlowDiagramData(deviceAirFlow); 
     
    767765 
    768766 
    769                         LinkedList<ResourceHistoryItem> resourceHistory = exec.getAllocatedResources(); 
     767                        LinkedList<ResourceItem> resourceHistory = exec.getAllocatedResources(); 
    770768                        if(resourceHistory.size() == 0) 
    771769                                continue; 
     
    805803 
    806804                                        try{ 
    807                                                 double usefulWork = execTask.getResourceConsumptionProfile().getUsefulWork()/pes.size(); 
     805                                                double usefulWork = execTask.getExecutionProfile().getUsefulWork()/pes.size(); 
    808806                                                //double usefulWork = gatherUsefulWorkStats(pe).getValue(); 
    809                                                 GSSAccumulator uwAcc; 
     807                                                DCwormsAccumulator uwAcc; 
    810808                                                if(metCalc.getMetricsData().containsKey("UW_" + pe.getFullName())){ 
    811809                                                        uwAcc = metCalc.getMetricsData().get("UW_" + pe.getFullName()).get(0); 
    812810                                                        uwAcc.add(usefulWork); 
    813811                                                } else { 
    814                                                         uwAcc = new GSSAccumulator(); 
     812                                                        uwAcc = new DCwormsAccumulator(); 
    815813                                                        uwAcc.add(usefulWork); 
    816814                                                        metCalc.addMetricsData("UW_" + pe.getFullName(), uwAcc); 
     
    832830                        Executable exec = (Executable) execTask; 
    833831 
    834                         LinkedList<ResourceHistoryItem> resourceHistory = exec.getAllocatedResources(); 
     832                        LinkedList<ResourceItem> resourceHistory = exec.getAllocatedResources(); 
    835833                        if(resourceHistory.size() == 0) 
    836834                                continue; 
    837835 
    838836                        for(int i = 0; i < resourceHistory .size(); i++){ 
    839                                 ResourceHistoryItem resHistItem = resourceHistory.get(i); 
     837                                ResourceItem resHistItem = resourceHistory.get(i); 
    840838                                Map<ResourceUnitName, ResourceUnit> res = resHistItem.getResourceUnits(); 
    841839                                ResourceUnit resUnit = res.get(StandardResourceUnitName.PE); 
    842840                                //ProcessingElements pes = (ProcessingElements) resUnit ; 
    843                                 LinkedList<ExecutionHistoryItem> execHistory = exec.getExecHistory(); 
     841                                LinkedList<ExecutionHistoryItem> execHistory = exec.getExecutionHistory(); 
    844842                                long st = -1, et; 
    845843                                for(int j = 0; j < execHistory .size(); j++){ 
     
    893891 
    894892                                                                try{ 
    895                                                                         double usefulWork = execTask.getResourceConsumptionProfile().getUsefulWork()/pes.size(); 
     893                                                                        double usefulWork = execTask.getExecutionProfile().getUsefulWork()/pes.size(); 
    896894                                                                        usefulWork = ((et - st) / (1000 * getExecutionTime(execTask))) * usefulWork; 
    897                                                                         GSSAccumulator uwAcc; 
     895                                                                        DCwormsAccumulator uwAcc; 
    898896                                                                        if(metCalc.getMetricsData().containsKey("UW_" + pe.getFullName())){ 
    899897                                                                                uwAcc = metCalc.getMetricsData().get("UW_" + pe.getFullName()).get(0); 
    900898                                                                                uwAcc.add(usefulWork); 
    901899                                                                        } else { 
    902                                                                                 uwAcc = new GSSAccumulator(); 
     900                                                                                uwAcc = new DCwormsAccumulator(); 
    903901                                                                                uwAcc.add(usefulWork); 
    904902                                                                                metCalc.addMetricsData("UW_" + pe.getFullName(), uwAcc); 
     
    922920                long previousTimestamp = 0; 
    923921                int previousStatus = DCWormsTags.CREATED; 
    924                 for(ExecutionHistoryItem execHistItem: execTask.getExecHistory()){ 
     922                for(ExecutionHistoryItem execHistItem: execTask.getExecutionHistory()){ 
    925923                        if(previousStatus == DCWormsTags.INEXEC){ 
    926924                                executionTime = executionTime  + (execHistItem.getTimeStamp().getMillis()/1000 - previousTimestamp); 
     
    10331031                JobRegistry jr = new JobRegistryImpl(compResource.getFullName()); 
    10341032                for(ExecTask task: jr.getFinishedTasks()){ 
    1035                         usefulWork = usefulWork + task.getResourceConsumptionProfile().getUsefulWork(); 
     1033                        usefulWork = usefulWork + task.getExecutionProfile().getUsefulWork(); 
    10361034                } 
    10371035                ResourceUsefulWorkStats usefulWorkStats = new ResourceUsefulWorkStats(compResource.getFullName(), compResource.getType(), usageType, usefulWork, endSimulationTime); 
     
    11751173                                        if(ee.getAirFlowProfile() == null) 
    11761174                                                break; 
    1177                                         List<AirFlowValue> airFlowHistory = ee.getAirFlowProfile().getAirThroughputHistory(); 
     1175                                        List<AirflowValue> airFlowHistory = ee.getAirFlowProfile().getAirflowHistory(); 
    11781176                                        if(airFlowHistory.size() == 0) 
    11791177                                                break; 
    11801178                                        long endSimulationTime = DateTimeUtilsExt.currentTimeMillis(); 
    1181                                         airFlowHistory.add(new AirFlowValue(endSimulationTime, ee.getAirFlowProfile().getAirThroughputHistory().get(ee.getAirFlowProfile().getAirThroughputHistory().size()-1).getValue())); 
    1182                                         for(AirFlowValue af:airFlowHistory){ 
     1179                                        airFlowHistory.add(new AirflowValue(endSimulationTime, ee.getAirFlowProfile().getAirflowHistory().get(ee.getAirFlowProfile().getAirflowHistory().size()-1).getValue())); 
     1180                                        for(AirflowValue af:airFlowHistory){ 
    11831181                                                airFlow.put(af.getTimestamp(), af.getValue()); 
    11841182                                        } 
     
    14021400                                resourceAirFlowDiagram = getResourceDynamicDiagram(resourceAirFlowDiagrams.get(resType), simulationTime, chartName, 
    14031401                                                subtitle, axisName); 
    1404                                 if (!saveXYPlotChart(resourceAirFlowDiagram, fileName + "AirThroughput_" + resType)) 
     1402                                if (!saveXYPlotChart(resourceAirFlowDiagram, fileName + "Airflow_" + resType)) 
    14051403                                        return false; 
    14061404                        } 
     
    20402038        } 
    20412039 
    2042         public GSSAccumulator getStats(String name) { 
     2040        public DCwormsAccumulator getStats(String name) { 
    20432041                return statsData.get(name); 
    20442042        } 
Note: See TracChangeset for help on using the changeset viewer.