/* (non-Javadoc) * @see entropy.monitoring.ConfigurationAdapter#extractConfiguration() */ @Override public Configuration extractConfiguration() { Configuration config = new SimpleConfiguration(); for (ServerType server : Utils.getAllServers(currentFit4Green)) { Node node = getNode(server); if (server.getStatus() == ServerStatusType.ON || server.getStatus() == ServerStatusType .POWERING_ON) { // POWERING_ON nodes are seen as ON by entropy as they will be // soon on. This avoids ping-pong effect on the state. config.addOnline(node); for (VirtualMachineType VM : Utils.getVMs(server)) { VirtualMachine vm = getVM(node, VM); config.setRunOn(vm, node); } } else { // OFF, POWERING_OFF config.addOffline(node); } } return config; }
private double getUsageEffectiveness(ServerType server) { if (optiObjective == OptimizationObjective.Power) { return Utils.getServerSite(server, currentFit4Green).getPUE().getValue(); } else { return Utils.getServerSite(server, currentFit4Green).getCUE().getValue(); } }
private Node getNode(ServerType server) { ArrayList<CoreType> cores = Utils.getAllCores(server.getMainboard().get(0)); // freq in Hz double freq = cores.get(0).getFrequency().getValue(); int nbCPUs = cores.size(); int cpuCapacity = nbCPUs * 100; // getCPUCapacity ((int) (freq / 1000000), nbCPUs); int memoryTotal = (int) Utils.getMemory(server) * 1024; int powerIdle = (int) getPIdle(server); int powerPerVM = (int) getPperVM(server); log.debug("creation of an Entropy Node with name " + server.getFrameworkID()); log.debug("server is " + server.getStatus().toString()); log.debug("nbCPUs " + nbCPUs); log.debug("freq " + freq + " GHz"); log.debug("cpuCapacity " + cpuCapacity + " %"); log.debug("memoryTotal " + memoryTotal + " MB"); log.debug("powerIdle " + powerIdle + " W"); log.debug("powerPerVM " + powerPerVM + " W"); Node node = new F4GNode( server.getFrameworkID(), nbCPUs, cpuCapacity, memoryTotal, powerIdle, powerPerVM); return node; }
public F4GConfigurationAdapter( FIT4GreenType f4g, VMTypeType vmType, IPowerCalculator powerCalculator, OptimizationObjective optiObjective) { currentFit4Green = f4g; currentVMType = vmType; log = Logger.getLogger(F4GConfigurationAdapter.class.getName()); allServers = Utils.getAllServers(f4g); this.powerCalculator = powerCalculator; powerCalculation = new StaticPowerCalculation(null); this.optiObjective = optiObjective; }