edgecloudsim/src/edu/boun/edgecloudsim/edge_client/CpuUtilizationModel_Custom....

64 lines
2.0 KiB
Java
Raw Normal View History

/*
* Title: EdgeCloudSim - Custom VM Cpu Utilization Model
*
* Description:
* CpuUtilizationModel_Custom implements UtilizationModel and used for
* VM CPU utilization model. In CloudSim, the CPU utilization of the VM
* is a simple counter. We provide more realistic utilization model
* which decide CPU utilization of each application by using the
* values defined in the applications.xml file. For those who wants to
* add another VM Cpu Utilization Model to EdgeCloudSim should provide
* another concrete instance of UtilizationModel via ScenarioFactory
*
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* Copyright (c) 2017, Bogazici University, Istanbul, Turkey
*/
package edu.boun.edgecloudsim.edge_client;
import org.cloudbus.cloudsim.UtilizationModel;
import edu.boun.edgecloudsim.core.SimSettings;
import edu.boun.edgecloudsim.utils.SimLogger;
public class CpuUtilizationModel_Custom implements UtilizationModel {
private Task task;
public CpuUtilizationModel_Custom(){
}
/*
* (non-Javadoc)
* @see cloudsim.power.UtilizationModel#getUtilization(double)
*/
@Override
public double getUtilization(double time) {
int index = 9;
if(task.getAssociatedDatacenterId() == SimSettings.CLOUD_DATACENTER_ID)
index = 10;
else if(task.getAssociatedDatacenterId() == SimSettings.MOBILE_DATACENTER_ID)
index = 11;
return SimSettings.getInstance().getTaskLookUpTable()[task.getTaskType()][index];
}
public void setTask(Task _task){
task=_task;
}
public double predictUtilization(SimSettings.VM_TYPES _vmType){
int index = 0;
if(_vmType == SimSettings.VM_TYPES.EDGE_VM)
index = 9;
else if(_vmType == SimSettings.VM_TYPES.CLOUD_VM)
index = 10;
else if(_vmType == SimSettings.VM_TYPES.MOBILE_VM)
index = 11;
else{
SimLogger.printLine("Unknown VM Type! Terminating simulation...");
some minor backward compatible, major backward incompatible changes and code formatting (beautification) Minor Modifications: * Indentation issues are fixed * Typo errors in source code and comments are fixed * Misspelled parameters in plotTaskFailureReason.m are corrected * sim_results folder is added to .gitignore file Backward compatible changes * The exit code of the application when there is an error is changed from 0 to 1 * Default constructors are added for Location.java, LoadGeneratorModel.java, MobilityModel.java, EdgeOrchestrator.java (this change request coming from a developer) * public TaskProperty(int mobileDeviceId, double startTime, ExponentialDistribution[] expRngList) is added to TaskProperty.java (this change request coming from a developer to create a task without task type) * double getCreationTime() function is added to Task.java * void reconfigureMips(double mips) function is added to EdgeVM (for future usage) * gsm_propagation_delay variable is added to config file. SimSettings class is also modified accordingly. You can use it if you have cellular network access in your scenario. * wlan_range, northern_bound, southern_bound, eastern_bound, western_bound variables are added to config file; and relevant functions are added to SimSettings class. (this change request coming from a developer) Backward incompatible changes! * location_check_interval variable name is changed to location_check_interval in config.properties file. Please update your config files accordingly (remove 'vm_' part) * Major modifications are applied in SimLogger class to decrease time complexity. Now the basic results are kept in the memory and saved to the files at the end of the simulation. As a result of this change, the signature of the SimLogger.addLog () function had to be changed. You must add the mobile device id as the first argument. Please update your MobileDeviceManager class accordingly (add task.getCloudletId () as the first argument).
2020-10-30 09:06:09 +01:00
System.exit(1);
}
return SimSettings.getInstance().getTaskLookUpTable()[task.getTaskType()][index];
}
}