这是在阅读CloudSim Example1用例代码后,对CloudSim仿真流程的一点总结
类总结:
参数:id、内存、带宽、储存容量、cpu。。
int hostId = 0;
int ram = 2048; // host memory (MB)
long storage = 1000000; // host storage
int bw = 10000;
hostList.add(
new Host(
hostId,
new RamProvisionerSimple(ram),
new BwProvisionerSimple(bw),
storage,
peList,
new VmSchedulerTimeShared(peList)
)
);
参数:主机架构、操作系统、虚拟机监视器种类??、时区、cpu的使用费用、内存的使用费用、storage的使用费用、带宽的使用费用
String arch = "x86"; // system architecture
String os = "Linux"; // operating system
String vmm = "Xen";
double time_zone = 10.0; // time zone this resource located
double cost = 3.0; // the cost of using processing in this resource
double costPerMem = 0.05; // the cost of using memory in this resource
double costPerStorage = 0.001; // the cost of using storage in this
// resource
double costPerBw = 0.0; // the cost of using bw in this resource
LinkedList<Storage> storageList = new LinkedList<Storage>(); // we are not adding SAN
// devices by now
DatacenterCharacteristics characteristics = new DatacenterCharacteristics(
arch, os, vmm, hostList, time_zone, cost, costPerMem,
costPerStorage, costPerBw); 创建数据中心特征对象来存储数据中心的参数特征
Datacenter datacenter = null;
try {
datacenter = new Datacenter(name, characteristics, new VmAllocationPolicySimple(hostList), storageList, 0);
} catch (Exception e) {
e.printStackTrace();
} 其中VmAllocationSimple表示将VM分配到已经使用Pe最少的物理机中
参数:id、mips(衡量CPU速度的一个指标,单字长定点指令平均执行速度)、镜像大小??、内存大小、带宽、CPU数、虚拟机命名
// VM description
int vmid = 0;
int mips = 1000;
long size = 10000; // image size (MB)
int ram = 512; // vm memory (MB)
long bw = 1000;
int pesNumber = 1; // number of cpus
String vmm = "Xen"; // VMM name
// create VM
Vm vm = new Vm(vmid, brokerId, mips, pesNumber, ram, bw, size, vmm, new CloudletSchedulerTimeShared());
之后// add the VM to the vmList
vmlist.add(vm);
// submit vm list to the broker
broker.submitVmList(vmlist);
参数:应用编号、执行时的应用长度(MI)、要使用到的处理器数量、提交应用前的文件大小(byte)、应用执行完成后的文件大小(byte)、cpu的使用模型/策略、ram的使用模型/策略、网络带宽的使用模型/策略
// Cloudlet properties
int id = 0;
long length = 400000;
long fileSize = 300;
long outputSize = 300;
UtilizationModel utilizationModel = new UtilizationModelFull();
Cloudlet cloudlet =
new Cloudlet(id, length, pesNumber, fileSize,
outputSize, utilizationModel, utilizationModel,
utilizationModel);
cloudlet.setUserId(brokerId);
cloudlet.setVmId(vmid);
而后// add the cloudlet to the list
cloudletList.add(cloudlet);
// submit cloudlet list to the broker
broker.submitCloudletList(cloudletList);