Commit 4f25a01a authored by rodrigo.calheiros's avatar rodrigo.calheiros

Removed warnings from Network package

parent b463216f
package org.cloudbus.cloudsim.examples.network.datacenter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.DecimalFormat;
import java.util.ArrayList;
......@@ -10,20 +8,13 @@ import java.util.LinkedList;
import java.util.List;
import org.cloudbus.cloudsim.Cloudlet;
import org.cloudbus.cloudsim.CloudletSchedulerSpaceShared;
import org.cloudbus.cloudsim.DatacenterCharacteristics;
import org.cloudbus.cloudsim.Host;
import org.cloudbus.cloudsim.Log;
import org.cloudbus.cloudsim.Pe;
import org.cloudbus.cloudsim.Storage;
import org.cloudbus.cloudsim.UtilizationModel;
import org.cloudbus.cloudsim.UtilizationModelFull;
import org.cloudbus.cloudsim.Vm;
import org.cloudbus.cloudsim.VmAllocationPolicySimple;
import org.cloudbus.cloudsim.VmSchedulerTimeShared;
import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.distributions.UniformDistr;
import org.cloudbus.cloudsim.network.datacenter.AppCloudlet;
import org.cloudbus.cloudsim.network.datacenter.EdgeSwitch;
import org.cloudbus.cloudsim.network.datacenter.NetDatacenterBroker;
import org.cloudbus.cloudsim.network.datacenter.NetworkConstants;
......@@ -37,13 +28,6 @@ import org.cloudbus.cloudsim.provisioners.RamProvisionerSimple;
public class TestExample {
/**
* @param args
*/
/** The cloudlet list. */
private static List<AppCloudlet> cloudletList;
/** The vmlist. */
private static List<NetworkVm> vmlist;
......@@ -72,11 +56,9 @@ public class TestExample {
// Third step: Create Broker
NetDatacenterBroker broker = createBroker();
int brokerId = broker.getId();
broker.setLinkDC(datacenter0);
// broker.setLinkDC(datacenter0);
// Fifth step: Create one Cloudlet
cloudletList = new ArrayList<AppCloudlet>();
vmlist = new ArrayList<NetworkVm>();
......@@ -92,9 +74,9 @@ public class TestExample {
// Final step: Print results when simulation is over
List<Cloudlet> newList = broker.getCloudletReceivedList();
printCloudletList(newList);
System.out.println("numberofcloudlet " + newList.size()
+ " Cached " + NetDatacenterBroker.cachedcloudlet
+ " Data transfered " + NetworkConstants.totaldatatransfer);
System.out.println("numberofcloudlet " + newList.size() + " Cached "
+ NetDatacenterBroker.cachedcloudlet + " Data transfered "
+ NetworkConstants.totaldatatransfer);
// Print the debt of each user to each datacenter
datacenter0.printDebts();
......@@ -133,12 +115,10 @@ public class TestExample {
// 4. Create Host with its id and list of PEs and add them to the list
// of machines
int hostId = 0;
int ram = 2048; // host memory (MB)
long storage = 1000000; // host storage
int bw = 10000;
for (int i = 0; i < NetworkConstants.EdgeSwitchPort
* NetworkConstants.AggSwitchPort
for (int i = 0; i < NetworkConstants.EdgeSwitchPort * NetworkConstants.AggSwitchPort
* NetworkConstants.RootSwitchPort; i++) {
// 2. A Machine contains one or more PEs or CPUs/Cores.
// In this example, it will have only one core.
......@@ -195,8 +175,12 @@ public class TestExample {
// 4. Create PowerHost with its id and list of PEs and add them to
// the list of machines
hostList.add(new NetworkHost(i, new RamProvisionerSimple(ram),
new BwProvisionerSimple(bw), storage, peList,
hostList.add(new NetworkHost(
i,
new RamProvisionerSimple(ram),
new BwProvisionerSimple(bw),
storage,
peList,
new VmSchedulerTimeShared(peList))); // This is our machine
}
......@@ -220,14 +204,25 @@ public class TestExample {
// devices by now
DatacenterCharacteristics characteristics = new DatacenterCharacteristics(
arch, os, vmm, hostList, time_zone, cost, costPerMem,
costPerStorage, costPerBw);
arch,
os,
vmm,
hostList,
time_zone,
cost,
costPerMem,
costPerStorage,
costPerBw);
// 6. Finally, we need to create a NetworkDatacenter object.
NetworkDatacenter datacenter = null;
try {
datacenter = new NetworkDatacenter(name, characteristics,
new NetworkVmAllocationPolicy(hostList), storageList, 0);
datacenter = new NetworkDatacenter(
name,
characteristics,
new NetworkVmAllocationPolicy(hostList),
storageList,
0);
} catch (Exception e) {
e.printStackTrace();
......@@ -263,17 +258,14 @@ public class TestExample {
* list of Cloudlets
* @throws IOException
*/
private static void printCloudletList(List<Cloudlet> list)
throws IOException {
private static void printCloudletList(List<Cloudlet> list) throws IOException {
int size = list.size();
Cloudlet cloudlet;
double fintime = 0;
String indent = " ";
Log.printLine();
Log.printLine("========== OUTPUT ==========");
Log.printLine("Cloudlet ID" + indent + "STATUS" + indent
+ "Data center ID" + indent + "VM ID" + indent + "Time"
+ indent + "Start Time" + indent + "Finish Time");
Log.printLine("Cloudlet ID" + indent + "STATUS" + indent + "Data center ID" + indent + "VM ID"
+ indent + "Time" + indent + "Start Time" + indent + "Finish Time");
DecimalFormat dft = new DecimalFormat("###.##");
for (int i = 0; i < size; i++) {
......@@ -282,13 +274,9 @@ public class TestExample {
if (cloudlet.getCloudletStatus() == Cloudlet.SUCCESS) {
Log.print("SUCCESS");
fintime = cloudlet.getFinishTime();
Log.printLine(indent + indent + cloudlet.getResourceId()
+ indent + indent + indent + cloudlet.getVmId()
+ indent + indent
+ dft.format(cloudlet.getActualCPUTime()) + indent
+ indent + dft.format(cloudlet.getExecStartTime())
+ indent + indent
Log.printLine(indent + indent + cloudlet.getResourceId() + indent + indent + indent
+ cloudlet.getVmId() + indent + indent + dft.format(cloudlet.getActualCPUTime())
+ indent + indent + dft.format(cloudlet.getExecStartTime()) + indent + indent
+ dft.format(cloudlet.getFinishTime()));
}
}
......@@ -297,24 +285,11 @@ public class TestExample {
static void CreateNetwork(int numhost, NetworkDatacenter dc) {
// //Root Switch
// Switch swroot=new Switch("Root", Constants.ROOT_LEVEL, dc);
// dc.Switchlist.put(swroot.getId(), swroot);
// //Agg Switch
// Switch aggswitch[]=new Switch[(int) Constants.RootSwitchPort];
// for(int j=0;j<Constants.RootSwitchPort;j++)
// {
// aggswitch[j]=new Switch("Agg"+j, Constants.Agg_LEVEL, dc);
// swroot.downlinkswitches.add(aggswitch[j]);
// aggswitch[j].uplinkswitches.add(swroot);
// dc.Switchlist.put(aggswitch[j].getId(), aggswitch[j]);
// }
// Edge Switch
EdgeSwitch edgeswitch[] = new EdgeSwitch[1];
for (int i = 0; i < 1; i++) {
edgeswitch[i] = new EdgeSwitch("Edge" + i,
NetworkConstants.EDGE_LEVEL, dc);
edgeswitch[i] = new EdgeSwitch("Edge" + i, NetworkConstants.EDGE_LEVEL, dc);
// edgeswitch[i].uplinkswitches.add(null);
dc.Switchlist.put(edgeswitch[i].getId(), edgeswitch[i]);
// aggswitch[(int)
......
......@@ -49,7 +49,6 @@ public class EdgeSwitch extends Switch{
this.switching_delay=NetworkConstants.SwitchingDelayEdge;
numport=NetworkConstants.EdgeSwitchPort;
uplinkswitches=new ArrayList<Switch>();
// TODO Auto-generated constructor stub
}
/**
* Send Packet to switch connected through a uplink port
......@@ -58,7 +57,6 @@ public class EdgeSwitch extends Switch{
*/
@Override
protected void processpacket_up(SimEvent ev) {
// TODO Auto-generated method stub
//packet coming from down level router/host.
//has to send up
//check which switch to forward to
......@@ -114,7 +112,6 @@ public class EdgeSwitch extends Switch{
@Override
protected void processpacketforward(SimEvent ev) {
// TODO Auto-generated method stub
//search for the host and packets..send to them
......@@ -143,8 +140,6 @@ public class EdgeSwitch extends Switch{
{
for(Entry<Integer, List<NetworkPacket>> es:packetTohost.entrySet())
{
int tosend=es.getKey();
NetworkHost hs=this.hostlist.get(tosend);
List<NetworkPacket> hspktlist=es.getValue();
if(!hspktlist.isEmpty()){
double avband=this.downlinkbandwidth/hspktlist.size();
......
......@@ -13,14 +13,8 @@ import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Random;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.UUID;
import org.cloudbus.cloudsim.Cloudlet;
import org.cloudbus.cloudsim.CloudletSchedulerSpaceShared;
import org.cloudbus.cloudsim.DatacenterCharacteristics;
import org.cloudbus.cloudsim.Log;
import org.cloudbus.cloudsim.Vm;
......@@ -29,7 +23,6 @@ import org.cloudbus.cloudsim.core.CloudSimTags;
import org.cloudbus.cloudsim.core.SimEntity;
import org.cloudbus.cloudsim.core.SimEvent;
import org.cloudbus.cloudsim.distributions.UniformDistr;
import org.cloudbus.cloudsim.lists.CloudletList;
import org.cloudbus.cloudsim.lists.VmList;
/**
......@@ -56,7 +49,7 @@ public class NetDatacenterBroker extends SimEntity {
private List<? extends AppCloudlet> appCloudletList;
/** The Appcloudlet submitted list. */
private Map<Integer, Integer> appCloudletRecieved;
private final Map<Integer, Integer> appCloudletRecieved;
private List<? extends Cloudlet> cloudletSubmittedList;
......@@ -170,8 +163,8 @@ public class NetDatacenterBroker extends SimEntity {
// public void bindCloudletToVm(int cloudletId, int vmId){
// CloudletList.getById(getCloudletList(), cloudletId).setVmId(vmId);
// }
public void setLinkDC(NetworkDatacenter linkDC) {
this.linkDC = linkDC;
public void setLinkDC(NetworkDatacenter alinkDC) {
linkDC = alinkDC;
}
/**
......@@ -206,8 +199,9 @@ public class NetDatacenterBroker extends SimEntity {
shutdownEntity();
break;
case CloudSimTags.NextCycle:
if (NetworkConstants.BASE)
this.createVmsInDatacenterBase(this.linkDC.getId());
if (NetworkConstants.BASE) {
this.createVmsInDatacenterBase(linkDC.getId());
}
break;
// other unknown tags are processed by this method
......@@ -341,8 +335,6 @@ public class NetDatacenterBroker extends SimEntity {
// send as much vms as possible for this datacenter before trying the
// next one
int requestedVms = 0;
String datacenterName = CloudSim.getEntityName(datacenterId);
int j = 0;
// All host will have two VMs (assumption) VM is the minimum unit
......@@ -360,16 +352,14 @@ public class NetDatacenterBroker extends SimEntity {
NetworkConstants.currentAppId++;
}
int seed = 5;
int k = 0;
int totalvm = this.vmsCreatedList.size();
int currentvmid = 0;
//schedule the application on VMs
for (AppCloudlet app : this.getAppCloudletList()) {
List<Integer> vmids = new ArrayList<Integer>();
int numVms = this.linkDC.getVmList().size();
int numVms = linkDC.getVmList().size();
UniformDistr ufrnd = new UniformDistr(0, numVms, 5);
for (int i = 0; i < app.numbervm; i++) {
......@@ -416,8 +406,7 @@ public class NetDatacenterBroker extends SimEntity {
}
private void CreateVMs(int datacenterId) {
// TODO Auto-generated method stub
int numVM = this.linkDC.getHostList().size() * NetworkConstants.maxhostVM; // two
int numVM = linkDC.getHostList().size() * NetworkConstants.maxhostVM; // two
// VMs
// per
// host
......@@ -436,7 +425,7 @@ public class NetDatacenterBroker extends SimEntity {
// create VM
NetworkVm vm = new NetworkVm(vmid, this.getId(), mips, pesNumber,
ram, bw, size, vmm, new NetworkCloudletSpaceSharedScheduler());
this.linkDC.processVmCreateNetwork(vm);
linkDC.processVmCreateNetwork(vm);
// add the VM to the vmList
getVmList().add(vm);
requestedVms++;
......@@ -545,6 +534,7 @@ public class NetDatacenterBroker extends SimEntity {
this.cloudletList = cloudletList;
}
@SuppressWarnings("unchecked")
public <T extends AppCloudlet> List<T> getAppCloudletList() {
return (List<T>) appCloudletList;
}
......
......@@ -5,10 +5,11 @@ import java.util.Map;
import org.cloudbus.cloudsim.Cloudlet;
import org.cloudbus.cloudsim.UtilizationModel;
/**
* NetworkCloudlet class extends Cloudlet to support simulation of complex applications.
* Each such network Cloudlet represents a task of the application. Each task consists of several
* stages.
* NetworkCloudlet class extends Cloudlet to support simulation of complex
* applications. Each such network Cloudlet represents a task of the
* application. Each task consists of several stages.
*
* Please refer to following publication for more details:
*
......@@ -21,49 +22,56 @@ import org.cloudbus.cloudsim.UtilizationModel;
* @author Saurabh Kumar Garg
* @since CloudSim Toolkit 1.0
*/
public class NetworkCloudlet extends Cloudlet implements Comparable {
public class NetworkCloudlet extends Cloudlet implements Comparable<Object> {
long memory;
public NetworkCloudlet(int cloudletId, long cloudletLength, int pesNumber,
long cloudletFileSize, long cloudletOutputSize, long memory,
public NetworkCloudlet(
int cloudletId,
long cloudletLength,
int pesNumber,
long cloudletFileSize,
long cloudletOutputSize,
long memory,
UtilizationModel utilizationModelCpu,
UtilizationModel utilizationModelRam,
UtilizationModel utilizationModelBw) {
super(cloudletId, cloudletLength, pesNumber, cloudletFileSize,
cloudletOutputSize, utilizationModelCpu, utilizationModelRam,
super(
cloudletId,
cloudletLength,
pesNumber,
cloudletFileSize,
cloudletOutputSize,
utilizationModelCpu,
utilizationModelRam,
utilizationModelBw);
// TODO Auto-generated constructor stub
currStagenum = -1;
this.memory = memory;
stages = new ArrayList<TaskStage>();
}
public double submittime; //time when cloudlet will be submitted
public double finishtime; //time when cloudlet finish execution
public double exetime; //execution time for cloudlet
public double numStage;//number of stages in cloudlet
public int currStagenum; //current stage of cloudlet execution
public double submittime; // time when cloudlet will be submitted
public double finishtime; // time when cloudlet finish execution
public double exetime; // execution time for cloudlet
public double numStage;// number of stages in cloudlet
public int currStagenum; // current stage of cloudlet execution
public double timetostartStage;
public double timespentInStage; //how much time spent in particular stage
public double timespentInStage; // how much time spent in particular stage
public Map<Double, HostPacket> timeCommunicate;
public ArrayList<TaskStage> stages; //all stages which cloudlet execution consists of.
public ArrayList<TaskStage> stages; // all stages which cloudlet execution
// consists of.
public double starttime;
@Override
public int compareTo(Object arg0) {
// TODO Auto-generated method stub
NetworkCloudlet s1 = (NetworkCloudlet) arg0;
int alpha = 0;
return 0;
}
public double getSubmittime() {
// TODO Auto-generated method stub
return submittime;
};
}
}
package org.cloudbus.cloudsim.network.datacenter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class NetworkConstants {
public static int maxhostVM = 2;
public static int HOST_PEs = 8;
public static int maxhostVM=2;
public static int HOST_PEs=8;
public static double maxMemperVM = 1024 * 1024;// kb
public static double maxMemperVM=1024*1024;//kb
public static int currentCloudletId = 0;
public static int currentAppId = 0;
// stage type
public static final int EXECUTION = 0;
public static final int WAIT_SEND = 1;
public static final int WAIT_RECV = 2;
public static final int FINISH = -2;
// number of switches at each level
public static final int ROOT_LEVEL = 0;
public static final int Agg_LEVEL = 1;
public static final int EDGE_LEVEL = 2;
public static int currentCloudletId=0;
public static int currentAppId=0;
public static final int PES_NUMBER = 4;
public static final int FILE_SIZE = 300;
public static final int OUTPUT_SIZE = 300;
public static final int COMMUNICATION_LENGTH = 1;
//stage type
public static final int EXECUTION=0;
public static final int WAIT_SEND=1;
public static final int WAIT_RECV=2;
public static final int FINISH=-2;
public static boolean BASE = true;
public static long BandWidthEdgeAgg = 100 * 1024 * 1024;// 100 Megabits
public static long BandWidthEdgeHost = 100 * 1024 * 1024;//
public static long BandWidthAggRoot = 20 * 1024 * 1024 * 2;// 40gb
public static double SwitchingDelayRoot = .00285;
public static double SwitchingDelayAgg = .00245;// .00245
public static double SwitchingDelayEdge = .00157;// ms
//number of switches at each level
public static final int ROOT_LEVEL=0;
public static final int Agg_LEVEL=1;
public static final int EDGE_LEVEL=2;
public static double EdgeSwitchPort = 4;// number of host
public static final int PES_NUMBER=4;
public static final int FILE_SIZE=300;
public static final int OUTPUT_SIZE=300;
public static double AggSwitchPort = 1;// number of Edge
public static final int COMMUNICATION_LENGTH=1;
public static double RootSwitchPort = 1;// number of Agg
public static boolean BASE = true;
public static double seed = 199;
public static boolean logflag = false;
public static long BandWidthEdgeAgg=100*1024*1024;//100 Megabits
public static long BandWidthEdgeHost=100*1024*1024;//
public static long BandWidthAggRoot=20*1024*1024*2;//40gb
public static int iteration = 10;
public static int nexttime = 1000;
public static double SwitchingDelayRoot=.00285;
public static double SwitchingDelayAgg=.00245;//.00245
public static double SwitchingDelayEdge=.00157;//ms
public static double EdgeSwitchPort=4;//number of host
public static double AggSwitchPort=1;//number of Edge
public static double RootSwitchPort=1;//number of Agg
public static double seed=199;
public static boolean logflag=false;
public static int iteration=10;
public static int nexttime=1000;
public static int totaldatatransfer=0;
public static int totaldatatransfer = 0;
}
......@@ -8,42 +8,33 @@ package org.cloudbus.cloudsim.network.datacenter;
* Copyright (c) 2009-2010, The University of Melbourne, Australia
*/
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.cloudbus.cloudsim.Cloudlet;
import org.cloudbus.cloudsim.CloudletScheduler;
import org.cloudbus.cloudsim.DataCloudTags;
import org.cloudbus.cloudsim.Datacenter;
import org.cloudbus.cloudsim.DatacenterCharacteristics;
import org.cloudbus.cloudsim.File;
import org.cloudbus.cloudsim.Host;
import org.cloudbus.cloudsim.InfoPacket;
import org.cloudbus.cloudsim.Log;
import org.cloudbus.cloudsim.Storage;
import org.cloudbus.cloudsim.Vm;
import org.cloudbus.cloudsim.VmAllocationPolicy;
import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.core.CloudSimTags;
import org.cloudbus.cloudsim.core.SimEntity;
import org.cloudbus.cloudsim.core.SimEvent;
/**
* NetworkDatacenter class is a Datacenter whose hostList are virtualized and
* networked. It contains all the information about internal network. For example,
* which VM is connected to Switch etc.
* It deals with processing of VM queries (i.e., handling of VMs)
* instead of processing Cloudlet-related queries. So, even though an
* AllocPolicy will be instantiated (in the init() method of the superclass, it
* will not be used, as processing of cloudlets are handled by the
* CloudletScheduler and processing of VirtualMachines are handled by the
* VmAllocationPolicy.
* networked. It contains all the information about internal network. For
* example, which VM is connected to Switch etc. It deals with processing of VM
* queries (i.e., handling of VMs) instead of processing Cloudlet-related
* queries. So, even though an AllocPolicy will be instantiated (in the init()
* method of the superclass, it will not be used, as processing of cloudlets are
* handled by the CloudletScheduler and processing of VirtualMachines are
* handled by the VmAllocationPolicy.
*
* Please refer to following publication for more details:
*
......@@ -57,38 +48,42 @@ import org.cloudbus.cloudsim.core.SimEvent;
*/
public class NetworkDatacenter extends Datacenter {
/**
* Allocates a new NetworkDatacenter object.
*
* @param name the name to be associated with this entity (as
* required by Sim_entity class from simjava package)
* @param characteristics an object of DatacenterCharacteristics
* @param storageList a LinkedList of storage elements, for data simulation
* @param vmAllocationPolicy the vmAllocationPolicy
* @param name
* the name to be associated with this entity (as required by
* Sim_entity class from simjava package)
* @param characteristics
* an object of DatacenterCharacteristics
* @param storageList
* a LinkedList of storage elements, for data simulation
* @param vmAllocationPolicy
* the vmAllocationPolicy
*
* @throws Exception This happens when one of the following scenarios occur:
* @throws Exception
* This happens when one of the following scenarios occur:
* <ul>
* <li> creating this entity before initializing CloudSim package
* <li> this entity name is <tt>null</tt> or empty
* <li> this entity has <tt>zero</tt> number of PEs (Processing
* <li>creating this entity before initializing CloudSim package
* <li>this entity name is <tt>null</tt> or empty
* <li>this entity has <tt>zero</tt> number of PEs (Processing
* Elements). <br>
* No PEs mean the Cloudlets can't be processed.
* A CloudResource must contain one or more Machines.
* A Machine must contain one or more PEs.
* No PEs mean the Cloudlets can't be processed. A CloudResource
* must contain one or more Machines. A Machine must contain one
* or more PEs.
* </ul>
*
* @pre name != null
* @pre resource != null
* @post $none
*/
public NetworkDatacenter(String name,
public NetworkDatacenter(
String name,
DatacenterCharacteristics characteristics,
VmAllocationPolicy vmAllocationPolicy, List<Storage> storageList,
VmAllocationPolicy vmAllocationPolicy,
List<Storage> storageList,
double schedulingInterval) throws Exception {
super(name, characteristics, vmAllocationPolicy, storageList,
schedulingInterval);
// TODO Auto-generated constructor stub
super(name, characteristics, vmAllocationPolicy, storageList, schedulingInterval);
VmToSwitchid = new HashMap<Integer, Integer>();
HostToSwitchid = new HashMap<Integer, Integer>();
VmtoHostlist = new HashMap<Integer, Integer>();
......@@ -102,8 +97,8 @@ public class NetworkDatacenter extends Datacenter {
public Map<Integer, Integer> VmtoHostlist;
/**
* Get list of all EdgeSwitches in the Datacenter network
* One can design similar functions for other type of switches.
* Get list of all EdgeSwitches in the Datacenter network One can design
* similar functions for other type of switches.
*
*/
public Map<Integer, Switch> getEdgeSwitch() {
......@@ -116,10 +111,10 @@ public class NetworkDatacenter extends Datacenter {
return edgeswitch;
}
/**
* Create the VM within the NetworkDatacenter.
* It can be directly accessed by Datacenter Broker
* which manage allocation of Cloudlets.
* Create the VM within the NetworkDatacenter. It can be directly accessed
* by Datacenter Broker which manage allocation of Cloudlets.
*
*
*/
......@@ -128,11 +123,9 @@ public class NetworkDatacenter extends Datacenter {
boolean result = getVmAllocationPolicy().allocateHostForVm(vm);
if (result) {
this.VmToSwitchid.put(vm.getId(),
((NetworkHost) vm.getHost()).sw.getId());
this.VmToSwitchid.put(vm.getId(), ((NetworkHost) vm.getHost()).sw.getId());
this.VmtoHostlist.put(vm.getId(), vm.getHost().getId());
System.out.println(vm.getId() + " VM is created on "
+ vm.getHost().getId());
System.out.println(vm.getId() + " VM is created on " + vm.getHost().getId());
double amount = 0.0;
if (getDebts().containsKey(vm.getUserId())) {
amount = getDebts().get(vm.getUserId());
......@@ -144,22 +137,24 @@ public class NetworkDatacenter extends Datacenter {
getVmList().add(vm);
vm.updateVmProcessing(CloudSim.clock(), getVmAllocationPolicy()
.getHost(vm).getVmScheduler().getAllocatedMipsForVm(vm));
vm.updateVmProcessing(CloudSim.clock(), getVmAllocationPolicy().getHost(vm).getVmScheduler()
.getAllocatedMipsForVm(vm));
}
return result;
}
/**
* Processes a Cloudlet submission.
*
* @param ev a SimEvent object
* @param ack an acknowledgement
* @param ev
* a SimEvent object
* @param ack
* an acknowledgement
*
* @pre ev != null
* @post $none
*/
@Override
protected void processCloudletSubmit(SimEvent ev, boolean ack) {
updateCloudletProcessing();
......@@ -170,8 +165,7 @@ public class NetworkDatacenter extends Datacenter {
// checks whether this Cloudlet has finished or not
if (cl.isFinished()) {
String name = CloudSim.getEntityName(cl.getUserId());
Log.printLine(getName() + ": Warning - Cloudlet #"
+ cl.getCloudletId() + " owned by " + name
Log.printLine(getName() + ": Warning - Cloudlet #" + cl.getCloudletId() + " owned by " + name
+ " is already completed/finished.");
Log.printLine("Therefore, it is not being executed again");
Log.printLine();
......@@ -198,21 +192,23 @@ public class NetworkDatacenter extends Datacenter {
}
// process this Cloudlet to this CloudResource
cl.setResourceParameter(getId(), getCharacteristics()
.getCostPerSecond(), getCharacteristics().getCostPerBw());
cl.setResourceParameter(getId(), getCharacteristics().getCostPerSecond(), getCharacteristics()
.getCostPerBw());
int userId = cl.getUserId();
int vmId = cl.getVmId();
double fileTransferTime = predictFileTransferTime(cl
.getRequiredFiles()); // time to transfer the files
double fileTransferTime = predictFileTransferTime(cl.getRequiredFiles()); // time
// to
// transfer
// the
// files
Host host = getVmAllocationPolicy().getHost(vmId, userId);
Vm vm = host.getVm(vmId, userId);
CloudletScheduler scheduler = vm.getCloudletScheduler();
// System.out.println("cloudlet recieved by VM"+vmId);
double estimatedFinishTime = scheduler.cloudletSubmit(cl,
fileTransferTime);
double estimatedFinishTime = scheduler.cloudletSubmit(cl, fileTransferTime);
// if (estimatedFinishTime > 0.0 && estimatedFinishTime <
// getSchedulingInterval()) { //if this cloudlet is in the exec
......@@ -226,8 +222,7 @@ public class NetworkDatacenter extends Datacenter {
estimatedFinishTime += fileTransferTime;
// estimatedFinishTime += CloudSim.clock();
// Log.printLine(CloudSim.clock()+": Next event scheduled to +"+estimatedFinishTime);
send(getId(), estimatedFinishTime,
CloudSimTags.VM_DATACENTER_EVENT);
send(getId(), estimatedFinishTime, CloudSimTags.VM_DATACENTER_EVENT);
// event to update the stages
send(getId(), 0.0001, CloudSimTags.VM_DATACENTER_EVENT);
......@@ -244,12 +239,10 @@ public class NetworkDatacenter extends Datacenter {
sendNow(cl.getUserId(), tag, data);
}
} catch (ClassCastException c) {
Log.printLine(getName() + ".processCloudletSubmit(): "
+ "ClassCastException error.");
Log.printLine(getName() + ".processCloudletSubmit(): " + "ClassCastException error.");
c.printStackTrace();
} catch (Exception e) {
Log.printLine(getName() + ".processCloudletSubmit(): "
+ "Exception error.");
Log.printLine(getName() + ".processCloudletSubmit(): " + "Exception error.");
e.printStackTrace();
}
......
......@@ -9,13 +9,10 @@
package org.cloudbus.cloudsim.network.datacenter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import org.cloudbus.cloudsim.Datacenter;
import org.cloudbus.cloudsim.Host;
import org.cloudbus.cloudsim.Log;
import org.cloudbus.cloudsim.Pe;
import org.cloudbus.cloudsim.Vm;
import org.cloudbus.cloudsim.VmScheduler;
......@@ -27,11 +24,11 @@ import org.cloudbus.cloudsim.provisioners.BwProvisioner;
import org.cloudbus.cloudsim.provisioners.RamProvisioner;
/**
* NetworkHost class extends Host to support simulation of networked datacenters.
* It executes actions related to management of packets (send and receive)other than that of
* virtual machines (e.g., creation and destruction). A host has a defined
* policy for provisioning memory and bw, as well as an allocation policy for
* Pe's to virtual machines.
* NetworkHost class extends Host to support simulation of networked
* datacenters. It executes actions related to management of packets (send and
* receive)other than that of virtual machines (e.g., creation and destruction).
* A host has a defined policy for provisioning memory and bw, as well as an
* allocation policy for Pe's to virtual machines.
*
* Please refer to following publication for more details:
*
......@@ -42,7 +39,7 @@ import org.cloudbus.cloudsim.provisioners.RamProvisioner;
*
*
* @author Saurabh Kumar Garg
* @since CloudSim Toolkit 1.0
* @since CloudSim Toolkit 3.0
*/
public class NetworkHost extends Host {
......@@ -50,7 +47,7 @@ public class NetworkHost extends Host {
public List<NetworkPacket> packetTosendGlobal;
public List<NetworkPacket> packetrecieved;
public double memory;
public Switch sw; //Edge switch in general
public Switch sw; // Edge switch in general
public double bandwidth;// latency
public List<Double> CPUfinTimeCPU = new ArrayList<Double>();// time when
// last job will
......@@ -59,9 +56,13 @@ public class NetworkHost extends Host {
public double fintime = 0;
public NetworkHost(int id, RamProvisioner ramProvisioner,
BwProvisioner bwProvisioner, long storage,
List<? extends Pe> peList, VmScheduler vmScheduler) {
public NetworkHost(
int id,
RamProvisioner ramProvisioner,
BwProvisioner bwProvisioner,
long storage,
List<? extends Pe> peList,
VmScheduler vmScheduler) {
super(id, ramProvisioner, bwProvisioner, storage, peList, vmScheduler);
this.packetrecieved = new ArrayList<NetworkPacket>();
......@@ -84,6 +85,7 @@ public class NetworkHost extends Host {
* @pre currentTime >= 0.0
* @post $none
*/
@Override
public double updateVmsProcessing(double currentTime) {
double smallerTime = Double.MAX_VALUE;
// insert in each vm packet recieved
......@@ -93,18 +95,19 @@ public class NetworkHost extends Host {
// continue;
// }
double time = ((NetworkVm) vm).updateVmProcessing(currentTime,
getVmScheduler().getAllocatedMipsForVm(vm));
double time = ((NetworkVm) vm).updateVmProcessing(currentTime, getVmScheduler()
.getAllocatedMipsForVm(vm));
if (time > 0.0 && time < smallerTime) {
smallerTime = time;
}
}
//send the packets to other hosts/VMs
// send the packets to other hosts/VMs
sendpackets();
return smallerTime;
}
/**
* Receives packet and forward it to the corresponding VM for processing
* host.
......@@ -119,13 +122,14 @@ public class NetworkHost extends Host {
// insertthe packet in recievedlist of VM
Vm vm = VmList.getById(getVmList(), hs.pkt.reciever);
List<HostPacket> pktlist = ((NetworkCloudletSpaceSharedScheduler) vm
.getCloudletScheduler()).pktrecv.get(hs.pkt.sender);
List<HostPacket> pktlist = ((NetworkCloudletSpaceSharedScheduler) vm.getCloudletScheduler()).pktrecv
.get(hs.pkt.sender);
if (pktlist == null) {
pktlist = new ArrayList<HostPacket>();
((NetworkCloudletSpaceSharedScheduler) vm.getCloudletScheduler()).pktrecv
.put(hs.pkt.sender, pktlist);
((NetworkCloudletSpaceSharedScheduler) vm.getCloudletScheduler()).pktrecv.put(
hs.pkt.sender,
pktlist);
}
pktlist.add(hs.pkt);
......@@ -133,29 +137,28 @@ public class NetworkHost extends Host {
}
packetrecieved.clear();
}
/**
* Send packet check whether a packet belongs to a local VM or to a VM hosted on other machine.
* Send packet check whether a packet belongs to a local VM or to a VM
* hosted on other machine.
*
*
*/
private void sendpackets() {
for (Vm vm : super.getVmList()) {
for (Entry<Integer, List<HostPacket>> es : ((NetworkCloudletSpaceSharedScheduler) vm
.getCloudletScheduler()).pkttosend.entrySet())
{
.getCloudletScheduler()).pkttosend.entrySet()) {
List<HostPacket> pktlist = es.getValue();
for (HostPacket pkt : pktlist) {
NetworkPacket hpkt = new NetworkPacket(this.getId(), pkt,
vm.getId(), pkt.sender);
Vm vm2 = VmList
.getById(this.getVmList(), hpkt.recievervmid);
if (vm2 != null)
NetworkPacket hpkt = new NetworkPacket(this.getId(), pkt, vm.getId(), pkt.sender);
Vm vm2 = VmList.getById(this.getVmList(), hpkt.recievervmid);
if (vm2 != null) {
this.packetTosendLocal.add(hpkt);
else
} else {
this.packetTosendGlobal.add(hpkt);
}
}
pktlist.clear();
}
......@@ -172,12 +175,13 @@ public class NetworkHost extends Host {
Vm vm = VmList.getById(getVmList(), hs.pkt.reciever);
// Vm vm=getVmList().get(hs.pkt.reciever);
List<HostPacket> pktlist = ((NetworkCloudletSpaceSharedScheduler) vm
.getCloudletScheduler()).pktrecv.get(hs.pkt.sender);
List<HostPacket> pktlist = ((NetworkCloudletSpaceSharedScheduler) vm.getCloudletScheduler()).pktrecv
.get(hs.pkt.sender);
if (pktlist == null) {
pktlist = new ArrayList<HostPacket>();
((NetworkCloudletSpaceSharedScheduler) vm.getCloudletScheduler()).pktrecv
.put(hs.pkt.sender, pktlist);
((NetworkCloudletSpaceSharedScheduler) vm.getCloudletScheduler()).pktrecv.put(
hs.pkt.sender,
pktlist);
}
pktlist.add(hs.pkt);
......@@ -188,13 +192,13 @@ public class NetworkHost extends Host {
// continue;
// }
double time = ((NetworkVm) vm).updateVmProcessing(CloudSim
.clock(), getVmScheduler().getAllocatedMipsForVm(vm));
vm.updateVmProcessing(CloudSim.clock(), getVmScheduler().getAllocatedMipsForVm(vm));
}
}
//Sending packet to other VMs therefore packet is forwarded to a Edge switch
// Sending packet to other VMs therefore packet is forwarded to a Edge
// switch
this.packetTosendLocal.clear();
double avband = this.bandwidth / packetTosendGlobal.size();
......@@ -203,16 +207,19 @@ public class NetworkHost extends Host {
NetworkConstants.totaldatatransfer += hs.pkt.data;
// System.out.println(hs.pkt.virtualsendid+" "+hs.pkt.virtualrecvid+" "+hs.pkt.data);
CloudSim.send(this.getDatacenter().getId(), this.sw.getId(), delay,
CloudSimTags.Network_Event_UP, hs);
CloudSim.send(
this.getDatacenter().getId(),
this.sw.getId(),
delay,
CloudSimTags.Network_Event_UP,
hs);
// send to switch with delay
}
this.packetTosendGlobal.clear();
}
@SuppressWarnings("unchecked")
public double getMaxUtilizationAmongVmsPes(Vm vm) {
return PeList.getMaxUtilizationAmongVmsPes((List<Pe>) getPeList(), vm);
return PeList.getMaxUtilizationAmongVmsPes(getPeList(), vm);
}
}
package org.cloudbus.cloudsim.network.datacenter;
import java.util.ArrayList;
import java.util.List;
import org.cloudbus.cloudsim.CloudletScheduler;
import org.cloudbus.cloudsim.Vm;
/**
* NetworkVm class extends Vm to support simulation of networked datacenters.
* It executes actions related to management of packets (send and receive).
* NetworkVm class extends Vm to support simulation of networked datacenters. It
* executes actions related to management of packets (send and receive).
*
* Please refer to following publication for more details:
*
......@@ -19,16 +18,23 @@ import org.cloudbus.cloudsim.Vm;
*
*
* @author Saurabh Kumar Garg
* @since CloudSim Toolkit 1.0
* @since CloudSim Toolkit 3.0
*/
public class NetworkVm extends Vm implements Comparable {
public class NetworkVm extends Vm implements Comparable<Object> {
public NetworkVm(
int id,
int userId,
double mips,
int pesNumber,
int ram,
long bw,
long size,
String vmm,
CloudletScheduler cloudletScheduler) {
super(id, userId, mips, pesNumber, ram, bw, size, vmm, cloudletScheduler);
public NetworkVm(int id, int userId, double mips, int pesNumber, int ram,
long bw, long size, String vmm, CloudletScheduler cloudletScheduler) {
super(id, userId, mips, pesNumber, ram, bw, size, vmm,
cloudletScheduler);
// TODO Auto-generated constructor stub
cloudletlist = new ArrayList<NetworkCloudlet>();
}
......@@ -45,10 +51,12 @@ public class NetworkVm extends Vm implements Comparable {
public int compareTo(Object arg0) {
NetworkVm hs = (NetworkVm) arg0;
if (hs.finishtime > this.finishtime)
if (hs.finishtime > this.finishtime) {
return -1;
if (hs.finishtime < this.finishtime)
}
if (hs.finishtime < this.finishtime) {
return 1;
}
return 0;
}
}
......@@ -4,9 +4,9 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.Map.Entry;
import org.cloudbus.cloudsim.Log;
import org.cloudbus.cloudsim.Vm;
......@@ -67,30 +67,7 @@ public class Switch extends SimEntity {
public Switch(String name, int level, NetworkDatacenter dc) {
super(name);
this.level = level;
/*
* if(level==Constants.EDGE_LEVEL) { hostlist=new HashMap<Integer,HPCHost>();
* uplinkswitchpktlist=new HashMap<Integer,List<HostPacket>>(); packetTohost=new
* HashMap<Integer,List<HostPacket>>(); uplinkbandwidth=Constants.BandWidthEdgeAgg;
* downlinkbandwidth=Constants.BandWidthEdgeHost; latency=Constants.SwitchingDelayEdge;
* numport=Constants.EdgeSwitchPort; uplinkswitches=new ArrayList<Switch>();
*
* } if(level==Constants.Agg_LEVEL) { downlinkswitchpktlist=new
* HashMap<Integer,List<HostPacket>>(); uplinkswitchpktlist=new
* HashMap<Integer,List<HostPacket>>(); uplinkbandwidth=Constants.BandWidthAggRoot;
* downlinkbandwidth=Constants.BandWidthEdgeAgg; latency=Constants.SwitchingDelayAgg;
* numport=Constants.AggSwitchPort; uplinkswitches=new ArrayList<Switch>();
* downlinkswitches=new ArrayList<Switch>(); } if(level==Constants.ROOT_LEVEL) {
* downlinkswitchpktlist=new HashMap<Integer,List<HostPacket>>(); downlinkswitches=new
* ArrayList<Switch>();
*
* downlinkbandwidth=Constants.BandWidthAggRoot; latency=Constants.SwitchingDelayRoot;
* numport=Constants.RootSwitchPort;
*
* }
*/
this.dc = dc;
// TODO Auto-generated constructor stub
}
@Override
......@@ -131,7 +108,6 @@ public class Switch extends SimEntity {
}
protected void processhostpacket(SimEvent ev) {
// TODO Auto-generated method stub
// Send packet to host
NetworkPacket hspkt = (NetworkPacket) ev.getData();
NetworkHost hs = hostlist.get(hspkt.recieverhostid);
......@@ -139,7 +115,6 @@ public class Switch extends SimEntity {
}
protected void processpacket_down(SimEvent ev) {
// TODO Auto-generated method stub
// packet coming from up level router.
// has to send downward
// check which switch to forward to
......@@ -178,7 +153,6 @@ public class Switch extends SimEntity {
}
protected void processpacket_up(SimEvent ev) {
// TODO Auto-generated method stub
// packet coming from down level router.
// has to send up
// check which switch to forward to
......@@ -277,13 +251,11 @@ public class Switch extends SimEntity {
}
private void registerHost(SimEvent ev) {
// TODO Auto-generated method stub
NetworkHost hs = (NetworkHost) ev.getData();
hostlist.put(hs.getId(), (NetworkHost) ev.getData());
}
protected void processpacket(SimEvent ev) {
// TODO Auto-generated method stub
// send packet to itself with switching delay (discarding other)
CloudSim.cancelAll(getId(), new PredicateType(CloudSimTags.Network_Event_UP));
schedule(getId(), switching_delay, CloudSimTags.Network_Event_UP);
......@@ -294,12 +266,10 @@ public class Switch extends SimEntity {
}
private void processOtherEvent(SimEvent ev) {
// TODO Auto-generated method stub
}
protected void processpacketforward(SimEvent ev) {
// TODO Auto-generated method stub
// search for the host and packets..send to them
if (downlinkswitchpktlist != null) {
......@@ -338,8 +308,6 @@ public class Switch extends SimEntity {
}
if (packetTohost != null) {
for (Entry<Integer, List<NetworkPacket>> es : packetTohost.entrySet()) {
int tosend = es.getKey();
NetworkHost hs = hostlist.get(tosend);
List<NetworkPacket> hspktlist = es.getValue();
if (!hspktlist.isEmpty()) {
double avband = downlinkbandwidth / hspktlist.size();
......@@ -360,8 +328,11 @@ public class Switch extends SimEntity {
}
private NetworkHost getHostwithVM(int vmid) {
// TODO Auto-generated method stub
//
// R: We changed visibility of the below methods from private to protected.
//
protected NetworkHost getHostwithVM(int vmid) {
for (Entry<Integer, NetworkHost> es : hostlist.entrySet()) {
Vm vm = VmList.getById(es.getValue().getVmList(), vmid);
if (vm != null) {
......@@ -371,8 +342,7 @@ public class Switch extends SimEntity {
return null;
}
private List<NetworkVm> getfreeVmlist(int numVMReq) {
// TODO Auto-generated method stub
protected List<NetworkVm> getfreeVmlist(int numVMReq) {
List<NetworkVm> freehostls = new ArrayList<NetworkVm>();
for (Entry<Integer, NetworkVm> et : Vmlist.entrySet()) {
if (et.getValue().isFree()) {
......@@ -386,8 +356,7 @@ public class Switch extends SimEntity {
return freehostls;
}
private List<NetworkHost> getfreehostlist(int numhost) {
// TODO Auto-generated method stub
protected List<NetworkHost> getfreehostlist(int numhost) {
List<NetworkHost> freehostls = new ArrayList<NetworkHost>();
for (Entry<Integer, NetworkHost> et : hostlist.entrySet()) {
if (et.getValue().getNumberOfFreePes() == et.getValue().getNumberOfPes()) {
......
......@@ -22,65 +22,110 @@ import org.cloudbus.cloudsim.UtilizationModel;
import org.cloudbus.cloudsim.UtilizationModelFull;
import org.cloudbus.cloudsim.core.CloudSim;
public class WorkflowApp extends AppCloudlet{
public class WorkflowApp extends AppCloudlet {
public WorkflowApp(int type, int appID, double deadline,
int numbervm, int userId) {
public WorkflowApp(int type, int appID, double deadline, int numbervm, int userId) {
super(type, appID, deadline, numbervm, userId);
// TODO Auto-generated constructor stub
this.exeTime=100;
this.numbervm=3;
this.exeTime = 100;
this.numbervm = 3;
}
public void createCloudletList(List<Integer> vmIdList){
@Override
public void createCloudletList(List<Integer> vmIdList) {
long fileSize = NetworkConstants.FILE_SIZE;
long outputSize = NetworkConstants.OUTPUT_SIZE;
int pesNumber = NetworkConstants.PES_NUMBER;
int memory=100;
int memory = 100;
UtilizationModel utilizationModel = new UtilizationModelFull();
int i=0;
//Task A
NetworkCloudlet cl = new NetworkCloudlet(NetworkConstants.currentCloudletId, 0, 1, fileSize, outputSize, memory, utilizationModel, utilizationModel, utilizationModel);
cl.numStage=2;
int i = 0;
// Task A
NetworkCloudlet cl = new NetworkCloudlet(
NetworkConstants.currentCloudletId,
0,
1,
fileSize,
outputSize,
memory,
utilizationModel,
utilizationModel,
utilizationModel);
cl.numStage = 2;
NetworkConstants.currentCloudletId++;
cl.setUserId(userId);
cl.submittime=CloudSim.clock();
cl.currStagenum=-1;
cl.submittime = CloudSim.clock();
cl.currStagenum = -1;
cl.setVmId(vmIdList.get(i));
//first stage: big computation
cl.stages.add(new TaskStage(NetworkConstants.EXECUTION, 0, 1000*0.8, 0, memory, vmIdList.get(0),cl.getCloudletId()));
cl.stages.add(new TaskStage(NetworkConstants.WAIT_SEND, 1000, 0, 1, memory, vmIdList.get(2),cl.getCloudletId()+2));
// first stage: big computation
cl.stages.add(new TaskStage(NetworkConstants.EXECUTION, 0, 1000 * 0.8, 0, memory, vmIdList.get(0), cl
.getCloudletId()));
cl.stages.add(new TaskStage(NetworkConstants.WAIT_SEND, 1000, 0, 1, memory, vmIdList.get(2), cl
.getCloudletId() + 2));
clist.add(cl);
i++;
//Task B
NetworkCloudlet clb = new NetworkCloudlet(NetworkConstants.currentCloudletId, 0, 1, fileSize, outputSize, memory, utilizationModel, utilizationModel, utilizationModel);
clb.numStage=2;
// Task B
NetworkCloudlet clb = new NetworkCloudlet(
NetworkConstants.currentCloudletId,
0,
1,
fileSize,
outputSize,
memory,
utilizationModel,
utilizationModel,
utilizationModel);
clb.numStage = 2;
NetworkConstants.currentCloudletId++;
clb.setUserId(userId);
clb.submittime=CloudSim.clock();
clb.currStagenum=-1;
clb.submittime = CloudSim.clock();
clb.currStagenum = -1;
clb.setVmId(vmIdList.get(i));
//first stage: big computation
// first stage: big computation
clb.stages.add(new TaskStage(NetworkConstants.EXECUTION, 0, 1000*0.8, 0, memory, vmIdList.get(1),clb.getCloudletId()));
clb.stages.add(new TaskStage(NetworkConstants.WAIT_SEND, 1000, 0, 1, memory, vmIdList.get(2),clb.getCloudletId()+1));
clb.stages.add(new TaskStage(
NetworkConstants.EXECUTION,
0,
1000 * 0.8,
0,
memory,
vmIdList.get(1),
clb.getCloudletId()));
clb.stages.add(new TaskStage(NetworkConstants.WAIT_SEND, 1000, 0, 1, memory, vmIdList.get(2), clb
.getCloudletId() + 1));
clist.add(clb);
i++;
//Task C
NetworkCloudlet clc = new NetworkCloudlet(NetworkConstants.currentCloudletId, 0, 1, fileSize, outputSize, memory, utilizationModel, utilizationModel, utilizationModel);
clc.numStage=2;
// Task C
NetworkCloudlet clc = new NetworkCloudlet(
NetworkConstants.currentCloudletId,
0,
1,
fileSize,
outputSize,
memory,
utilizationModel,
utilizationModel,
utilizationModel);
clc.numStage = 2;
NetworkConstants.currentCloudletId++;
clc.setUserId(userId);
clc.submittime=CloudSim.clock();
clc.currStagenum=-1;
clc.submittime = CloudSim.clock();
clc.currStagenum = -1;
clc.setVmId(vmIdList.get(i));
//first stage: big computation
clc.stages.add(new TaskStage(NetworkConstants.WAIT_RECV, 1000, 0, 0, memory, vmIdList.get(0),cl.getCloudletId()));
clc.stages.add(new TaskStage(NetworkConstants.WAIT_RECV, 1000, 0, 1, memory, vmIdList.get(1),cl.getCloudletId()+1));
clc.stages.add(new TaskStage(NetworkConstants.EXECUTION, 0, 1000*0.8, 1, memory, vmIdList.get(0),clc.getCloudletId()));
// first stage: big computation
clc.stages.add(new TaskStage(NetworkConstants.WAIT_RECV, 1000, 0, 0, memory, vmIdList.get(0), cl
.getCloudletId()));
clc.stages.add(new TaskStage(NetworkConstants.WAIT_RECV, 1000, 0, 1, memory, vmIdList.get(1), cl
.getCloudletId() + 1));
clc.stages.add(new TaskStage(
NetworkConstants.EXECUTION,
0,
1000 * 0.8,
1,
memory,
vmIdList.get(0),
clc.getCloudletId()));
clist.add(clc);
......
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