Ignore:
Timestamp:
10/31/12 13:52:06 (12 years ago)
Author:
wojtekp
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • DCWoRMS/trunk/build/classes/example/energy/CPUEnergyEstimationPlugin.java

    r477 r539  
    11package example.energy; 
    22 
    3 import schedframe.resources.ResourceStatus; 
    43import schedframe.resources.computing.ComputingResource; 
    54import schedframe.resources.computing.Processor; 
     
    1413                        ComputingResource resource) { 
    1514                Processor cpu = (Processor)resource; 
    16                 if(resource.getPowerInterface().getPowerState().getName().equals(StandardPowerStateName.OFF)) 
     15                if(resource.getPowerInterface().getPowerState().equals(StandardPowerStateName.OFF)) 
    1716                        return 0; 
    18                 if(resource.getStatus() == ResourceStatus.BUSY) 
     17                else { 
    1918                        try { 
    2019                                return cpu.getPowerInterface().getPowerConsumption(cpu.getPowerInterface().getPState()); 
    2120                        } catch (NoSuchFieldException e) { 
    22                                 return 0; 
     21                                try { 
     22                                        return cpu.getPowerInterface().getPowerConsumption(StandardPowerStateName.ON); 
     23                                } catch (NoSuchFieldException e1) { 
     24                                } 
    2325                        } 
    24                 else  
    25                         return 1;  
     26                        return 1; 
     27                } 
     28 
    2629        } 
    2730 
    28         public String getName() { 
    29                 return getClass().getName(); 
    30         } 
    31  
    32  
    3331} 
Note: See TracChangeset for help on using the changeset viewer.