Ignore:
Timestamp:
10/09/12 13:58:06 (13 years ago)
Author:
wojtekp
Message:
 
Location:
DCWoRMS/trunk/src/simulator/stats/implementation
Files:
2 edited

Legend:

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

    r481 r490  
    1919import java.util.TreeMap; 
    2020 
     21import org.apache.commons.lang.ArrayUtils; 
    2122import org.apache.commons.logging.Log; 
    2223import org.apache.commons.logging.LogFactory; 
     
    5556import schedframe.exceptions.ResourceException; 
    5657import schedframe.resources.ResourceType; 
    57 import schedframe.resources.StandardResourceType; 
     58import schedframe.resources.UserResourceType; 
    5859import schedframe.resources.computing.ComputingResource; 
    5960import schedframe.resources.computing.extensions.Extension; 
     
    8788import csiro.mit.utils.jfreechart.timetablechart.data.TimetableEventSource; 
    8889import csiro.mit.utils.jfreechart.timetablechart.renderer.TimetableRenderer; 
     90import dcworms.schedframe.scheduling.ExecTask; 
     91import dcworms.schedframe.scheduling.Executable; 
    8992import eduni.simjava.Sim_stat; 
    90 import gssim.schedframe.scheduling.ExecTask; 
    91 import gssim.schedframe.scheduling.Executable; 
    9293 
    9394public class DCWormsStatistics implements SimulationStatistics { 
     
    149150        protected HashMap<String, List<String>> task_processorsMap; 
    150151 
    151         protected JobRegistryImpl jr; 
     152        protected JobRegistry jr; 
    152153 
    153154         
     
    168169 
    169170                this.resourceController = resourceController; 
    170                  jr = new JobRegistryImpl("COMPUTING_GRID_0#BROKER"); 
     171                jr = new JobRegistryImpl(""); 
    171172                init(); 
    172173        } 
     
    231232                        simulationStatsFile.close(); 
    232233                } 
    233  
    234         } 
    235  
    236  
     234        } 
    237235 
    238236        /************* RESOURCE STATISTICS SECTION **************/ 
     
    241239                 
    242240                //TEMPORARY CONFIGURATION SECTION 
    243                 StandardResourceType [] resForAnalyze = {StandardResourceType.DataCenter, StandardResourceType.ComputingNode, StandardResourceType.Processor}; 
    244                 HashMap<StandardResourceType, List<Stats>> type_stats = new HashMap<StandardResourceType, List<Stats>>(); 
    245                  
    246                 List<Stats> crStats = new ArrayList<Stats>(); 
    247                 crStats.add(Stats.textLoad); 
    248                 crStats.add(Stats.chartLoad); 
    249                 crStats.add(Stats.textEnergy); 
    250                 crStats.add(Stats.chartEnergy); 
    251                 type_stats.put(StandardResourceType.DataCenter, crStats); 
    252                  
    253                 List<Stats> cnStats = new ArrayList<Stats>(); 
    254                 cnStats.add(Stats.textLoad); 
    255                 cnStats.add(Stats.chartLoad); 
    256                 cnStats.add(Stats.textEnergy); 
    257                 cnStats.add(Stats.chartEnergy); 
    258                 type_stats.put(StandardResourceType.ComputingNode, cnStats); 
    259                  
    260                 List<Stats> cpuStats = new ArrayList<Stats>(); 
    261                 cpuStats.add(Stats.textLoad); 
    262                 cpuStats.add(Stats.chartLoad); 
    263                 cpuStats.add(Stats.textEnergy); 
    264                 //cpuStats.add(Stats.chartEnergy); 
    265                 type_stats.put(StandardResourceType.Processor, cpuStats); 
    266                  
    267                  
     241                 
     242                HashMap<String, List<Stats>> type_stats = new HashMap<String, List<Stats>>(); 
     243                 
     244                for(String resourceName: resourceController.getComputingResourceLayers()){ 
     245                        List<Stats> cStats = new ArrayList<Stats>(); 
     246                        cStats.add(Stats.textLoad); 
     247                        if(ArrayUtils.contains(configuration.resForUtilizationChart, resourceName)) 
     248                                cStats.add(Stats.chartLoad); 
     249                        cStats.add(Stats.textEnergy); 
     250                        if(ArrayUtils.contains(configuration.resForEnergyChart, resourceName)) 
     251                                cStats.add(Stats.chartEnergy); 
     252                        type_stats.put(resourceName, cStats); 
     253                }                
    268254                 
    269255                peGanttMap = new HashMap<String, TimetableEventSource>(); 
     
    305291                } 
    306292                 
    307                 for(StandardResourceType resType: resForAnalyze){ 
     293                for(String resourceName: resourceController.getComputingResourceLayers()){ 
    308294                        List<ComputingResource> resources = null; 
    309295                        try { 
    310296                                resources = new ArrayList<ComputingResource>(); 
    311297                                for(ComputingResource compRes: resourceController.getComputingResources() ){ 
    312                                         resources.addAll(compRes.getDescendantsByType(resType)); 
    313                                 } 
    314                                 /*if(resourceController.getComputingResources().get(0).getType().equals(resType)) 
    315                                         resources.addAll(resourceController.getComputingResources());*/ 
     298                                        resources.addAll(compRes.getDescendantsByType(new UserResourceType(resourceName))); 
     299                                } 
     300                                if(resourceController.getComputingResources().get(0).getType().getName().equals(resourceName)) 
     301                                        resources.addAll(resourceController.getComputingResources()); 
    316302                        } catch (Exception e) { 
    317303                                continue; 
    318304                        } 
    319                         if(type_stats.containsKey(resType)){ 
     305                        if(type_stats.containsKey(resourceName)){ 
    320306                                Map<String, GSSAccumulator> energyCategoryStats = new TreeMap<String, GSSAccumulator>(); 
    321307                                Map<String, GSSAccumulator> loadCategoryStats = new TreeMap<String, GSSAccumulator>(); 
     
    323309                                        ResourceUsageStats resourceUsage = null; 
    324310                                        ResourceEnergyStats energyUsage = null; 
    325                                         if(type_stats.get(resType).contains(Stats.textLoad)){ 
     311                                        if(type_stats.get(resourceName).contains(Stats.textLoad)){ 
    326312                                                resourceUsage = gatherResourceLoadStats(resource, basicResStats); 
    327313                                                resourceUsage.setMeanUsage(calculateResourceLoad(resource, basicResLoad)); 
     
    331317                                                } 
    332318                                        } 
    333                                         if(type_stats.get(resType).contains(Stats.chartLoad)){ 
     319                                        if(type_stats.get(resourceName).contains(Stats.chartLoad)){ 
    334320                                                if (configuration.creatediagrams_resources) { 
    335321                                                        createResourceLoadDiagram(resourceUsage); 
    336322                                                } 
    337323                                        } 
    338                                         if(type_stats.get(resType).contains(Stats.textEnergy)){ 
     324                                        if(type_stats.get(resourceName).contains(Stats.textEnergy)){ 
    339325                                                energyUsage = gatherResourceEnergyStats(resource); 
    340326                                                energyUsage.setMeanUsage(calculateEnergyLoad(energyUsage)); 
     
    352338                                                        boolean top = true; 
    353339                                                        while(parent != null){ 
    354                                                                 if(een != null &&  een.getPowerProfile() != null) 
    355                                                                 { 
     340                                                                if(een != null &&  een.getPowerProfile() != null) { 
    356341                                                                        top = false; 
    357342                                                                        break; 
     
    368353                                                } 
    369354                                        } 
    370                                         if(type_stats.get(resType).contains(Stats.chartEnergy)){ 
     355                                        if(type_stats.get(resourceName).contains(Stats.chartEnergy)){ 
    371356 
    372357                                                if (configuration.creatediagrams_energyusage) { 
     
    760745        private JFreeChart getResourcesEnergyDiagram(ResourceType resType, String chartName, 
    761746                        Title subtitle, String simulationTime) { 
    762                 String energy = "ENERGY [W]"; 
     747                String energy = "POWER [W]"; 
    763748                boolean urls = false; 
    764749                boolean tooltip = true; 
  • DCWoRMS/trunk/src/simulator/stats/implementation/TaskStats.java

    r481 r490  
    11package simulator.stats.implementation; 
    22 
    3 import gssim.schedframe.scheduling.Executable; 
    43 
    54import java.util.List; 
     5 
     6import dcworms.schedframe.scheduling.Executable; 
    67 
    78import simulator.stats.implementation.out.StatsSerializer; 
Note: See TracChangeset for help on using the changeset viewer.