Ignore:
Timestamp:
10/31/12 13:52:06 (12 years ago)
Author:
wojtekp
Message:
 
Location:
DCWoRMS/trunk/build/classes/simulator
Files:
15 added
30 edited

Legend:

Unmodified
Added
Removed
  • DCWoRMS/trunk/build/classes/simulator/ConfigurationOptions.java

    r477 r539  
    88import java.util.PropertyResourceBundle; 
    99import java.util.ResourceBundle; 
    10 import java.util.logging.FileHandler; 
    1110 
    1211/** 
     
    2625         * ============================================================================================= 
    2726         */ 
    28         /** Grid scheduler's plugin path */ 
    29         public static final String GRID_SCHEDULING_PLUGIN_NAME_MODIFIER = "gridschedulingpluginname"; 
    30         /** Forecast finish time plugin path */ 
    31         public static final String EXEC_TIME_ESTIMATION_PLUGIN_NAME_MODIFIER = "exectimeestimationpluginname"; 
    32         /** Local allocation policy plugin path */ 
    33         public static final String LOCAL_ALLOC_POLICY_PLUGIN_NAME_MODIFIER = "localallocpolicypluginname"; 
     27 
    3428        /** The path to the resource description file */ 
    3529        public static final String RESOURCE_DESC_MODIFIER = "resdesc"; 
     
    5852        public static final String READ_SCENARIO_INPUT_FOLDER = READ_SCENARIO_MODIFIER 
    5953                        + ".inputfolder"; 
    60         public static final String READ_SCENARIO_INPUT_TAR = READ_SCENARIO_MODIFIER+ ".tar"; 
    6154         
    6255        /** The name of the workload file */ 
     
    6457                        + ".workloadfilename"; 
    6558 
    66         /** Shall a detailed history be printed */ 
    67         public static final String PRINT_HISTORY_MODIFIER = "printhistory"; 
    68  
    6959        /** The default name of a workload file */ 
    7060        public static final String DEFAULT_WORKLOAD_FILE_NAME = "workload.swf"; 
    7161 
    7262        public static final String CREATE_XML_SUPPLEMENT_FILES = "createXMLSupplement"; 
    73          
    74         public static final String PROVIDER_LIST_FILE = "in/provider.list"; 
    75          
    76         /** Network topology file path */ 
    77         public static final String NETWORK_TOPOLOGY_FILE_MODIFIER = "networktopologyfilename"; 
     63 
    7864         
    7965        public static final String CREATEDIAGRAMS = "creatediagrams"; 
    80         public static final String CREATEDIAGRAMS_PROCESSORS = CREATEDIAGRAMS +".processors"; 
    81         public static final String CREATEDIAGRAMS_RESERVATIONS = CREATEDIAGRAMS + ".reservations"; 
    82         public static final String CREATEDIAGRAMS_RESOURCES = CREATEDIAGRAMS + ".resources"; 
    83         public static final String CREATEDIAGRAMS_ENERGYUSAGE = CREATEDIAGRAMS + ".energyusage"; 
    84         public static final String CREATEDIAGRAMS_RESOURCES_SCALE = CREATEDIAGRAMS_RESOURCES + ".scale"; 
     66        public static final String CREATEDIAGRAMS_GANTT = CREATEDIAGRAMS +".gantt"; 
    8567        public static final String CREATEDIAGRAMS_TASKS = CREATEDIAGRAMS + ".tasks"; 
    8668        public static final String CREATEDIAGRAMS_TASKSWAITINGTIME = CREATEDIAGRAMS + ".taskswaitingtime"; 
     69        public static final String CREATEDIAGRAMS_UTILIZATION = CREATEDIAGRAMS + ".resutilization"; 
     70        public static final String CREATEDIAGRAMS_ENERGYUSAGE = CREATEDIAGRAMS + ".respowerusage"; 
     71        public static final String CREATEDIAGRAMS_AIRFLOW = CREATEDIAGRAMS + ".resairflow"; 
     72        public static final String CREATEDIAGRAMS_RESOURCES_SCALE = CREATEDIAGRAMS_UTILIZATION + ".scale"; 
     73 
    8774         
    8875        public static final String CREATESTATISTICS = "createstatistics"; 
    8976        public static final String ACCUMULATED_RESOURCES_STATISTICS = CREATESTATISTICS + ".accumulatedresources"; 
    9077        public static final String EXTENDED_TASKS_STATISTICS = CREATESTATISTICS + ".extendedtasks"; 
    91         public static final String GRIDLET_HISTORY_STATISTICS = CREATESTATISTICS + ".gridlethistory"; 
    9278        public static final String JOBS_STATISTICS = CREATESTATISTICS + ".jobs"; 
    9379        public static final String SIMULATION_STATISTICS = CREATESTATISTICS + ".simulation"; 
    94         public static final String FORMAT_STATISTICS_OUTPUT = CREATESTATISTICS + ".formatoutput"; 
    9580         
    9681        /** 
     
    116101        /* =============================================================================================== */ 
    117102         
    118         public String providerListFile = null; 
    119  
    120         /** 
    121          * the full grid scheduling plugin name with package prefix, e.g. 
    122          * simulator.plugin.gridscheduling.raPlugin.RAPlugin (the plugin is loaded 
    123          * using {@link Class#forName(java.lang.String)} and 
    124          * {@link Class#newInstance()} methods) 
    125          */ 
    126         public String gridSchedulingPluginName = null; 
    127  
    128         /** 
    129          * the full forecast finish time plugin name with package prefix, e.g. 
    130          * simulator.plugin.gridscheduling.raPlugin.RAPlugin (the plugin is loaded 
    131          * using {@link Class#forName(java.lang.String)} and 
    132          * {@link Class#newInstance()} methods) 
    133          */ 
    134         public String exectimeestimationplugin = null; 
    135  
    136         /** 
    137          * the full local allocation policy plugin name with package prefix, e.g. 
    138          * simulator.plugin.gridscheduling.raPlugin.RAPlugin (the plugin is loaded 
    139          * using {@link Class#forName(java.lang.String)} and 
    140          * {@link Class#newInstance()} methods) 
    141          */ 
    142         public String localAllocPolicyPluginName = null; 
     103 
    143104 
    144105        /** 
     
    180141        public String inputWorkloadFileName = DEFAULT_WORKLOAD_FILE_NAME; 
    181142 
    182         /** 
    183          * a txt file name with topology description 
    184          */ 
    185         public String networkTopologyFileName = null; 
    186143         
    187144        /** 
     
    199156        public boolean overwriteFiles = false; 
    200157 
    201         /** 
    202          * true if the history files are to be generated (makes the simulation 
    203          * slower) 
    204          */ 
    205         public boolean printHistory = false; 
    206158         
    207159        /** 
     
    210162        public int numberOfSimulations = 1; //default value 
    211163 
    212         public boolean creatediagrams_processors = true; 
    213         public boolean creatediagrams_reservations = true; 
    214         public boolean creatediagrams_resources = true; 
    215         public boolean creatediagrams_energyusage = true; 
    216         public boolean creatediagrams_tasks = true; 
    217         public boolean creatediagrams_taskswaitingtime = true; 
    218         public double     creatediagrams_resources_scale = 1; 
    219          
    220         public boolean createaccumulatedresourcesstatistics = true; 
    221         public boolean createextendedtasksstatistics = true; 
    222         public boolean creategridlethistorystatistics = true; 
     164        public boolean creatediagrams_gantt = false; 
     165        public boolean creatediagrams_tasks = false; 
     166        public boolean creatediagrams_taskswaitingtime = false; 
     167         
     168        public boolean creatediagrams_resutilization = false; 
     169        public boolean creatediagrams_respowerusage = false; 
     170        public boolean creatediagrams_resairflow = false; 
     171        public double  creatediagrams_resources_scale = 1; 
     172 
    223173        public boolean createjobsstatistics = true; 
    224174        public boolean createsimulationstatistics = true; 
    225         public boolean formatstatisticsoutput = false; 
    226          
    227         public static final String ENV_DESC_MODIFIER = "envdesc"; 
    228         public String envDescFileName = null; 
     175         
     176        public String [] resForEnergyChart; 
     177        public String [] resForAirFlowChart; 
     178        public String [] resForUtilizationChart; 
     179         
    229180        /** 
    230181         * An empty constructor. 
     
    257208                        return null; 
    258209                } 
    259  
    260                 try { 
    261                         co.gridSchedulingPluginName = bundle 
    262                                         .getString(GRID_SCHEDULING_PLUGIN_NAME_MODIFIER); 
    263                 } catch(MissingResourceException e){ 
    264                         co.gridSchedulingPluginName = null; 
    265                 } 
    266  
    267                 try { 
    268                         co.exectimeestimationplugin = bundle 
    269                                         .getString(EXEC_TIME_ESTIMATION_PLUGIN_NAME_MODIFIER); 
    270                 } catch(MissingResourceException e){ 
    271                         co.exectimeestimationplugin = null; 
    272                 } 
    273  
    274                 try { 
    275                         co.localAllocPolicyPluginName = bundle 
    276                                         .getString(LOCAL_ALLOC_POLICY_PLUGIN_NAME_MODIFIER); 
    277                 } catch(MissingResourceException e){ 
    278                         co.localAllocPolicyPluginName = null; 
    279                 } 
    280  
    281210                 
    282211                co.resdescFileName = bundle.getString(RESOURCE_DESC_MODIFIER); 
    283                  
    284                 try { 
    285                         co.envDescFileName = bundle.getString(ENV_DESC_MODIFIER); 
    286                 } catch(MissingResourceException e){ 
    287                         co.envDescFileName = null; 
    288                 } 
    289212                 
    290213                try { 
     
    314237                } 
    315238 
    316  
    317                 try { 
    318                         co.networkTopologyFileName = bundle 
    319                                         .getString(NETWORK_TOPOLOGY_FILE_MODIFIER); 
    320                 } catch(MissingResourceException e){ 
    321                         co.networkTopologyFileName = null; 
    322                 } 
    323                  
    324239                if (co.createScenario == false) { 
    325240                        // read scenario 
     
    329244                        } catch (MissingResourceException e) { 
    330245                                co.inputFolder = null; 
    331                         } 
    332                          
    333                         try { 
    334                                 co.inputTar = getSeparatorTerminatedPath(bundle 
    335                                         .getString(READ_SCENARIO_INPUT_TAR)); 
    336                         } catch (MissingResourceException e) { 
    337                                 co.inputTar = null; 
    338246                        } 
    339247                         
     
    357265                        co.createXMLSupplement = false; 
    358266                } 
    359                  
    360                 try { 
    361                         co.printHistory = Boolean.valueOf( 
    362                                         bundle.getString(PRINT_HISTORY_MODIFIER)).booleanValue(); 
    363                 } catch(MissingResourceException e){ 
    364                         co.printHistory = false; 
    365                 } 
    366                  
     267 
    367268                // create diagrams 
    368269                 
     
    372273                                        bundle.getString(CREATEDIAGRAMS)).booleanValue(); 
    373274                } catch(MissingResourceException e){ 
    374                         createDiagrams = true; 
    375                 } 
    376                 try { 
    377                         co.creatediagrams_processors = Boolean.valueOf( 
    378                                         bundle.getString(CREATEDIAGRAMS_PROCESSORS)).booleanValue() && createDiagrams; 
    379                 } catch(MissingResourceException e){ 
    380                         co.creatediagrams_processors = createDiagrams; 
    381                 } 
    382                 try { 
    383                         co.creatediagrams_reservations = Boolean.valueOf( 
    384                                         bundle.getString(CREATEDIAGRAMS_RESERVATIONS)).booleanValue() && createDiagrams; 
    385                 } catch(MissingResourceException e){ 
    386                         co.creatediagrams_reservations = createDiagrams; 
    387                 } 
    388                 try { 
    389                         co.creatediagrams_resources = Boolean.valueOf( 
    390                                         bundle.getString(CREATEDIAGRAMS_RESOURCES)).booleanValue() && createDiagrams; 
    391                 } catch(MissingResourceException e){ 
    392                         co.creatediagrams_resources = createDiagrams; 
     275                        createDiagrams = false; 
     276                } 
     277                try { 
     278                        co.creatediagrams_gantt = Boolean.valueOf( 
     279                                        bundle.getString(CREATEDIAGRAMS_GANTT)).booleanValue(); 
     280                } catch(MissingResourceException e){ 
     281                        co.creatediagrams_gantt = createDiagrams; 
     282                } 
     283 
     284                try { 
     285                        co.resForUtilizationChart = bundle.getString(CREATEDIAGRAMS_UTILIZATION).split(";"); 
     286                        if(co.resForUtilizationChart.length > 0){ 
     287                                co.creatediagrams_resutilization = true; 
     288                        } 
     289                } catch(MissingResourceException e){ 
     290                        co.creatediagrams_resutilization = createDiagrams; 
    393291                } 
    394292                try { 
     
    399297                } 
    400298                try { 
    401                         co.creatediagrams_energyusage = Boolean.valueOf( 
    402                                         bundle.getString(CREATEDIAGRAMS_ENERGYUSAGE)).booleanValue() && createDiagrams; 
    403                 } catch(MissingResourceException e){ 
    404                         co.creatediagrams_energyusage = createDiagrams; 
    405                 } 
     299                        co.resForEnergyChart = bundle.getString(CREATEDIAGRAMS_ENERGYUSAGE).split(";"); 
     300                        if(co.resForEnergyChart.length > 0){ 
     301                                co.creatediagrams_respowerusage = true; 
     302                        } 
     303                } catch(MissingResourceException e){ 
     304                        co.creatediagrams_respowerusage = createDiagrams; 
     305                } 
     306                 
     307                try { 
     308                        co.resForAirFlowChart = bundle.getString(CREATEDIAGRAMS_AIRFLOW).split(";"); 
     309                        if(co.resForAirFlowChart.length > 0){ 
     310                                co.creatediagrams_resairflow = true; 
     311                        } 
     312                } catch(MissingResourceException e){ 
     313                        co.creatediagrams_resairflow = createDiagrams; 
     314                } 
     315                 
    406316                try { 
    407317                        co.creatediagrams_tasks = Boolean.valueOf( 
    408                                         bundle.getString(CREATEDIAGRAMS_TASKS)).booleanValue() && createDiagrams; 
     318                                        bundle.getString(CREATEDIAGRAMS_TASKS)).booleanValue(); 
    409319                } catch(MissingResourceException e){ 
    410320                        co.creatediagrams_tasks = createDiagrams; 
     
    412322                try { 
    413323                        co.creatediagrams_taskswaitingtime = Boolean.valueOf( 
    414                                         bundle.getString(CREATEDIAGRAMS_TASKSWAITINGTIME)).booleanValue() && createDiagrams; 
     324                                        bundle.getString(CREATEDIAGRAMS_TASKSWAITINGTIME)).booleanValue(); 
    415325                } catch(MissingResourceException e){ 
    416326                        co.creatediagrams_taskswaitingtime = createDiagrams; 
    417327                } 
    418                  
    419328                 
    420329                try { 
     
    427336 
    428337                try { 
    429                         co.createaccumulatedresourcesstatistics = Boolean.valueOf( 
    430                                         bundle.getString(ACCUMULATED_RESOURCES_STATISTICS)).booleanValue(); 
    431                 } catch(MissingResourceException e){ 
    432                         co.createaccumulatedresourcesstatistics = true; 
    433                 } 
    434                 try { 
    435                         co.createextendedtasksstatistics = Boolean.valueOf( 
    436                                         bundle.getString(EXTENDED_TASKS_STATISTICS)).booleanValue(); 
    437                 } catch(MissingResourceException e){ 
    438                         co.createextendedtasksstatistics = true; 
    439                 } 
    440                 try { 
    441                         co.creategridlethistorystatistics = Boolean.valueOf( 
    442                                         bundle.getString(GRIDLET_HISTORY_STATISTICS)).booleanValue(); 
    443                 } catch(MissingResourceException e){ 
    444                         co.creategridlethistorystatistics = true; 
    445                 } 
    446                 try { 
    447338                        co.createjobsstatistics = Boolean.valueOf( 
    448339                                        bundle.getString(JOBS_STATISTICS)).booleanValue(); 
     
    456347                        co.createsimulationstatistics = true; 
    457348                } 
    458                 try { 
    459                         co.formatstatisticsoutput = Boolean.valueOf( 
    460                                         bundle.getString(FORMAT_STATISTICS_OUTPUT)).booleanValue(); 
    461                 } catch(MissingResourceException e){ 
    462                         co.formatstatisticsoutput = false; 
    463                 } 
    464                  
     349 
    465350                try { 
    466351                        co.numberOfSimulations = Integer.valueOf(bundle.getString(NUMBER_OF_SIMULATIONS)).intValue(); 
     
    469354                } 
    470355                return co; 
    471         } 
    472  
    473         /** 
    474          * Creates a new configuration object in the CREATE_SCENARIO mode. 
    475          *  
    476          * @param gridSchedulingPluginName 
    477          * @param forecastFinishTimePluginName 
    478          * @param localAllocPolicyPluginName 
    479          * @param resdescFileName 
    480          * @param taskParamFileName 
    481          * @param outputFolder 
    482          * @param outputWorkloadFileName 
    483          * @param overwriteFiles 
    484          * @param printHistory 
    485          */ 
    486         public ConfigurationOptions(String gridSchedulingPluginName, 
    487                         String exectimeestimationplugin, 
    488                         String localAllocPolicyPluginName, String resdescFileName, 
    489                         String taskParamFileName, String outputFolder, 
    490                         String outputWorkloadFileName, boolean overwriteFiles, 
    491                         boolean printHistory) { 
    492                 super(); 
    493                 this.gridSchedulingPluginName = gridSchedulingPluginName; 
    494                 this.exectimeestimationplugin = exectimeestimationplugin; 
    495                 this.localAllocPolicyPluginName = localAllocPolicyPluginName; 
    496                 this.resdescFileName = resdescFileName; 
    497                 this.workloadDescFileName = taskParamFileName; 
    498                 this.outputFolder = getSeparatorTerminatedPath(outputFolder); 
    499                 this.outputWorkloadFileName = outputWorkloadFileName; 
    500                 this.overwriteFiles = overwriteFiles; 
    501                 this.printHistory = printHistory; 
    502  
    503                 // the create mode 
    504                 this.createScenario = true; 
    505         } 
    506  
    507         /** 
    508          * Creates a new configuration object in the READ_SCENARIO mode. 
    509          *  
    510          * @param gridSchedulingPluginName 
    511          * @param forecastFinishTimePluginName 
    512          * @param localAllocPolicyPluginName 
    513          * @param resdescFileName 
    514          * @param inputFolder 
    515          * @param inputWorkloadFileName 
    516          * @param overwriteFiles 
    517          * @param printHistory 
    518          */ 
    519         public ConfigurationOptions(String gridSchedulingPluginName, 
    520                         String exectimeestimationplugin, 
    521                         String localAllocPolicyPluginName, String resdescFileName, 
    522                         String inputFolder, String inputWorkloadFileName, 
    523                         boolean overwriteFiles, boolean printHistory) { 
    524                 super(); 
    525                 this.gridSchedulingPluginName = gridSchedulingPluginName; 
    526                 this.exectimeestimationplugin = exectimeestimationplugin; 
    527                 this.localAllocPolicyPluginName = localAllocPolicyPluginName; 
    528                 this.resdescFileName = resdescFileName; 
    529                 this.inputFolder = getSeparatorTerminatedPath(inputFolder); 
    530                 this.inputWorkloadFileName = inputWorkloadFileName; 
    531                 this.overwriteFiles = overwriteFiles; 
    532                 this.printHistory = printHistory; 
    533                 //FileHandler.loadDataset(new File("iris.data"), 4, ","); 
    534                 // the read mode 
    535                 this.createScenario = false; 
    536356        } 
    537357 
  • DCWoRMS/trunk/build/classes/simulator/DataCenterWorkloadSimulator.java

    r477 r539  
    11package simulator; 
    22 
    3 //import eduni.cloudsim.GSSIM; 
    43import java.io.File; 
    54import java.io.FileReader; 
     
    2625import simulator.reader.ResourceReader; 
    2726import simulator.stats.AccumulatedStatistics; 
    28 import simulator.stats.implementation.GSSimStatistics; 
     27import simulator.stats.implementation.DCWormsStatistics; 
    2928import simulator.utils.LogErrStream; 
    3029import simulator.workload.WorkloadLoader; 
     
    4039 * {@link #main(String[])} method used to invoke the program. This class also 
    4140 * provides second possibility to start the simulator, namely one may use the 
    42  * {@link #performSimulation(ConfigurationOptions, GSSimStatistics)} method. 
     41 * {@link #performSimulation(ConfigurationOptions, DCWormsStatistics)} method. 
    4342 * In this case, the input parameter, describing the simulation options, must be 
    4443 * earlier prepared. The results of the simulation can be acquired using the 
     
    9897         */ 
    9998        public static void main(String[] args) { 
    100                 DataCenterWorkloadSimulator gssim = new DataCenterWorkloadSimulator(); 
    101                 gssim.run(args); 
     99                DataCenterWorkloadSimulator dcworms = new DataCenterWorkloadSimulator(); 
     100                dcworms.run(args); 
    102101        } 
    103102 
     
    117116                                @Override 
    118117                                public String getDescription() { 
    119                                         return "WoRMS experiment file"; 
     118                                        return "DCWoRMS experiment file"; 
    120119                                } 
    121120                        }; 
     
    198197        } 
    199198 
    200         private void runMultiuser(String rootDirPath, DataCenterWorkloadSimulator gssim) { 
     199        private void runMultiuser(String rootDirPath, DataCenterWorkloadSimulator dcworms) { 
    201200                throw new RuntimeException("not supported yet"); 
    202201        } 
     
    269268                rc.setInitList(null); 
    270269                 
    271                 WormsUsers wl = new WormsUsers("Users", 
     270                DCWormsUsers wl = new DCWormsUsers("Users", 
    272271                                rc.getScheduler().get_name(), workload); 
    273272                 
     
    275274                long stopSimulation = System.currentTimeMillis(); 
    276275 
    277                 GSSimStatistics stats = new GSSimStatistics(simulationIdentifier, 
     276                DCWormsStatistics stats = new DCWormsStatistics(simulationIdentifier, 
    278277                                options, wl, statsOutputPath, rc); 
    279278                accumulatedStatistics.add(stats); 
  • DCWoRMS/trunk/build/classes/simulator/GenericUser.java

    r477 r539  
    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/build/classes/simulator/reader/ResourceReader.java

    r477 r539  
    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 
     
    6469                        UnknownParameter { 
    6570 
    66                 //File file = new File("src/test/rewolucja/schemas/example/coolemall/example4.xml"); 
    6771                File file = new File(resDescFileName); 
    68                 //File file = new File("example/tomekp/experiment1/tomExp3.xml"); 
    69                 /*long s =System.currentTimeMillis(); 
    70                 System.out.println("start: "); 
    71                 List<Processor> list = new ArrayList<Processor>(); 
    72                 for(int i =0;i<3000000;i++){ 
    73                         schemas.ComputingResource compResDef = new schemas.ComputingResource(); 
    74                         compResDef.setName("a"+i); 
    75                         compResDef.setClazz("Processor"); 
    76                         CompResourceDescription resDesc = new CompResourceDescription(compResDef); 
    77                         Processor proc = new Processor(resDesc); 
    78                         list.add(proc); 
    79                 } 
    80                 long e = System.currentTimeMillis(); 
    81                 System.out.println("end: "); 
    82                 System.out.println(e-s);*/ 
    8372                Environment env = Environment.unmarshal(new FileReader(file)); 
    8473                 
     
    9786                ResourceController rc = new ResourceController(mainScheduler, computingResources); 
    9887                rc.setInitList(toInit); 
     88                rc.setCompResLayers(compResLayers); 
    9989                return rc; 
    10090        } 
     
    177167 
    178168                List<ComputingResource> mainCompResourceList = new ArrayList<ComputingResource>(); 
    179                  
    180169                Deque<ComputingResourceDescription> toExamine = new ArrayDeque<ComputingResourceDescription>(); 
    181170                Deque<ComputingResource> resStructure = new ArrayDeque<ComputingResource>(); 
     
    192181                        ComputingResource parentResource = resStructure.pop(); 
    193182                        toInit.add(parentResource); 
     183                        compResLayers.add(parentResource.getType().getName()); 
    194184                        List<AbstractResourceDescription> childrenResDesc = parentResDesc.getChildren(); 
    195185                        if (childrenResDesc == null){ 
     
    250240                //TODO - refactor (remove - create scheduler on the basis of resource description) 
    251241                Scheduler mainScheduler = null; 
    252                 if(mainSchedulers.size() == 1 && mainSchedulers.get(0).get_name().equals("grid")){ 
     242                if(mainSchedulers.size() == 1 /*&& mainSchedulers.get(0).get_name().equals("grid")*/){ 
    253243                        mainScheduler = mainSchedulers.get(0); 
    254244                } 
     
    261251                        ManagedResources managedResources = new ManagedResources(mainCompResourceList, new HashMap<ResourceUnitName, List<ResourceUnit>>()); 
    262252                        mainScheduler = ResourceFactory.createScheduler(StandardResourceType.GS, "grid", schedulingPlugin , execTimeEstimationPlugin,  queues, managedResources); 
    263                         /*ManagementSystem ms = new GridBroker("grid", 
    264                                         globalSchedulingPluginName, execTimeEstimationPlugin); 
    265                         mainScheduler = new Scheduler(ms, mainCompResourceList);*/ 
     253 
    266254                        for(Scheduler lr: mainSchedulers){ 
    267255                                mainScheduler.addChild(lr); 
     
    280268                TaskQueueList queues = new TaskQueueList(1); 
    281269                 
    282                 if(schedulerDef.getQueue() != null && schedulerDef.getQueueCount() > 0){ 
    283                         int queueCount = schedulerDef.getQueueCount(); 
     270                if(schedulerDef.getQueues()!= null){ 
     271                        int queueCount = schedulerDef.getQueues().getQueueCount(); 
    284272                        for(int i = 0; i < queueCount; i++){ 
    285                                 schemas.QueueType queueDef = schedulerDef.getQueue(i); 
     273                                schemas.QueueType queueDef = schedulerDef.getQueues().getQueue(i); 
    286274                                TaskQueue queue = new TaskQueue(queueDef.getReservation()); 
    287275                                queue.setName(queueDef.getName()); 
  • DCWoRMS/trunk/build/classes/simulator/stats/AccumulatedStatistics.java

    r477 r539  
    1010import java.util.List; 
    1111 
    12 import simulator.stats.implementation.GSSimStatistics; 
     12import simulator.stats.implementation.DCWormsStatistics; 
    1313import gridsim.Accumulator; 
    1414 
  • DCWoRMS/trunk/build/classes/simulator/stats/implementation/GSSAccumulatorsStats.java

    r477 r539  
    1010        public GSSAccumulator meanQueueLength; 
    1111        public GSSAccumulator meanEnergyUsage; 
     12        public GSSAccumulator meanAirFlow; 
    1213 
    1314        public GSSAccumulator meanTaskStartTime; 
     
    2930                meanReservationLoad = new GSSAccumulator(); 
    3031                meanQueueLength = new GSSAccumulator(); 
    31                 meanEnergyUsage = new GSSAccumulator(); 
     32                meanEnergyUsage = new GSSAccumulator();  
     33                meanAirFlow = new GSSAccumulator();  
    3234 
    3335                meanTaskStartTime = new GSSAccumulator(); 
  • DCWoRMS/trunk/build/classes/simulator/stats/implementation/ResourceUsageStats.java

    r477 r539  
    11package simulator.stats.implementation; 
    22 
    3 import java.util.Map; 
    4 import java.util.TreeMap; 
    5  
    63import schedframe.resources.ResourceType; 
    7 import schedframe.resources.StandardResourceType; 
    84import simulator.stats.implementation.out.StatsSerializer; 
    95 
    10 /** 
    11  *  
    12  * @author Marcin Krystek 
    13  *  
    14  */ 
    15 public class ResourceUsageStats implements StatsInterface { 
     6public class ResourceUsageStats extends ResourceDynamicStats implements StatsInterface { 
    167 
    17         protected Map<Long, Integer> usage; 
    18         protected String resourceName; 
    19         protected String usageType; 
    20         protected ResourceType resourceType; 
    21         protected double meanUsage; 
    22          
    23         public void setMeanUsage(double meanUsage) { 
    24                 this.meanUsage = meanUsage; 
    25         } 
    26  
    27         private String[] headers = { "resourceName", "timestamp", "usage" }; 
     8        private String[] headers = { "resourceName", "timestamp", "utilization" }; 
    289 
    2910        public ResourceUsageStats(String resourceName, ResourceType resourceType, String usageType) { 
    30                 this.resourceName = resourceName; 
    31                 this.resourceType = resourceType; 
    32                 this.usageType = usageType; 
    33                 this.usage = new TreeMap<Long, Integer>(); 
    34                 this.meanUsage = 0; 
    35         } 
    36  
    37         public double getMeanUsage() { 
    38                 return meanUsage; 
    39         } 
    40  
    41         public String getResourceName() { 
    42                 return this.resourceName; 
    43         } 
    44          
    45         public ResourceType getResourceType() { 
    46                 return resourceType; 
    47         } 
    48          
    49         public String getUsageType() { 
    50                 return this.usageType; 
    51         }        
    52  
    53         public Map<Long, Integer> getUsage() { 
    54                 return this.usage; 
     11                super(resourceName, resourceType, usageType); 
    5512        } 
    5613 
     
    6219                return headers; 
    6320        } 
    64  
    6521} 
  • DCWoRMS/trunk/build/classes/simulator/stats/implementation/TaskStats.java

    r477 r539  
    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; 
     
    4546 
    4647        public String getUserDN() { 
    47                 return this.task.getUserDn(); 
     48                return this.task.getUserDN(); 
    4849        } 
    4950 
    5051        public String getResName() { 
    51                 String resNames[] = this.task.getAllResourceName(); 
    52                 String resName = ""; 
    53                 for (int i = 0; i < resNames.length; i++) { 
    54                         resName += resNames[i]; 
    55                         if (resNames.length > 1) 
    56                                 resName += " "; 
    57                 } 
     52                String resName = this.task.getSchedulerName(); 
     53 
    5854                return resName; 
    5955        } 
  • DCWoRMS/trunk/build/classes/simulator/stats/implementation/out/StatsSerializer.java

    r477 r539  
    44import simulator.stats.implementation.GSSAccumulatorsStats; 
    55import simulator.stats.implementation.JobStats; 
    6 import simulator.stats.implementation.ResourceEnergyStats; 
     6import simulator.stats.implementation.ResourceAirFlowStats; 
     7import simulator.stats.implementation.ResourcePowerStats; 
    78import simulator.stats.implementation.ResourceStats; 
    89import simulator.stats.implementation.ResourceUsageStats; 
     
    2627        public Object visit(ResourceUsageStats arg); 
    2728         
    28         public Object visit(ResourceEnergyStats arg); 
     29        public Object visit(ResourcePowerStats arg); 
    2930 
     31        public Object visit(ResourceAirFlowStats arg); 
    3032         
    3133        public Object visit(GSSAccumulatorsStats arg); 
  • DCWoRMS/trunk/build/classes/simulator/stats/implementation/out/StringSerializer.java

    r477 r539  
    1111import simulator.stats.implementation.GSSAccumulatorsStats; 
    1212import simulator.stats.implementation.JobStats; 
    13 import simulator.stats.implementation.ResourceEnergyStats; 
     13import simulator.stats.implementation.ResourceAirFlowStats; 
     14import simulator.stats.implementation.ResourcePowerStats; 
    1415import simulator.stats.implementation.ResourceStats; 
    1516import simulator.stats.implementation.ResourceUsageStats; 
     
    258259 
    259260        public Object visit(ResourceUsageStats resourceUsageStats) { 
    260                 Map<Long, Integer> resourceUsage = resourceUsageStats.getUsage(); 
     261                Map<Long, Double> resourceUsage = resourceUsageStats.getHistory(); 
    261262                 
    262263                int mapSize = resourceUsage.size(); 
     
    297298                        buffer.append(resourceUsageStats.getResourceName()); 
    298299                        buffer.append(fieldSeparator); 
    299                         Integer value = resourceUsage.get(timestamp); 
     300                        Double value = resourceUsage.get(timestamp); 
    300301                        buffer.append(timestamp); 
    301302                        buffer.append(fieldSeparator); 
     
    306307 
    307308                } 
    308  
    309                 buffer.append("mean: " + resourceUsageStats.getMeanUsage()); 
    310                 buffer.append(System.getProperty("line.separator")); 
    311                 return buffer.toString(); 
    312         } 
    313  
    314         public Object visit(ResourceEnergyStats resourceEnergyStats) { 
    315                 Map<Long, Double> resourceEnergy = resourceEnergyStats.getEnergy(); 
     309                if(resourceUsage.size() > 0){ 
     310                        buffer.append("mean: " + resourceUsageStats.getMeanValue()); 
     311                        buffer.append(System.getProperty("line.separator"));     
     312                } 
     313                return buffer.toString(); 
     314        } 
     315 
     316        public Object visit(ResourcePowerStats resourceEnergyStats) { 
     317                Map<Long, Double> resourceEnergy = resourceEnergyStats.getHistory(); 
    316318                 
    317319                int mapSize = resourceEnergy.size(); 
     
    361363 
    362364                } 
    363                 buffer.append("mean: "+resourceEnergyStats.getMeanUsage() + " sum: " +resourceEnergyStats.getSumUsage()); 
    364                 buffer.append(System.getProperty("line.separator")); 
     365                 
     366                if(resourceEnergy.size() > 0) { 
     367                        buffer.append("mean: "+resourceEnergyStats.getMeanValue() + " sum: " +resourceEnergyStats.getSumValue()); 
     368                        buffer.append(System.getProperty("line.separator"));     
     369                } 
     370 
     371                return buffer.toString(); 
     372        } 
     373 
     374        public Object visit(ResourceAirFlowStats resourceAirFlowStats) { 
     375                Map<Long, Double> resourceAirFlow = resourceAirFlowStats.getHistory(); 
     376                 
     377                int mapSize = resourceAirFlow.size(); 
     378                /* 
     379                 * FIXME: 
     380                 * Integer.MAX_VALUE = 2147483647. We assume, that each line contains  
     381                 * max 30 signs - this gives max 71582788 lines. If resourceUsage map 
     382                 * contains more elements then we have a problem, because content of 
     383                 * resourceUsage map will not fit in the buffer. 
     384                 * This will need further attention in the future. 
     385                 */ 
     386                int maxSize = (Integer.MAX_VALUE / 30 ) - 1; 
     387                if(mapSize >= maxSize){ 
     388                        log.error("Resource usage data is to long to fit in the buffer."); 
     389                        return null; 
     390                } 
     391                 
     392                int size = 30 * resourceAirFlow.size(); 
     393                 
     394                StringBuffer buffer = null; 
     395 
     396                if(printedHeaders.add(resourceAirFlowStats.getUsageType())) { 
     397                        buffer = new StringBuffer(size + 42); 
     398                        String[] headers = resourceAirFlowStats.getHeaders(); 
     399                        for(int i = 0; i < headers.length; i++) 
     400                        { 
     401                                buffer.append(headers[i]); 
     402                                buffer.append(fieldSeparator); 
     403                        } 
     404                        buffer.append(System.getProperty("line.separator")); 
     405                } else { 
     406                        buffer = new StringBuffer(size); 
     407                } 
     408                 
     409                 
     410                for (Long timestamp : resourceAirFlow.keySet()) { 
     411                         
     412                        buffer.append(resourceAirFlowStats.getResourceName()); 
     413                        buffer.append(fieldSeparator); 
     414                        Double value = resourceAirFlow.get(timestamp); 
     415                        buffer.append(timestamp); 
     416                        buffer.append(fieldSeparator); 
     417                        buffer.append(DataCenterWorkloadSimulator.DFAULT_NUMBER_FORMAT 
     418                                        .format(value)); 
     419                        buffer.append(fieldSeparator); 
     420                        buffer.append(System.getProperty("line.separator")); 
     421 
     422                } 
     423                 
     424                if(resourceAirFlow.size() > 0) { 
     425                        buffer.append("mean: "+resourceAirFlowStats.getMeanValue() + " sum: " +resourceAirFlowStats.getSumValue()); 
     426                        buffer.append(System.getProperty("line.separator"));     
     427                } 
    365428 
    366429                return buffer.toString(); 
  • DCWoRMS/trunk/build/classes/simulator/utils/XsltTransformations.java

    r477 r539  
    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/build/classes/simulator/workload/WorkloadLoader.java

    r477 r539  
    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 
  • DCWoRMS/trunk/build/classes/simulator/workload/generator/impl/QcgJobGenerator.java

    r477 r539  
    5858import org.xml.sax.InputSource; 
    5959 
    60 import simulator.WormsConstants; 
     60import simulator.DCWormsConstants; 
    6161import simulator.utils.GSSimXML; 
    6262import simulator.utils.XsltTransformations; 
     
    259259                         
    260260                        //initially - a standard value 
    261                         taskCountToBeGenerated = WormsConstants.DEFAULT_TASK_COUNT_IN_SINGLE_JOB;  
     261                        taskCountToBeGenerated = DCWormsConstants.DEFAULT_TASK_COUNT_IN_SINGLE_JOB;  
    262262                         
    263263                        try { 
Note: See TracChangeset for help on using the changeset viewer.