Commit afc2f03e authored by esabate's avatar esabate

Added energyUsage attribute in Worker with respective methods. Added method to...

Added energyUsage attribute in Worker with respective methods. Added method to remove workers in COMPSsApplication. Readme also updated
parent 609e977f
......@@ -28,7 +28,8 @@ Registered model has the following representation:
^* | - int PID | | - int numCores | | - float delayRTT |
| | - boolean active | | | | - float PLR |
| | - float cpuUsage | +--------------------------+ | |
| | - int computingUnits | ^* +---------------------+
| | - float energyUsage | ^* +---------------------+
| | - int computingUnits | |
| | - String ip | |
| | - float communicationCost| |
| | | |
......
......@@ -125,6 +125,13 @@ public class COMPSsApplication {
*/
public int getMonitoringPeriod() { return this.monitoringPeriod; }
/**
* Remomve all workers from application
*/
public void removeWorkers(){
this.workers.removeAll(this.workers);
}
@Override
public String toString() {
return "COMPSsApplication: " + name + " \n" +
......
......@@ -23,6 +23,9 @@ public class Worker extends DataClayObject {
/** Float containing the current cpu usage of a Worker. */
private float cpuUsage;
/** Float containing the current energy usage of a Worker. */
private float energyUsage;
/** Number of available computing units of a Worker. */
private int computingUnits;
......@@ -43,18 +46,21 @@ public class Worker extends DataClayObject {
* @param active Boolean representing if worker is used
* @param app COMPSs application
* @param cpuUsage Float representing the CPU percentage used
* @param energyUsage Float representing the Energy power used
* @param computingUnits Number of computing units used in the worker
* @param ip IP of the Worker
* @param communicationCost Float representing the communication cost
*/
public Worker(final Node node, final int pid, final boolean active, final COMPSsApplication app,
final float cpuUsage, final int computingUnits, final String ip, final float communicationCost) {
final float cpuUsage, final float energyUsage, final int computingUnits, final String ip,
final float communicationCost) {
this.node = node;
this.pid = pid;
this.active = active;
node.addWorker(this);
this.app = app;
this.cpuUsage = cpuUsage;
this.energyUsage = energyUsage;
this.computingUnits = computingUnits;
this.ip = ip;
this.communicationCost = communicationCost;
......@@ -125,11 +131,26 @@ public class Worker extends DataClayObject {
this.cpuUsage = cpuUsage;
}
/** Get current energy usage of worker
* @return float energyUsage
*/
public float getEnergyUsage() {
return energyUsage;
}
/**
* Set current energy usage of worker
* @param energyUsage float
*/
public void setEnergyUsage(final float energyUsage) {
this.energyUsage = energyUsage;
}
/**
* Get current number of computing units of worker
* @return int computingUnits
*/
public float getComputingUnits() {
public int getComputingUnits() {
return computingUnits;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment