Ignore:
Timestamp:
11/30/12 13:24:51 (12 years ago)
Author:
wojtekp
Message:
 
File:
1 edited

Legend:

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

    r544 r687  
    5050import org.jfree.data.xy.XYSeriesCollection; 
    5151import org.jfree.ui.TextAnchor; 
     52import org.joda.time.DateTime; 
    5253import org.joda.time.DateTimeUtilsExt; 
    5354 
     
    173174        public void generateStatistics() { 
    174175 
    175                 this.startSimulationTime = DateTimeUtilsExt.getOffsetTime().getTimeInMillis(); 
     176                if(users.isSimStartTimeDefined()) 
     177                        this.startSimulationTime = DateTimeUtilsExt.getOffsetTime().getTimeInMillis(); 
     178                else 
     179                        this.startSimulationTime = new DateTime(users.getSubmissionStartTime() * 1000l).getMillis(); 
    176180                this.endSimulationTime = DateTimeUtilsExt.currentTimeMillis(); 
    177181 
     
    204208 
    205209        private void init() { 
    206  
    207210                task_processorsMap = new HashMap<String, List<String>>(); 
    208211                accStats = new GSSAccumulatorsStats(); 
     
    683686                XYSeriesCollection dataset = new XYSeriesCollection(); 
    684687                XYSeries data = new XYSeries(dynamicStats.getResourceName(), false, true); 
    685                 //data.add(start, 0); 
     688                data.add(start, 0); 
    686689                for (Long key : chartData.keySet()) { 
    687690                        Double val = chartData.get(key); 
    688                         data.add(key, val); 
     691                        if(key >= startSimulationTime) 
     692                                data.add(key, val); 
    689693                } 
    690694                data.add(end, 0); 
     
    726730                                return false; 
    727731                } 
    728  
     732                chartName = "Load diagram for " 
     733                        + DataCenterWorkloadSimulator.SIMULATOR_NAME; 
    729734                JFreeChart resourceLoadDiagram = null; 
    730735                if (configuration.creatediagrams_resutilization) { 
     
    738743                } 
    739744                 
     745                chartName = "Energy usage diagram for " 
     746                        + DataCenterWorkloadSimulator.SIMULATOR_NAME; 
    740747                JFreeChart resourceEnergyDiagram = null; 
    741748                if (configuration.creatediagrams_respowerusage) { 
     
    749756                } 
    750757                 
     758                chartName = "Air flow diagram for " 
     759                        + DataCenterWorkloadSimulator.SIMULATOR_NAME; 
    751760                JFreeChart resourceAirFlowDiagram = null; 
    752761                if (configuration.creatediagrams_resairflow) { 
     
    923932        private double calculateMeanValue(ResourceDynamicStats resDynamicStats ){ 
    924933                double meanValue = 0; 
    925                 long time = 0; 
     934                long time = -1; 
    926935                double value = 0; 
    927936                 
     
    929938                for (Long key : history.keySet()) { 
    930939                         
    931                         if (time != 0) { 
    932                                 meanValue += (value * (key - time)) / (endSimulationTime - startSimulationTime); 
    933                                 time = key; 
    934                         } else { 
    935                                 time = key; 
     940                        if(key >= startSimulationTime){ 
     941                                if (time != -1) { 
     942                                        meanValue += (value * (key - time)) / (endSimulationTime - startSimulationTime); 
     943                                        time = key; 
     944                                } else { 
     945                                        time = key; 
     946                                }        
    936947                        } 
    937948                        value = history.get(key); 
     
    11671178                                .getAbsolutePath(); 
    11681179 
    1169                 String chartName = "Gantt diagram for " + DataCenterWorkloadSimulator.SIMULATOR_NAME; 
     1180                String chartName = "Task diagram for " + DataCenterWorkloadSimulator.SIMULATOR_NAME; 
    11701181                String simulationTime = "Simulation time"; 
    11711182                Title subtitle = new TextTitle("created for \"" + simulationIdentifier + "\" at " 
     
    11781189                } 
    11791190 
     1191                chartName = "Task waiting times diagram for " + DataCenterWorkloadSimulator.SIMULATOR_NAME; 
    11801192                if (configuration.creatediagrams_taskswaitingtime) { 
    11811193                        waitingTimeDiagram = getWaitingTimeDiagram(chartName, subtitle, simulationTime); 
Note: See TracChangeset for help on using the changeset viewer.