Changeset 481 for DCWoRMS/trunk/src/simulator
- Timestamp:
- 10/08/12 10:23:45 (13 years ago)
- Location:
- DCWoRMS/trunk/src/simulator
- Files:
-
- 1 deleted
- 4 edited
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
DCWoRMS/trunk/src/simulator/DCWormsConstants.java
r477 r481 3 3 import eduni.simjava.Sim_stat; 4 4 5 public class WormsConstants {5 public class DCWormsConstants { 6 6 7 7 public static final String START_TIME="start_time"; -
DCWoRMS/trunk/src/simulator/DCWormsUsers.java
r477 r481 7 7 import gridsim.Gridlet; 8 8 import gridsim.IO_data; 9 import gridsim.gssim.DCWormsTags; 9 10 import gridsim.net.InfoPacket; 10 11 import gssim.schedframe.scheduling.utils.JobDescription; … … 31 32 import simulator.workload.WorkloadLoader; 32 33 33 public class WormsUsers extends GridSim implements GenericUser {34 public class DCWormsUsers extends GridSim implements GenericUser { 34 35 35 36 /**A job generator, which produces jobs and tasks. These jobs are then sent by this entity */ … … 54 55 protected boolean error; 55 56 56 private static Log log = LogFactory.getLog( WormsUsers.class);57 private static Log log = LogFactory.getLog(DCWormsUsers.class); 57 58 58 59 /** … … 63 64 * @throws Exception if any occurs (see {@link GridSim#GridSim(String, double)}) 64 65 */ 65 public WormsUsers(String name, String destinationName, WorkloadLoader workload) throws Exception {66 super(name, WormsConstants.DEFAULT_BAUD_RATE);66 public DCWormsUsers(String name, String destinationName, WorkloadLoader workload) throws Exception { 67 super(name, DCWormsConstants.DEFAULT_BAUD_RATE); 67 68 this.workloadLoader = workload; 68 69 destName = destinationName; … … 259 260 for (JobInterface<?> job : returnedJobs) { 260 261 for (TaskInterface<?> task: job.getTask()) { 261 if(task.getStatus() == Gridlet.SUCCESS)262 if(task.getStatus() == DCWormsTags.SUCCESS) 262 263 result++; 263 264 } -
DCWoRMS/trunk/src/simulator/DataCenterWorkloadSimulator.java
r477 r481 26 26 import simulator.reader.ResourceReader; 27 27 import simulator.stats.AccumulatedStatistics; 28 import simulator.stats.implementation. WormsStatistics;28 import simulator.stats.implementation.DCWormsStatistics; 29 29 import simulator.utils.LogErrStream; 30 30 import simulator.workload.WorkloadLoader; … … 40 40 * {@link #main(String[])} method used to invoke the program. This class also 41 41 * provides second possibility to start the simulator, namely one may use the 42 * {@link #performSimulation(ConfigurationOptions, WormsStatistics)} method.42 * {@link #performSimulation(ConfigurationOptions, DCWormsStatistics)} method. 43 43 * In this case, the input parameter, describing the simulation options, must be 44 44 * earlier prepared. The results of the simulation can be acquired using the … … 269 269 rc.setInitList(null); 270 270 271 WormsUsers wl = newWormsUsers("Users",271 DCWormsUsers wl = new DCWormsUsers("Users", 272 272 rc.getScheduler().get_name(), workload); 273 273 … … 275 275 long stopSimulation = System.currentTimeMillis(); 276 276 277 WormsStatistics stats = newWormsStatistics(simulationIdentifier,277 DCWormsStatistics stats = new DCWormsStatistics(simulationIdentifier, 278 278 options, wl, statsOutputPath, rc); 279 279 accumulatedStatistics.add(stats); -
DCWoRMS/trunk/src/simulator/stats/AccumulatedStatistics.java
r477 r481 10 10 import java.util.List; 11 11 12 import simulator.stats.implementation. WormsStatistics;12 import simulator.stats.implementation.DCWormsStatistics; 13 13 import gridsim.Accumulator; 14 14 -
DCWoRMS/trunk/src/simulator/stats/implementation/DCWormsStatistics.java
r477 r481 49 49 import org.jfree.data.xy.XYSeriesCollection; 50 50 import org.jfree.ui.TextAnchor; 51 import org.joda.time.DateTime;52 51 import org.joda.time.DateTimeUtilsExt; 53 52 53 import schedframe.ExecutablesList; 54 54 import schedframe.ResourceController; 55 55 import schedframe.exceptions.ResourceException; … … 69 69 import schedframe.scheduling.ResourceHistoryItem; 70 70 import schedframe.scheduling.Scheduler; 71 import schedframe.scheduling.manager.tasks.JobRegistry; 71 72 import schedframe.scheduling.manager.tasks.JobRegistryImpl; 72 73 import schedframe.scheduling.tasks.Job; 73 74 import schedframe.scheduling.tasks.JobInterface; 74 75 import simulator.ConfigurationOptions; 76 import simulator.DCWormsConstants; 75 77 import simulator.DataCenterWorkloadSimulator; 76 78 import simulator.GenericUser; 77 import simulator.WormsConstants;78 79 import simulator.stats.GSSAccumulator; 79 80 import simulator.stats.SimulationStatistics; … … 90 91 import gssim.schedframe.scheduling.Executable; 91 92 92 public class WormsStatistics implements SimulationStatistics {93 94 private Log log = LogFactory.getLog( WormsStatistics.class);93 public class DCWormsStatistics implements SimulationStatistics { 94 95 private Log log = LogFactory.getLog(DCWormsStatistics.class); 95 96 96 97 protected static float ALPHA = 0.5f; … … 98 99 99 100 //protected static final int BITS = 8; 100 //protected static final int MILLI_SEC = 1000;101 protected static final int MILLI_SEC = 1000; 101 102 102 103 protected static final String RAW_TASKS_STATISTICS_OUTPUT_FILE_NAME = "Tasks.txt"; … … 117 118 protected String simulationIdentifier; 118 119 protected ConfigurationOptions configuration; 119 120 120 121 121 protected GSSAccumulatorsStats accStats; … … 129 129 protected long endSimulationTime; 130 130 131 132 131 //RESOURCES 133 132 protected Timetable ganttDiagramPeTimetable; … … 140 139 protected Map<String, TimetableEventGroup> taskGanttMap; 141 140 142 143 141 //TASKS 144 142 protected int numOfdelayedTasks = 0; … … 151 149 protected HashMap<String, List<String>> task_processorsMap; 152 150 153 154 151 protected JobRegistryImpl jr; 155 152 156 153 157 public WormsStatistics(String simulationIdentifier, ConfigurationOptions co, GenericUser users,154 public DCWormsStatistics(String simulationIdentifier, ConfigurationOptions co, GenericUser users, 158 155 String outputFolderName, ResourceController resourceController) { 159 156 this.simulationIdentifier = simulationIdentifier; … … 188 185 gatherResourceStatistics(); 189 186 e = System.currentTimeMillis(); 190 log.info("time in sec: " + ((e - s) / 1000));187 log.info("time in sec: " + ((e - s) / MILLI_SEC)); 191 188 192 189 log.info("gatherTaskStatistics"); … … 194 191 gatherTaskStatistics(); 195 192 e = System.currentTimeMillis(); 196 log.info("time in sec: " + ((e - s) / 1000));193 log.info("time in sec: " + ((e - s) / MILLI_SEC)); 197 194 198 195 log.info("saveSimulationStatistics"); … … 200 197 saveSimulationStatistics(); 201 198 e = System.currentTimeMillis(); 202 log.info("time in sec: " + ((e - s) / 1000));199 log.info("time in sec: " + ((e - s) / MILLI_SEC)); 203 200 } 204 201 … … 299 296 energyStatsFile = null; 300 297 } 301 302 basicResStats = gatherPEStats( JobRegistryImpl.getAllocationHistory());298 JobRegistry jr = new JobRegistryImpl("stats"); 299 basicResStats = gatherPEStats(jr.getExecutableTasks()); 303 300 peStatsPostProcessing(basicResStats); 304 301 basicResLoad = calculatePELoad( basicResStats); … … 342 339 energyUsage = gatherResourceEnergyStats(resource); 343 340 energyUsage.setMeanUsage(calculateEnergyLoad(energyUsage)); 344 energyUsage.setSumUsage(energyUsage.getMeanUsage() * (endSimulationTime - startSimulationTime) / (3600 * 1000));341 energyUsage.setSumUsage(energyUsage.getMeanUsage() * (endSimulationTime - startSimulationTime) / (3600 * MILLI_SEC)); 345 342 346 343 EnergyExtension een = (EnergyExtension )(resource.getExtensionList().getExtension(ExtensionType.ENERGY_EXTENSION)); … … 428 425 for(String key: energyCategoryStats.keySet()){ 429 426 GSSAccumulator acc = energyCategoryStats.get(key); 430 energyStatsFile.println(key + "- mean: " + acc.getMean()+ " sum: " +acc.getMean() * (endSimulationTime-startSimulationTime) / (3600 * 1000) * acc.getCount());427 energyStatsFile.println(key + "- mean: " + acc.getMean()+ " sum: " +acc.getMean() * (endSimulationTime-startSimulationTime) / (3600 * MILLI_SEC) * acc.getCount()); 431 428 } 432 429 energyStatsFile.println("\n\n"); … … 462 459 String measure = (String) info[0]; 463 460 if (measure 464 .startsWith( WormsConstants.TASKS_QUEUE_LENGTH_MEASURE_NAME)) {461 .startsWith(DCWormsConstants.TASKS_QUEUE_LENGTH_MEASURE_NAME)) { 465 462 return stats.average(measure); 466 463 } … … 492 489 } 493 490 } 494 private Map<String, List<ResStat>> gatherPEStats(Map<Integer, Map<String, Object>> history) { 495 491 private Map<String, List<ResStat>> gatherPEStats( ExecutablesList executables) { 492 493 496 494 Map<String, List<ResStat>> basicResStats = new TreeMap<String, List<ResStat>>(new MapPEIdComparator()); 497 498 for (Integer executableId : history.keySet()) { 499 500 Map<String, Object> historyItem = (Map<String, Object>) history.get(executableId); 501 List<ResourceHistoryItem> resHistItemList = (List<ResourceHistoryItem>) historyItem.get(WormsConstants.RESOURCES); 495 //Map<Integer, Map<String, Object>> history 496 497 for (ExecTask execTask:executables) { 498 Executable exec = (Executable) execTask; 499 500 List<ResourceHistoryItem> resHistItemList = exec.getUsedResources(); 502 501 Map<ResourceUnitName, ResourceUnit> res = resHistItemList.get(resHistItemList.size() - 1).getResourceUnits(); 503 502 ResourceUnit resUnit = res.get(StandardResourceUnitName.PE); … … 507 506 for(ComputingResource pe: pes){ 508 507 String peName = pe.getName(); 509 long startDate = ((DateTime) historyItem.get(WormsConstants.START_TIME)).getMillis();510 long endDate = ((DateTime) historyItem.get(WormsConstants.END_TIME)).getMillis();511 JobRegistryImpl jr = new JobRegistryImpl("stats"); 512 ExecTask execTask = jr.getTaskExecutable(executableId); 508 long startDate = Double.valueOf(exec.getExecStartTime()).longValue() * MILLI_SEC; 509 long endDate = Double.valueOf(exec.getFinishTime()).longValue() * MILLI_SEC; 510 511 513 512 String uniqueTaskID = execTask.getJobId() + "_" + execTask.getId(); 514 513 … … 535 534 } else if (resUnit instanceof PEUnit){ 536 535 PEUnit peUnit = (PEUnit) resUnit ; 537 538 536 } 539 537 … … 629 627 630 628 /// System.out.println(resource.getName() + ":"+new DateTime(pu.getTimestamp())+";"+pu.getValue()); 631 power = power + (pu.getTimestamp() - lastTime) * lastPower/ (3600 * 1000);629 power = power + (pu.getTimestamp() - lastTime) * lastPower/ (3600 * MILLI_SEC); 632 630 lastPower = pu.getValue(); 633 631 lastTime = pu.getTimestamp(); … … 1026 1024 1027 1025 //List<TaskInterface> execList = JobRegistry.getInstance("COMPUTING_GRID_0#BROKER").getAllSubmittedTasks(); 1028 List<Executable> execList = jr.get JobExecutables(job.getId());1026 List<Executable> execList = jr.getExecutableTasks().getJobExecutables(job.getId()); 1029 1027 List<TaskStats> taskStatsList = new ArrayList<TaskStats>(); 1030 1028 … … 1143 1141 String uniqueTaskID = task.getJobId() + "_" + task.getId(); 1144 1142 1145 String resIDlist[] = task.getAllResourceName(); 1146 String resID = resIDlist[resIDlist.length - 1]; 1147 1148 long execStartTime = Double.valueOf(task.getExecStartTime()).longValue() * 1000; 1149 long execEndTime = Double.valueOf(task.getFinishTime()).longValue() * 1000; 1143 String resID = task.getSchedulerName(); 1144 1145 long execStartTime = Double.valueOf(task.getExecStartTime()).longValue() * MILLI_SEC; 1146 long execEndTime = Double.valueOf(task.getFinishTime()).longValue() * MILLI_SEC; 1150 1147 1151 1148 TaskSeries taskRes = ganttDiagramTaskSeriesCollection.getSeries(resID); … … 1165 1162 String uniqueTaskID = task.getJobId() + "_" + task.getId(); 1166 1163 1167 String resIDlist[] = task.getAllResourceName(); 1168 String resID = resIDlist[resIDlist.length - 1]; 1169 1170 long execStartTime = Double.valueOf(task.getExecStartTime()).longValue() * 1000; 1171 long execEndTime = Double.valueOf(task.getFinishTime()).longValue() * 1000; 1164 String resID = task.getSchedulerName(); 1165 1166 long execStartTime = Double.valueOf(task.getExecStartTime()).longValue() * MILLI_SEC; 1167 long execEndTime = Double.valueOf(task.getFinishTime()).longValue() * MILLI_SEC; 1172 1168 1173 1169 TaskSeries waitRes = ganttDiagramWaitingTimeSeriesCollection.getSeries(resID); … … 1177 1173 } 1178 1174 1179 long sub = Double.valueOf(task.getSubmissionTime()).longValue() * 1000;1175 long sub = Double.valueOf(task.getSubmissionTime()).longValue() * MILLI_SEC; 1180 1176 org.jfree.data.gantt.Task wait_exec = new org.jfree.data.gantt.Task(uniqueTaskID, new Date(sub), new Date( 1181 1177 execEndTime)); -
DCWoRMS/trunk/src/simulator/stats/implementation/TaskStats.java
r480 r481 49 49 50 50 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 } 51 String resName = this.task.getSchedulerName(); 52 58 53 return resName; 59 54 } -
DCWoRMS/trunk/src/simulator/workload/generator/impl/QcgJobGenerator.java
r477 r481 58 58 import org.xml.sax.InputSource; 59 59 60 import simulator. WormsConstants;60 import simulator.DCWormsConstants; 61 61 import simulator.utils.GSSimXML; 62 62 import simulator.utils.XsltTransformations; … … 259 259 260 260 //initially - a standard value 261 taskCountToBeGenerated = WormsConstants.DEFAULT_TASK_COUNT_IN_SINGLE_JOB;261 taskCountToBeGenerated = DCWormsConstants.DEFAULT_TASK_COUNT_IN_SINGLE_JOB; 262 262 263 263 try {
Note: See TracChangeset
for help on using the changeset viewer.