- Timestamp:
- 10/10/12 12:12:06 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
DCWoRMS/trunk/src/simulator/stats/implementation/out/StringSerializer.java
r477 r495 11 11 import simulator.stats.implementation.GSSAccumulatorsStats; 12 12 import simulator.stats.implementation.JobStats; 13 import simulator.stats.implementation.ResourceAirFlowStats; 13 14 import simulator.stats.implementation.ResourceEnergyStats; 14 15 import simulator.stats.implementation.ResourceStats; … … 258 259 259 260 public Object visit(ResourceUsageStats resourceUsageStats) { 260 Map<Long, Integer> resourceUsage = resourceUsageStats.getUsage();261 Map<Long, Double> resourceUsage = resourceUsageStats.getUsage(); 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); … … 371 372 } 372 373 374 public Object visit(ResourceAirFlowStats resourceAirFlowStats) { 375 Map<Long, Double> resourceAirFlow = resourceAirFlowStats.getAirFlow(); 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.getMeanUsage() + " sum: " +resourceAirFlowStats.getSumUsage()); 426 buffer.append(System.getProperty("line.separator")); 427 } 428 429 return buffer.toString(); 430 } 431 373 432 public Object visit(GSSAccumulatorsStats accStats) { 374 433
Note: See TracChangeset
for help on using the changeset viewer.