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

Legend:

Unmodified
Added
Removed
  • DCWoRMS/trunk/src/simulator/ConfigurationOptions.java

    r477 r490  
    88import java.util.PropertyResourceBundle; 
    99import java.util.ResourceBundle; 
    10 import java.util.logging.FileHandler; 
    1110 
    1211/** 
     
    5352        public static final String READ_SCENARIO_INPUT_FOLDER = READ_SCENARIO_MODIFIER 
    5453                        + ".inputfolder"; 
    55         public static final String READ_SCENARIO_INPUT_TAR = READ_SCENARIO_MODIFIER+ ".tar"; 
    5654         
    5755        /** The name of the workload file */ 
     
    5957                        + ".workloadfilename"; 
    6058 
    61         /** Shall a detailed history be printed */ 
    62         public static final String PRINT_HISTORY_MODIFIER = "printhistory"; 
    63  
    6459        /** The default name of a workload file */ 
    6560        public static final String DEFAULT_WORKLOAD_FILE_NAME = "workload.swf"; 
    6661 
    6762        public static final String CREATE_XML_SUPPLEMENT_FILES = "createXMLSupplement"; 
    68          
    69         public static final String PROVIDER_LIST_FILE = "in/provider.list"; 
    70          
    71         /** Network topology file path */ 
    72         public static final String NETWORK_TOPOLOGY_FILE_MODIFIER = "networktopologyfilename"; 
     63 
    7364         
    7465        public static final String CREATEDIAGRAMS = "creatediagrams"; 
     
    7970        public static final String CREATEDIAGRAMS_TASKS = CREATEDIAGRAMS + ".tasks"; 
    8071        public static final String CREATEDIAGRAMS_TASKSWAITINGTIME = CREATEDIAGRAMS + ".taskswaitingtime"; 
    81         public static final String CREATEDIAGRAMS_RESERVATIONS = CREATEDIAGRAMS + ".reservations"; 
    8272         
    8373        public static final String CREATESTATISTICS = "createstatistics"; 
    8474        public static final String ACCUMULATED_RESOURCES_STATISTICS = CREATESTATISTICS + ".accumulatedresources"; 
    8575        public static final String EXTENDED_TASKS_STATISTICS = CREATESTATISTICS + ".extendedtasks"; 
    86         public static final String GRIDLET_HISTORY_STATISTICS = CREATESTATISTICS + ".gridlethistory"; 
    8776        public static final String JOBS_STATISTICS = CREATESTATISTICS + ".jobs"; 
    8877        public static final String SIMULATION_STATISTICS = CREATESTATISTICS + ".simulation"; 
     
    111100        /* =============================================================================================== */ 
    112101         
    113         public String providerListFile = null; 
    114102 
    115103 
     
    152140        public String inputWorkloadFileName = DEFAULT_WORKLOAD_FILE_NAME; 
    153141 
    154         /** 
    155          * a txt file name with topology description 
    156          */ 
    157         public String networkTopologyFileName = null; 
    158142         
    159143        /** 
     
    171155        public boolean overwriteFiles = false; 
    172156 
    173         /** 
    174          * true if the history files are to be generated (makes the simulation 
    175          * slower) 
    176          */ 
    177         public boolean printHistory = false; 
    178157         
    179158        /** 
     
    183162 
    184163        public boolean creatediagrams_processors = true; 
    185         public boolean creatediagrams_reservations = true; 
    186164        public boolean creatediagrams_resources = true; 
    187165        public boolean creatediagrams_energyusage = true; 
    188166        public boolean creatediagrams_tasks = true; 
    189167        public boolean creatediagrams_taskswaitingtime = true; 
    190         public double     creatediagrams_resources_scale = 1; 
     168        public double  creatediagrams_resources_scale = 1; 
    191169         
    192170        public boolean createaccumulatedresourcesstatistics = true; 
    193171        public boolean createextendedtasksstatistics = true; 
    194         public boolean creategridlethistorystatistics = true; 
    195172        public boolean createjobsstatistics = true; 
    196173        public boolean createsimulationstatistics = true; 
    197174        public boolean formatstatisticsoutput = false; 
    198175         
    199         public static final String ENV_DESC_MODIFIER = "envdesc"; 
    200         public String envDescFileName = null; 
     176        public String[] resForEnergyChart; 
     177        public String[] resForUtilizationChart; 
     178         
    201179        /** 
    202180         * An empty constructor. 
     
    231209                 
    232210                co.resdescFileName = bundle.getString(RESOURCE_DESC_MODIFIER); 
    233                  
    234                 try { 
    235                         co.envDescFileName = bundle.getString(ENV_DESC_MODIFIER); 
    236                 } catch(MissingResourceException e){ 
    237                         co.envDescFileName = null; 
    238                 } 
     211 
    239212                 
    240213                try { 
     
    264237                } 
    265238 
    266  
    267                 try { 
    268                         co.networkTopologyFileName = bundle 
    269                                         .getString(NETWORK_TOPOLOGY_FILE_MODIFIER); 
    270                 } catch(MissingResourceException e){ 
    271                         co.networkTopologyFileName = null; 
    272                 } 
    273                  
    274239                if (co.createScenario == false) { 
    275240                        // read scenario 
     
    279244                        } catch (MissingResourceException e) { 
    280245                                co.inputFolder = null; 
    281                         } 
    282                          
    283                         try { 
    284                                 co.inputTar = getSeparatorTerminatedPath(bundle 
    285                                         .getString(READ_SCENARIO_INPUT_TAR)); 
    286                         } catch (MissingResourceException e) { 
    287                                 co.inputTar = null; 
    288246                        } 
    289247                         
     
    307265                        co.createXMLSupplement = false; 
    308266                } 
    309                  
    310                 try { 
    311                         co.printHistory = Boolean.valueOf( 
    312                                         bundle.getString(PRINT_HISTORY_MODIFIER)).booleanValue(); 
    313                 } catch(MissingResourceException e){ 
    314                         co.printHistory = false; 
    315                 } 
    316                  
     267 
    317268                // create diagrams 
    318269                 
     
    330281                        co.creatediagrams_processors = createDiagrams; 
    331282                } 
    332                 try { 
    333                         co.creatediagrams_reservations = Boolean.valueOf( 
    334                                         bundle.getString(CREATEDIAGRAMS_RESERVATIONS)).booleanValue() && createDiagrams; 
    335                 } catch(MissingResourceException e){ 
    336                         co.creatediagrams_reservations = createDiagrams; 
    337                 } 
    338                 try { 
    339                         co.creatediagrams_resources = Boolean.valueOf( 
    340                                         bundle.getString(CREATEDIAGRAMS_UTILIZATION)).booleanValue() && createDiagrams; 
     283 
     284                try { 
     285                        co.resForUtilizationChart = bundle.getString(CREATEDIAGRAMS_UTILIZATION).split(";"); 
     286                        if(co.resForUtilizationChart.length > 0){ 
     287                                co.creatediagrams_resources = true && createDiagrams; 
     288                        } 
    341289                } catch(MissingResourceException e){ 
    342290                        co.creatediagrams_resources = createDiagrams; 
     
    349297                } 
    350298                try { 
    351                         co.creatediagrams_energyusage = Boolean.valueOf( 
    352                                         bundle.getString(CREATEDIAGRAMS_ENERGYUSAGE)).booleanValue() && createDiagrams; 
     299                        co.resForEnergyChart = bundle.getString(CREATEDIAGRAMS_ENERGYUSAGE).split(";"); 
     300                        if(co.resForEnergyChart.length > 0){ 
     301                                co.creatediagrams_energyusage = true && createDiagrams; 
     302                        } 
    353303                } catch(MissingResourceException e){ 
    354304                        co.creatediagrams_energyusage = createDiagrams; 
     
    367317                } 
    368318                 
    369                  
    370319                try { 
    371320                        co.statsOutputSubfolderNameCreate = bundle.getString(STATS_OUTPUT_SUBFOLDER_NAME); 
     
    388337                        co.createextendedtasksstatistics = true; 
    389338                } 
    390                 try { 
    391                         co.creategridlethistorystatistics = Boolean.valueOf( 
    392                                         bundle.getString(GRIDLET_HISTORY_STATISTICS)).booleanValue(); 
    393                 } catch(MissingResourceException e){ 
    394                         co.creategridlethistorystatistics = true; 
    395                 } 
     339 
    396340                try { 
    397341                        co.createjobsstatistics = Boolean.valueOf( 
     
    419363                } 
    420364                return co; 
    421         } 
    422  
    423         /** 
    424          * Creates a new configuration object in the CREATE_SCENARIO mode. 
    425          *  
    426          * @param gridSchedulingPluginName 
    427          * @param forecastFinishTimePluginName 
    428          * @param localAllocPolicyPluginName 
    429          * @param resdescFileName 
    430          * @param taskParamFileName 
    431          * @param outputFolder 
    432          * @param outputWorkloadFileName 
    433          * @param overwriteFiles 
    434          * @param printHistory 
    435          */ 
    436         public ConfigurationOptions(String gridSchedulingPluginName, 
    437                         String exectimeestimationplugin, 
    438                         String localAllocPolicyPluginName, String resdescFileName, 
    439                         String taskParamFileName, String outputFolder, 
    440                         String outputWorkloadFileName, boolean overwriteFiles, 
    441                         boolean printHistory) { 
    442                 super(); 
    443                 this.resdescFileName = resdescFileName; 
    444                 this.workloadDescFileName = taskParamFileName; 
    445                 this.outputFolder = getSeparatorTerminatedPath(outputFolder); 
    446                 this.outputWorkloadFileName = outputWorkloadFileName; 
    447                 this.overwriteFiles = overwriteFiles; 
    448                 this.printHistory = printHistory; 
    449  
    450                 // the create mode 
    451                 this.createScenario = true; 
    452         } 
    453  
    454         /** 
    455          * Creates a new configuration object in the READ_SCENARIO mode. 
    456          *  
    457          * @param gridSchedulingPluginName 
    458          * @param forecastFinishTimePluginName 
    459          * @param localAllocPolicyPluginName 
    460          * @param resdescFileName 
    461          * @param inputFolder 
    462          * @param inputWorkloadFileName 
    463          * @param overwriteFiles 
    464          * @param printHistory 
    465          */ 
    466         public ConfigurationOptions(String gridSchedulingPluginName, 
    467                         String exectimeestimationplugin, 
    468                         String localAllocPolicyPluginName, String resdescFileName, 
    469                         String inputFolder, String inputWorkloadFileName, 
    470                         boolean overwriteFiles, boolean printHistory) { 
    471                 super(); 
    472                 this.resdescFileName = resdescFileName; 
    473                 this.inputFolder = getSeparatorTerminatedPath(inputFolder); 
    474                 this.inputWorkloadFileName = inputWorkloadFileName; 
    475                 this.overwriteFiles = overwriteFiles; 
    476                 this.printHistory = printHistory; 
    477                 //FileHandler.loadDataset(new File("iris.data"), 4, ","); 
    478                 // the read mode 
    479                 this.createScenario = false; 
    480365        } 
    481366 
  • DCWoRMS/trunk/src/simulator/DCWormsUsers.java

    r481 r490  
    11package simulator; 
    22 
     3import dcworms.schedframe.scheduling.utils.JobDescription; 
     4import dcworms.schedframe.scheduling.utils.TaskDescription; 
    35import eduni.simjava.Sim_event; 
    46import eduni.simjava.Sim_system; 
    57import gridsim.GridSim; 
    68import gridsim.GridSimTags; 
    7 import gridsim.Gridlet; 
    89import gridsim.IO_data; 
    910import gridsim.gssim.DCWormsTags; 
    1011import gridsim.net.InfoPacket; 
    11 import gssim.schedframe.scheduling.utils.JobDescription; 
    12 import gssim.schedframe.scheduling.utils.TaskDescription; 
    1312 
    1413import java.util.ArrayList; 
  • DCWoRMS/trunk/src/simulator/GenericUser.java

    r477 r490  
    22 
    33 
    4 import gssim.schedframe.scheduling.utils.JobDescription; 
    5 import gssim.schedframe.scheduling.utils.TaskDescription; 
    64 
    75import java.util.List; 
     6 
     7import dcworms.schedframe.scheduling.utils.JobDescription; 
     8import dcworms.schedframe.scheduling.utils.TaskDescription; 
    89 
    910import schedframe.scheduling.tasks.Job; 
  • DCWoRMS/trunk/src/simulator/reader/ResourceReader.java

    r477 r490  
    1111import java.util.Deque; 
    1212import java.util.HashMap; 
     13import java.util.LinkedHashSet; 
    1314import java.util.LinkedList; 
    1415import java.util.List; 
    1516import java.util.Map; 
     17import java.util.Set; 
    1618 
    1719import org.exolab.castor.types.AnyNode; 
     
    5456        private String globalSchedulingPluginName; 
    5557         
     58        private Set<String> compResLayers; 
     59         
    5660        public ResourceReader(ConfigurationOptions options) throws IOException { 
    5761 
     
    5963                globalSchedulingPluginName = "example.globalplugin.GridFCFSRoundRobinPlugin"; 
    6064                prepareCalendar(); 
     65                compResLayers = new LinkedHashSet<String>(); 
    6166        } 
    6267 
     
    97102                ResourceController rc = new ResourceController(mainScheduler, computingResources); 
    98103                rc.setInitList(toInit); 
     104                rc.setCompResLayers(compResLayers); 
    99105                return rc; 
    100106        } 
     
    192198                        ComputingResource parentResource = resStructure.pop(); 
    193199                        toInit.add(parentResource); 
     200                        compResLayers.add(parentResource.getType().getName()); 
    194201                        List<AbstractResourceDescription> childrenResDesc = parentResDesc.getChildren(); 
    195202                        if (childrenResDesc == null){ 
  • 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; 
  • DCWoRMS/trunk/src/simulator/utils/XsltTransformations.java

    r477 r490  
    11package simulator.utils; 
    22 
    3 import gssim.schedframe.scheduling.utils.JobDescription; 
    4 import gssim.schedframe.scheduling.utils.TaskDescription; 
    53 
    64import java.io.IOException; 
     
    2018import javax.xml.transform.stream.StreamSource; 
    2119import javax.xml.xpath.XPathExpressionException; 
     20 
     21import dcworms.schedframe.scheduling.utils.JobDescription; 
     22import dcworms.schedframe.scheduling.utils.TaskDescription; 
    2223 
    2324/** 
  • DCWoRMS/trunk/src/simulator/workload/WorkloadLoader.java

    r477 r490  
    22 
    33import org.qcg.broker.schemas.jobdesc.QcgJob; 
    4 import gssim.schedframe.scheduling.utils.JobDescription; 
    5 import gssim.schedframe.scheduling.utils.TaskDescription; 
    64 
    75import java.io.IOException; 
     
    2422import org.exolab.castor.xml.MarshalException; 
    2523import org.exolab.castor.xml.ValidationException; 
     24 
     25import dcworms.schedframe.scheduling.utils.JobDescription; 
     26import dcworms.schedframe.scheduling.utils.TaskDescription; 
    2627 
    2728 
Note: See TracChangeset for help on using the changeset viewer.