本文整理汇总了Java中org.cloudbus.cloudsim.VmSchedulerTimeShared类的典型用法代码示例。如果您正苦于以下问题:Java VmSchedulerTimeShared类的具体用法?Java VmSchedulerTimeShared怎么用?Java VmSchedulerTimeShared使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VmSchedulerTimeShared类属于org.cloudbus.cloudsim包,在下文中一共展示了VmSchedulerTimeShared类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DynamicHost
import org.cloudbus.cloudsim.VmSchedulerTimeShared; //导入依赖的package包/类
public DynamicHost(int id, int ram, long bandwidth, long io, long storage, double numberOfCusPerPe, int numberOfPes, double mipsPerPe) {
super(id, new RamProvisionerSimple(ram), new BwProvisionerFull(bandwidth), storage, new ArrayList<Pe>(), null);
setIo(io);
setMipsPerPe(mipsPerPe);
setNumberOfCusPerPe(numberOfCusPerPe);
List<Pe> peList = new ArrayList<>();
for (int i = 0; i < numberOfPes; i++) {
peList.add(new Pe(i, new PeProvisionerSimple(mipsPerPe)));
}
setPeList(peList);
setVmScheduler(new VmSchedulerTimeShared(peList));
setFailed(false);
localFiles = new HashSet<>();
}
示例2: createHost
import org.cloudbus.cloudsim.VmSchedulerTimeShared; //导入依赖的package包/类
private static List<Host> createHost(int numberHosts){
List<Host> hostList = new ArrayList<Host>();
for(int i = 0 ; i < numberHosts ; i++){
List<Pe> peList = new ArrayList<Pe>();
int mips = Processors.Intel.Core_i7_Extreme_Edition_3960X.mips;
int cores = Processors.Intel.Core_i7_Extreme_Edition_3960X.cores;
for (int j = 0; j < cores; j++) {
peList.add(new Pe(j, new PeProvisionerSimple(mips / cores)));
}
int host_ID = 1+i;
int host_ram = 16384; //16 GB
long host_storage = 4194304; // 4 TB
int host_bw = 15360; // 15 GB ... Amazon EC2
hostList.add(new Host(host_ID, new RamProvisionerSimple(host_ram),
new BwProvisionerSimple(host_bw), host_storage,
//peList, new VmSchedulerSpaceShared(peList)));
peList, new VmSchedulerTimeShared(peList)));
//peList, new VmSchedulerTimeSharedOverSubscription(peList)));
}
return hostList;
}
示例3: createDatacenter
import org.cloudbus.cloudsim.VmSchedulerTimeShared; //导入依赖的package包/类
protected static WorkflowDatacenter createDatacenter(String name) {
// Here are the steps needed to create a PowerDatacenter:
// 1. We need to create a list to store one or more
// Machines
List<Host> hostList = new ArrayList<>();
// 2. A Machine contains one or more PEs or CPUs/Cores. Therefore, should
// create a list to store these PEs before creating
// a Machine.
for (int i = 1; i <= 20; i++) {
List<Pe> peList1 = new ArrayList<>();
int mips = 2000;
// 3. Create PEs and add these into the list.
//for a quad-core machine, a list of 4 PEs is required:
peList1.add(new Pe(0, new PeProvisionerSimple(mips))); // need to store Pe id and MIPS Rating
peList1.add(new Pe(1, new PeProvisionerSimple(mips)));
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,
peList1,
new VmSchedulerTimeShared(peList1))); // This is our first machine
hostId++;
}
// 5. Create a DatacenterCharacteristics object that stores the
// properties of a data center: architecture, OS, list of
// Machines, allocation policy: time- or space-shared, time zone
// and its price (G$/Pe time unit).
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.1; // the cost of using storage in this resource
double costPerBw = 0.1; // the cost of using bw in this resource
LinkedList<Storage> storageList = new LinkedList<>(); //we are not adding SAN devices by now
WorkflowDatacenter datacenter = null;
DatacenterCharacteristics characteristics = new DatacenterCharacteristics(
arch, os, vmm, hostList, time_zone, cost, costPerMem, costPerStorage, costPerBw);
// 6. Finally, we need to create a storage object.
/**
* The bandwidth within a data center in MB/s.
*/
int maxTransferRate = 15;// the number comes from the futuregrid site, you can specify your bw
try {
HarddriveStorage s1 = new HarddriveStorage(name, 1e12);
s1.setMaxTransferRate(maxTransferRate);
storageList.add(s1);
datacenter = new WorkflowDatacenter(name, characteristics, new VmAllocationPolicySimple(hostList), storageList, 0);
} catch (Exception e) {
e.printStackTrace();
}
return datacenter;
}
示例4: createDatacenter
import org.cloudbus.cloudsim.VmSchedulerTimeShared; //导入依赖的package包/类
protected static WorkflowDatacenter createDatacenter(String name) {
// Here are the steps needed to create a PowerDatacenter:
// 1. We need to create a list to store one or more
// Machines
List<Host> hostList = new ArrayList<>();
// 2. A Machine contains one or more PEs or CPUs/Cores. Therefore, should
// create a list to store these PEs before creating
// a Machine.
for (int i = 1; i <= 20; i++) {
List<Pe> peList1 = new ArrayList<>();
int mips = 2000;
// 3. Create PEs and add these into the list.
//for a quad-core machine, a list of 4 PEs is required:
peList1.add(new Pe(0, new PeProvisionerSimple(mips))); // need to store Pe id and MIPS Rating
peList1.add(new Pe(1, new PeProvisionerSimple(mips)));
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,
peList1,
new VmSchedulerTimeShared(peList1))); // This is our first machine
//hostId++;
}
// 4. Create a DatacenterCharacteristics object that stores the
// properties of a data center: architecture, OS, list of
// Machines, allocation policy: time- or space-shared, time zone
// and its price (G$/Pe time unit).
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.1; // the cost of using storage in this resource
double costPerBw = 0.1; // the cost of using bw in this resource
LinkedList<Storage> storageList = new LinkedList<>(); //we are not adding SAN devices by now
WorkflowDatacenter datacenter = null;
DatacenterCharacteristics characteristics = new DatacenterCharacteristics(
arch, os, vmm, hostList, time_zone, cost, costPerMem, costPerStorage, costPerBw);
// 5. Finally, we need to create a storage object.
/**
* The bandwidth within a data center in MB/s.
*/
int maxTransferRate = 15;// the number comes from the futuregrid site, you can specify your bw
try {
// Here we set the bandwidth to be 15MB/s
HarddriveStorage s1 = new HarddriveStorage(name, 1e12);
s1.setMaxTransferRate(maxTransferRate);
storageList.add(s1);
datacenter = new WorkflowDatacenter(name, characteristics, new VmAllocationPolicySimple(hostList), storageList, 0);
} catch (Exception e) {
e.printStackTrace();
}
return datacenter;
}