- Timestamp:
- 10/31/12 13:52:06 (12 years ago)
- Location:
- DCWoRMS/trunk/build/classes/simulator/stats/implementation
- Files:
-
- 11 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
DCWoRMS/trunk/build/classes/simulator/stats/implementation/GSSAccumulatorsStats.java
r477 r539 10 10 public GSSAccumulator meanQueueLength; 11 11 public GSSAccumulator meanEnergyUsage; 12 public GSSAccumulator meanAirFlow; 12 13 13 14 public GSSAccumulator meanTaskStartTime; … … 29 30 meanReservationLoad = new GSSAccumulator(); 30 31 meanQueueLength = new GSSAccumulator(); 31 meanEnergyUsage = new GSSAccumulator(); 32 meanEnergyUsage = new GSSAccumulator(); 33 meanAirFlow = new GSSAccumulator(); 32 34 33 35 meanTaskStartTime = new GSSAccumulator(); -
DCWoRMS/trunk/build/classes/simulator/stats/implementation/ResourceUsageStats.java
r477 r539 1 1 package simulator.stats.implementation; 2 2 3 import java.util.Map;4 import java.util.TreeMap;5 6 3 import schedframe.resources.ResourceType; 7 import schedframe.resources.StandardResourceType;8 4 import simulator.stats.implementation.out.StatsSerializer; 9 5 10 /** 11 * 12 * @author Marcin Krystek 13 * 14 */ 15 public class ResourceUsageStats implements StatsInterface { 6 public class ResourceUsageStats extends ResourceDynamicStats implements StatsInterface { 16 7 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" }; 28 9 29 10 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); 55 12 } 56 13 … … 62 19 return headers; 63 20 } 64 65 21 } -
DCWoRMS/trunk/build/classes/simulator/stats/implementation/TaskStats.java
r477 r539 1 1 package simulator.stats.implementation; 2 2 3 import gssim.schedframe.scheduling.Executable;4 3 5 4 import java.util.List; 5 6 import dcworms.schedframe.scheduling.Executable; 6 7 7 8 import simulator.stats.implementation.out.StatsSerializer; … … 45 46 46 47 public String getUserDN() { 47 return this.task.getUserD n();48 return this.task.getUserDN(); 48 49 } 49 50 50 51 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 58 54 return resName; 59 55 } -
DCWoRMS/trunk/build/classes/simulator/stats/implementation/out/StatsSerializer.java
r477 r539 4 4 import simulator.stats.implementation.GSSAccumulatorsStats; 5 5 import simulator.stats.implementation.JobStats; 6 import simulator.stats.implementation.ResourceEnergyStats; 6 import simulator.stats.implementation.ResourceAirFlowStats; 7 import simulator.stats.implementation.ResourcePowerStats; 7 8 import simulator.stats.implementation.ResourceStats; 8 9 import simulator.stats.implementation.ResourceUsageStats; … … 26 27 public Object visit(ResourceUsageStats arg); 27 28 28 public Object visit(Resource EnergyStats arg);29 public Object visit(ResourcePowerStats arg); 29 30 31 public Object visit(ResourceAirFlowStats arg); 30 32 31 33 public Object visit(GSSAccumulatorsStats arg); -
DCWoRMS/trunk/build/classes/simulator/stats/implementation/out/StringSerializer.java
r477 r539 11 11 import simulator.stats.implementation.GSSAccumulatorsStats; 12 12 import simulator.stats.implementation.JobStats; 13 import simulator.stats.implementation.ResourceEnergyStats; 13 import simulator.stats.implementation.ResourceAirFlowStats; 14 import simulator.stats.implementation.ResourcePowerStats; 14 15 import simulator.stats.implementation.ResourceStats; 15 16 import simulator.stats.implementation.ResourceUsageStats; … … 258 259 259 260 public Object visit(ResourceUsageStats resourceUsageStats) { 260 Map<Long, Integer> resourceUsage = resourceUsageStats.getUsage();261 Map<Long, Double> resourceUsage = resourceUsageStats.getHistory(); 261 262 262 263 int mapSize = resourceUsage.size(); … … 297 298 buffer.append(resourceUsageStats.getResourceName()); 298 299 buffer.append(fieldSeparator); 299 Integervalue = resourceUsage.get(timestamp);300 Double value = resourceUsage.get(timestamp); 300 301 buffer.append(timestamp); 301 302 buffer.append(fieldSeparator); … … 306 307 307 308 } 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(); 316 318 317 319 int mapSize = resourceEnergy.size(); … … 361 363 362 364 } 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 } 365 428 366 429 return buffer.toString();
Note: See TracChangeset
for help on using the changeset viewer.