Ignore:
Timestamp:
10/10/12 12:12:06 (13 years ago)
Author:
wojtekp
Message:
 
Location:
DCWoRMS/trunk/src/simulator/stats/implementation/out
Files:
1 deleted
2 edited

Legend:

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

    r477 r495  
    44import simulator.stats.implementation.GSSAccumulatorsStats; 
    55import simulator.stats.implementation.JobStats; 
     6import simulator.stats.implementation.ResourceAirFlowStats; 
    67import simulator.stats.implementation.ResourceEnergyStats; 
    78import simulator.stats.implementation.ResourceStats; 
     
    2829        public Object visit(ResourceEnergyStats arg); 
    2930 
     31        public Object visit(ResourceAirFlowStats arg); 
    3032         
    3133        public Object visit(GSSAccumulatorsStats arg); 
  • DCWoRMS/trunk/src/simulator/stats/implementation/out/StringSerializer.java

    r477 r495  
    1111import simulator.stats.implementation.GSSAccumulatorsStats; 
    1212import simulator.stats.implementation.JobStats; 
     13import simulator.stats.implementation.ResourceAirFlowStats; 
    1314import simulator.stats.implementation.ResourceEnergyStats; 
    1415import simulator.stats.implementation.ResourceStats; 
     
    258259 
    259260        public Object visit(ResourceUsageStats resourceUsageStats) { 
    260                 Map<Long, Integer> resourceUsage = resourceUsageStats.getUsage(); 
     261                Map<Long, Double> resourceUsage = resourceUsageStats.getUsage(); 
    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); 
     
    371372        } 
    372373 
     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 
    373432        public Object visit(GSSAccumulatorsStats accStats) { 
    374433 
Note: See TracChangeset for help on using the changeset viewer.