Ignore:
Timestamp:
10/12/12 13:04:31 (13 years ago)
Author:
wojtekp
Message:
 
Location:
DCWoRMS/trunk/src/schedframe/resources/computing
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • DCWoRMS/trunk/src/schedframe/resources/computing/ComputingResource.java

    r495 r512  
    4646        protected String name; 
    4747        protected ResourceType type; 
     48        protected String category; 
    4849        protected ResourceStatus status; 
    4950 
     
    6364                this.type = resDesc.getType(); 
    6465                this.name = resDesc.getId(); 
     66                this.category = resDesc.getCategory(); 
    6567                this.status = ResourceStatus.FREE; 
    6668                this.extensionList = new ExtensionListImpl(1); 
     
    230232        } 
    231233         
     234        public String getCategory(){ 
     235                return category; 
     236        } 
     237         
    232238        public PowerInterface getPowerInterface(){ 
    233239                if (extensionList != null) { 
     
    297303        public void initiate(){ 
    298304                 
    299                 ResourceEventCommand rec = new ResourceEventCommand(this); 
     305                /*ResourceEventCommand rec = new ResourceEventCommand(this); 
    300306                EnergyEvent event = new EnergyEvent(EnergyEventType.AIRFLOW_STATE_CHANGED, "Resource controller"); 
    301307                event.setReason(EventReason.SIM_INIT); 
    302                 rec.execute(event); 
    303                  
    304                 rec = new ResourceEventCommand(this); 
    305                 event = new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, "Resource controller"); 
     308                rec.execute(event);*/ 
     309                ResourceEventCommand rec = new ResourceEventCommand(this); 
     310                EnergyEvent event = new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, "Resource controller"); 
    306311                event.setReason(EventReason.SIM_INIT); 
    307312                rec.execute(event); 
  • DCWoRMS/trunk/src/schedframe/resources/computing/description/ComputingResourceDescription.java

    r477 r512  
    3333        protected AirThroughputProfile airThroughputProfile; 
    3434        protected Location location; 
     35        protected String category; 
    3536        //protected Parameters parameters; 
    3637 
     
    4041 
    4142                initId(computingResource); 
     43                this.category = computingResource.getType(); 
    4244 
    4345                if (computingResource.getComputingResourceTypeChoiceSequence() != null) { 
     
    263265        } 
    264266 
    265  
     267        public String getCategory() { 
     268                return category; 
     269        } 
    266270 
    267271} 
  • DCWoRMS/trunk/src/schedframe/resources/computing/profiles/energy/power/PowerProfile.java

    r495 r512  
    6666        } 
    6767         
    68         public Map<String, PState> getSupportedPStates() throws NoSuchFieldException { 
     68        public Map<String, PState> getSupportedPStates() { 
    6969                if(supportedPStates == null) 
    70                         throw new NoSuchFieldException("Supported p-states are not defined."); 
     70                        return new HashMap<String, PState>(); 
    7171                return supportedPStates; 
    7272        } 
  • DCWoRMS/trunk/src/schedframe/resources/computing/profiles/energy/power/ui/ProcessorPowerInterface.java

    r506 r512  
    11package schedframe.resources.computing.profiles.energy.power.ui; 
    22 
    3  
    4 import gridsim.GridSimTags; 
    5 import gridsim.dcworms.DCWormsTags; 
    63 
    74import java.util.Map; 
     
    1512import schedframe.resources.computing.profiles.energy.power.PowerStateName; 
    1613import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName; 
    17 import schedframe.resources.units.CpuSpeed; 
    18 import schedframe.resources.units.StandardResourceUnitName; 
    1914 
    2015public class ProcessorPowerInterface extends ComputingResourcePowerInterface { 
     
    2621                super(resource, pp); 
    2722                currentPowerState = StandardPowerStateName.ON; 
    28                 try { 
    29                         currentPState = getSupportedPStates().get("P0"); 
    30                 } catch (NoSuchFieldException e) { 
    31                         currentPState = null; 
    32                 } 
     23                currentPState = getSupportedPStates().get("P0"); 
    3324        } 
    3425         
     
    5344        } 
    5445         
    55         public Map<String, PState> getSupportedPStates() throws NoSuchFieldException { 
     46        public Map<String, PState> getSupportedPStates() { 
    5647                return powerProfile.getSupportedPStates(); 
    5748        } 
    5849         
    5950        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; 
    6555                        } 
    66                 } catch (NoSuchFieldException e) { 
    67                         return false; 
    6856                } 
    6957                return false; 
     
    7159         
    7260        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); 
    7962 
    80                 if(newPState != currentPState){ 
     63 
     64                if(newPState != null && newPState != currentPState){ 
    8165                        //double factor = newPState.getFrequency()/currentPState.getFrequency(); 
    8266                        currentPState = newPState; 
     
    9781 
    9882        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; 
    10588                        } 
    106                 } catch (NoSuchFieldException e) { 
    107                         return false; 
    10889                } 
    10990                return false; 
Note: See TracChangeset for help on using the changeset viewer.