- Timestamp:
- 10/12/12 13:04:31 (13 years ago)
- Location:
- DCWoRMS/trunk/src/schedframe/resources/computing/profiles/energy/power
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
DCWoRMS/trunk/src/schedframe/resources/computing/profiles/energy/power/PowerProfile.java
r495 r512 66 66 } 67 67 68 public Map<String, PState> getSupportedPStates() throws NoSuchFieldException{68 public Map<String, PState> getSupportedPStates() { 69 69 if(supportedPStates == null) 70 throw new NoSuchFieldException("Supported p-states are not defined.");70 return new HashMap<String, PState>(); 71 71 return supportedPStates; 72 72 } -
DCWoRMS/trunk/src/schedframe/resources/computing/profiles/energy/power/ui/ProcessorPowerInterface.java
r506 r512 1 1 package schedframe.resources.computing.profiles.energy.power.ui; 2 2 3 4 import gridsim.GridSimTags;5 import gridsim.dcworms.DCWormsTags;6 3 7 4 import java.util.Map; … … 15 12 import schedframe.resources.computing.profiles.energy.power.PowerStateName; 16 13 import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName; 17 import schedframe.resources.units.CpuSpeed;18 import schedframe.resources.units.StandardResourceUnitName;19 14 20 15 public class ProcessorPowerInterface extends ComputingResourcePowerInterface { … … 26 21 super(resource, pp); 27 22 currentPowerState = StandardPowerStateName.ON; 28 try { 29 currentPState = getSupportedPStates().get("P0"); 30 } catch (NoSuchFieldException e) { 31 currentPState = null; 32 } 23 currentPState = getSupportedPStates().get("P0"); 33 24 } 34 25 … … 53 44 } 54 45 55 public Map<String, PState> getSupportedPStates() throws NoSuchFieldException{46 public Map<String, PState> getSupportedPStates() { 56 47 return powerProfile.getSupportedPStates(); 57 48 } 58 49 59 50 public boolean supportPState(PState pState) { 60 try { 61 for(String pStateName: getSupportedPStates().keySet()){ 62 if(pState.getName().equals(pStateName)){ 63 return true; 64 } 51 52 for(String pStateName: getSupportedPStates().keySet()){ 53 if(pState.getName().equals(pStateName)){ 54 return true; 65 55 } 66 } catch (NoSuchFieldException e) {67 return false;68 56 } 69 57 return false; … … 71 59 72 60 public boolean setPState(String pStateName){ 73 PState newPState; 74 try { 75 newPState = getSupportedPStates().get(pStateName); 76 } catch (NoSuchFieldException e) { 77 return false; 78 } 61 PState newPState = getSupportedPStates().get(pStateName); 79 62 80 if(newPState != currentPState){ 63 64 if(newPState != null && newPState != currentPState){ 81 65 //double factor = newPState.getFrequency()/currentPState.getFrequency(); 82 66 currentPState = newPState; … … 97 81 98 82 public boolean setFrequency(double freq) { 99 try { 100 for(String pStateName: getSupportedPStates().keySet()){ 101 if(getSupportedPStates().get(pStateName).getFrequency() == freq){ 102 setPState(pStateName); 103 return true; 104 } 83 84 for(String pStateName: getSupportedPStates().keySet()){ 85 if(getSupportedPStates().get(pStateName).getFrequency() == freq){ 86 setPState(pStateName); 87 return true; 105 88 } 106 } catch (NoSuchFieldException e) {107 return false;108 89 } 109 90 return false;
Note: See TracChangeset
for help on using the changeset viewer.