]> git.somenet.org - pub/jan/lsdc.git/blob - src/at/ac/tuwien/lsdc/management/MachineManager.java
started implementing MachineManager, VM & PM
[pub/jan/lsdc.git] / src / at / ac / tuwien / lsdc / management / MachineManager.java
1 package at.ac.tuwien.lsdc.management;
2
3 import java.util.HashMap;
4
5 import at.ac.tuwien.lsdc.types.PhysicalMachine;
6
7 public class MachineManager {
8         // this class is responsible to start and stop PMs & VMs
9         // also it will be used to put an application on a VM
10         // move an application and get utilization data
11
12         private HashMap<Integer, PhysicalMachine> PMs = new HashMap<Integer, PhysicalMachine>();
13
14         public double getTotalConsumption() {
15                 double consumption = 0;
16                 for (PhysicalMachine pm : PMs.values()) {
17                         if (pm.isRunning())
18                                 consumption = consumption + pm.getConsumption();
19                 }
20                 return consumption;
21         }
22 }