source: xssim/trunk/src/example/energy/CPUEnergyEstimationPlugin.java @ 206

Revision 206, 994 bytes checked in by wojtekp, 13 years ago (diff)
  • Property svn:mime-type set to text/plain
RevLine 
[104]1package example.energy;
2
3import java.util.Properties;
4
5import schedframe.resources.PowerState;
6import test.rewolucja.energy.EnergyEvent;
7import test.rewolucja.resources.ResourceStatus;
8import test.rewolucja.resources.physical.base.ComputingResource;
[206]9import test.rewolucja.resources.physical.implementation.Processor;
[104]10import test.rewolucja.scheduling.JobRegistryInterface;
11
12public class CPUEnergyEstimationPlugin extends BaseEnergyEstimationPlugin  {
13
14        @Override
15        public double estimatePowerConsumption(EnergyEvent event, JobRegistryInterface jobRegistry,
16                        ComputingResource resource) {
[206]17                Processor cpu = (Processor)resource;
[104]18                if(resource.getPowerInterface().getPowerState() == PowerState.OFF)
19                        return 0;
20                if(resource.getStatus() == ResourceStatus.BUSY)
21                        return cpu.getPowerInterface().getPState().getPower();
22                else
23                        return 1;
24        }
25
26        public String getName() {
[151]27                return getClass().getName();
[104]28        }
29
30        public void init(Properties properties) {
31                // TODO Auto-generated method stub
32               
33        }
34
35}
Note: See TracBrowser for help on using the repository browser.