本文整理汇总了Java中org.cloudbus.cloudsim.power.PowerHost类的典型用法代码示例。如果您正苦于以下问题:Java PowerHost类的具体用法?Java PowerHost怎么用?Java PowerHost使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PowerHost类属于org.cloudbus.cloudsim.power包,在下文中一共展示了PowerHost类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createHostList
import org.cloudbus.cloudsim.power.PowerHost; //导入依赖的package包/类
/**
* Creates the host list.
*
* @param hostsNumber the hosts number
*
* @return the list< power host>
*/
public static List<PowerHost> createHostList(int hostsNumber) {
List<PowerHost> hostList = new ArrayList<PowerHost>();
for (int i = 0; i < hostsNumber; i++) {
int hostType = i % Constants.HOST_TYPES;
List<Pe> peList = new ArrayList<Pe>();
for (int j = 0; j < Constants.HOST_PES[hostType]; j++) {
peList.add(new Pe(j, new PeProvisionerSimple(Constants.HOST_MIPS[hostType])));
}
hostList.add(new PowerHostUtilizationHistory(
i,
new RamProvisionerSimple(Constants.HOST_RAM[hostType]),
new BwProvisionerSimple(Constants.HOST_BW),
Constants.HOST_STORAGE,
peList,
new VmSchedulerTimeSharedOverSubscription(peList),
Constants.HOST_POWER[hostType]));
}
return hostList;
}
开发者ID:Udacity2048,项目名称:CloudSimDisk,代码行数:29,代码来源:Helper.java
示例2: main
import org.cloudbus.cloudsim.power.PowerHost; //导入依赖的package包/类
/**
* The main method.
*
* @param args the arguments
* @throws IOException Signals that an I/O exception has occurred.
*/
public static void main(String[] args) throws IOException {
String experimentName = "planetlab_npa";
String outputFolder = "output";
String inputFolder = NonPowerAware.class.getClassLoader().getResource("workload/planetlab/20110303")
.getPath();
Log.setDisabled(!Constants.ENABLE_OUTPUT);
Log.printLine("Starting " + experimentName);
try {
CloudSim.init(1, Calendar.getInstance(), false);
DatacenterBroker broker = Helper.createBroker();
int brokerId = broker.getId();
List<Cloudlet> cloudletList = PlanetLabHelper.createCloudletListPlanetLab(brokerId, inputFolder);
List<Vm> vmList = Helper.createVmList(brokerId, cloudletList.size());
List<PowerHost> hostList = Helper.createHostList(PlanetLabConstants.NUMBER_OF_HOSTS);
PowerDatacenterNonPowerAware datacenter = (PowerDatacenterNonPowerAware) Helper.createDatacenter(
"Datacenter",
PowerDatacenterNonPowerAware.class,
hostList,
new PowerVmAllocationPolicySimple(hostList));
datacenter.setDisableMigrations(true);
broker.submitVmList(vmList);
broker.submitCloudletList(cloudletList);
CloudSim.terminateSimulation(Constants.SIMULATION_LIMIT);
double lastClock = CloudSim.startSimulation();
List<Cloudlet> newList = broker.getCloudletReceivedList();
Log.printLine("Received " + newList.size() + " cloudlets");
CloudSim.stopSimulation();
Helper.printResults(
datacenter,
vmList,
lastClock,
experimentName,
Constants.OUTPUT_CSV,
outputFolder);
} catch (Exception e) {
e.printStackTrace();
Log.printLine("The simulation has been terminated due to an unexpected error");
System.exit(0);
}
Log.printLine("Finished " + experimentName);
}
开发者ID:Udacity2048,项目名称:CloudSimDisk,代码行数:61,代码来源:NonPowerAware.java
示例3: createHostList
import org.cloudbus.cloudsim.power.PowerHost; //导入依赖的package包/类
/**
* Creates the host list.
*
* @param hostsNumber the hosts number
*
* @return the list< power host>
*/
public static List<PowerHost> createHostList(int hostsNumber) {
List<PowerHost> hostList = new ArrayList<PowerHost>();
for (int i = 0; i < hostsNumber; i++) {
int hostType = i % Constants.HOST_TYPES;
List<Pe> peList = new ArrayList<Pe>();
//HOST_PES 每台物理机中的处理单元个数
for (int j = 0; j < Constants.HOST_PES[hostType]; j++) {
peList.add(new Pe(j, new PeProvisionerSimple(Constants.HOST_MIPS[hostType])));
}
hostList.add(new PowerHostUtilizationHistory(
i,
new RamProvisionerSimple(Constants.HOST_RAM[hostType]),
new BwProvisionerSimple(Constants.HOST_BW),
Constants.HOST_STORAGE,
peList,
new VmSchedulerTimeSharedOverSubscription(peList),
// 设置能耗模型
Constants.HOST_POWER[hostType]));
}
return hostList;
}
开发者ID:demiaowu,项目名称:annotation-of-cloudsim3.0.3,代码行数:31,代码来源:Helper.java
示例4: getHost
import org.cloudbus.cloudsim.power.PowerHost; //导入依赖的package包/类
public PowerHost getHost(){
return (PowerHost) getHostList().get(0);
}
开发者ID:gmartinezramirez,项目名称:Fog-Computing-Mobile-Architecture,代码行数:4,代码来源:FogDevice.java
示例5: createHostList
import org.cloudbus.cloudsim.power.PowerHost; //导入依赖的package包/类
/**
* Creates the host list.
*
* @param hostsNumber
* the hosts number
*/
public void createHostList(int hostsNumber) {
for (int i = 1; i <= hostsNumber; i++) {
hostList.add(new PowerHost(i, new RamProvisionerSimple(MyConstants.HOST_RAM), new BwProvisionerSimple(
MyConstants.HOST_BW), MyConstants.HOST_STORAGE, peList, new VmSchedulerTimeSharedOverSubscription(
peList), MyConstants.HOST_POWER_MODEL));
}
}
开发者ID:Udacity2048,项目名称:CloudSimDisk,代码行数:14,代码来源:Helper.java
示例6: isHostOverUtilized
import org.cloudbus.cloudsim.power.PowerHost; //导入依赖的package包/类
/**
* Checks if is host over utilized.
*
* @param _host the _host
* @return true, if is host over utilized
*/
@Override
protected boolean isHostOverUtilized(PowerHost host) {
addHistoryEntry(host, getUtilizationThreshold());
double totalRequestedMips = 0;
for (Vm vm : host.getVmList()) {
totalRequestedMips += vm.getCurrentRequestedTotalMips();
}
double utilization = totalRequestedMips / host.getTotalMips();
return utilization > getUtilizationThreshold();
}
开发者ID:StVak,项目名称:cloudsimPowerStats,代码行数:17,代码来源:PowerVmAllocationPolicyMigrationStaticThreshold.java
示例7: createFogDevice
import org.cloudbus.cloudsim.power.PowerHost; //导入依赖的package包/类
private static FogDevice createFogDevice(String nodeName, long mips,
int ram, long upBw, long downBw, int level, double ratePerMips) {
List<Pe> peList = new ArrayList<Pe>();
// 3. Create PEs and add these into a list.
peList.add(new Pe(0, new PeProvisionerOverbooking(mips))); // need to store Pe id and MIPS Rating
int hostId = FogUtils.generateEntityId();
long storage = 1000000; // host storage
int bw = 10000;
PowerHost host = new PowerHost(
hostId,
new RamProvisionerSimple(ram),
new BwProvisionerOverbooking(bw),
storage,
peList,
new StreamOperatorScheduler(peList),
new PowerModelLinear(107.339, 83.4333)
);
List<Host> hostList = new ArrayList<Host>();
hostList.add(host);
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
FogDeviceCharacteristics characteristics = new FogDeviceCharacteristics(
arch, os, vmm, host, time_zone, cost, costPerMem,
costPerStorage, costPerBw);
FogDevice fogdevice = null;
try {
fogdevice = new FogDevice(nodeName, characteristics,
new AppModuleAllocationPolicy(hostList), storageList, 10, upBw, downBw, 0, ratePerMips);
} catch (Exception e) {
e.printStackTrace();
}
fogdevice.setLevel(level);
return fogdevice;
}
开发者ID:gmartinezramirez,项目名称:Fog-Computing-Mobile-Architecture,代码行数:53,代码来源:JsonToTopology.java
示例8: createFogDevice
import org.cloudbus.cloudsim.power.PowerHost; //导入依赖的package包/类
public static FogDevice createFogDevice(String name, int mips, double uplinkBandwidth, double downlinkBandwidth, double latency, double ratePerMips) {
List<Pe> peList = new ArrayList<Pe>();
peList.add(new Pe(0, new PeProvisionerOverbooking(mips))); // need to store Pe id and MIPS Rating
int hostId = FogUtils.generateEntityId();
int ram = 2048; // host memory (MB)
long storage = 1000000; // host storage
int bw = 10000;
PowerHost host = new PowerHost(
hostId,
new RamProvisionerSimple(ram),
new BwProvisionerOverbooking(bw),
storage,
peList,
new StreamOperatorScheduler(peList),
new PowerModelLinear(100, 40)
);
List<Host> hostList = new ArrayList<Host>();
hostList.add(host);
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
FogDeviceCharacteristics characteristics = new FogDeviceCharacteristics(
arch, os, vmm, host, time_zone, cost, costPerMem,
costPerStorage, costPerBw);
FogDevice fogdevice = null;
try {
fogdevice = new FogDevice(name, characteristics,
new AppModuleAllocationPolicy(hostList), storageList, 10, uplinkBandwidth, downlinkBandwidth, latency, ratePerMips);
} catch (Exception e) {
e.printStackTrace();
}
return fogdevice;
}
开发者ID:gmartinezramirez,项目名称:Fog-Computing-Mobile-Architecture,代码行数:50,代码来源:FogEntityFactory.java
示例9: createFogDevice
import org.cloudbus.cloudsim.power.PowerHost; //导入依赖的package包/类
/**
* Creates a vanilla fog device
* @param nodeName name of the device to be used in simulation
* @param mips MIPS
* @param ram RAM
* @param upBw uplink bandwidth
* @param downBw downlink bandwidth
* @param level hierarchy level of the device
* @param ratePerMips cost rate per MIPS used
* @param busyPower
* @param idlePower
* @return
*/
private static FogDevice createFogDevice(String nodeName, long mips,
int ram, long upBw, long downBw, int level, double ratePerMips, double busyPower, double idlePower) {
List<Pe> peList = new ArrayList<Pe>();
// 3. Create PEs and add these into a list.
peList.add(new Pe(0, new PeProvisionerOverbooking(mips))); // need to store Pe id and MIPS Rating
int hostId = FogUtils.generateEntityId();
long storage = 1000000; // host storage
int bw = 10000;
PowerHost host = new PowerHost(
hostId,
new RamProvisionerSimple(ram),
new BwProvisionerOverbooking(bw),
storage,
peList,
new StreamOperatorScheduler(peList),
new FogLinearPowerModel(busyPower, idlePower)
);
List<Host> hostList = new ArrayList<Host>();
hostList.add(host);
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
FogDeviceCharacteristics characteristics = new FogDeviceCharacteristics(
arch, os, vmm, host, time_zone, cost, costPerMem,
costPerStorage, costPerBw);
FogDevice fogdevice = null;
try {
fogdevice = new FogDevice(nodeName, characteristics,
new AppModuleAllocationPolicy(hostList), storageList, 10, upBw, downBw, 0, ratePerMips);
} catch (Exception e) {
e.printStackTrace();
}
fogdevice.setLevel(level);
return fogdevice;
}
开发者ID:gmartinezramirez,项目名称:Fog-Computing-Mobile-Architecture,代码行数:66,代码来源:DCNSFogCloudHigh.java
示例10: createFogDevice
import org.cloudbus.cloudsim.power.PowerHost; //导入依赖的package包/类
/**
* Creates a vanilla fog device
* @param nodeName name of the device to be used in simulation
* @param mips MIPS
* @param ram RAM
* @param upBw uplink bandwidth
* @param downBw downlink bandwidth
* @param level hierarchy level of the device
* @param ratePerMips cost rate per MIPS used
* @param busyPower
* @param idlePower
* @return
*/
private static FogDevice createFogDevice(String nodeName, long mips,
int ram, long upBw, long downBw, int level, double ratePerMips,
double busyPower, double idlePower) {
List<Pe> peList = new ArrayList<Pe>();
// 3. Create PEs and add these into a list.
peList.add(new Pe(0, new PeProvisionerOverbooking(mips))); // need to store Pe id and MIPS Rating
int hostId = FogUtils.generateEntityId();
long storage = 1000000; // host storage
int bw = 10000;
PowerHost host = new PowerHost(
hostId,
new RamProvisionerSimple(ram),
new BwProvisionerOverbooking(bw),
storage,
peList,
new StreamOperatorScheduler(peList),
new FogLinearPowerModel(busyPower, idlePower)
);
List<Host> hostList = new ArrayList<Host>();
hostList.add(host);
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
FogDeviceCharacteristics characteristics = new FogDeviceCharacteristics(
arch, os, vmm, host, time_zone, cost, costPerMem,
costPerStorage, costPerBw);
FogDevice fogdevice = null;
try {
fogdevice = new FogDevice(nodeName, characteristics,
new AppModuleAllocationPolicy(hostList), storageList, 10, upBw, downBw, 0, ratePerMips);
} catch (Exception e) {
e.printStackTrace();
}
fogdevice.setLevel(level);
return fogdevice;
}
开发者ID:gmartinezramirez,项目名称:Fog-Computing-Mobile-Architecture,代码行数:65,代码来源:templateAppLinealOperators.java
示例11: createDatacenter
import org.cloudbus.cloudsim.power.PowerHost; //导入依赖的package包/类
/**
* Creates the datacenter.
*
* @param name the name
* @param datacenterClass the datacenter class
* @param hostList the host list
* @param vmAllocationPolicy the vm allocation policy
* @param simulationLength
*
* @return the power datacenter
*
* @throws Exception the exception
*/
public static Datacenter createDatacenter(
String name,
Class<? extends Datacenter> datacenterClass,
List<PowerHost> hostList,
VmAllocationPolicy vmAllocationPolicy) throws Exception {
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
DatacenterCharacteristics characteristics = new DatacenterCharacteristics(
arch,
os,
vmm,
hostList,
time_zone,
cost,
costPerMem,
costPerStorage,
costPerBw);
Datacenter datacenter = null;
try {
datacenter = datacenterClass.getConstructor(
String.class,
DatacenterCharacteristics.class,
VmAllocationPolicy.class,
List.class,
Double.TYPE).newInstance(
name,
characteristics,
vmAllocationPolicy,
new LinkedList<Storage>(),
Constants.SCHEDULING_INTERVAL);
} catch (Exception e) {
e.printStackTrace();
System.exit(0);
}
return datacenter;
}
开发者ID:Udacity2048,项目名称:CloudSimDisk,代码行数:59,代码来源:Helper.java
示例12: main
import org.cloudbus.cloudsim.power.PowerHost; //导入依赖的package包/类
/**
* Creates main() to run this example.
*
* @param args the args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
String experimentName = "random_npa";
String outputFolder = "output";
Log.setDisabled(!Constants.ENABLE_OUTPUT);
Log.printLine("Starting " + experimentName);
try {
CloudSim.init(1, Calendar.getInstance(), false);
DatacenterBroker broker = Helper.createBroker();
int brokerId = broker.getId();
List<Cloudlet> cloudletList = RandomHelper.createCloudletList(
brokerId,
RandomConstants.NUMBER_OF_VMS);
List<Vm> vmList = Helper.createVmList(brokerId, cloudletList.size());
List<PowerHost> hostList = Helper.createHostList(RandomConstants.NUMBER_OF_HOSTS);
PowerDatacenterNonPowerAware datacenter = (PowerDatacenterNonPowerAware) Helper.createDatacenter(
"Datacenter",
PowerDatacenterNonPowerAware.class,
hostList,
new PowerVmAllocationPolicySimple(hostList));
datacenter.setDisableMigrations(true);
broker.submitVmList(vmList);
broker.submitCloudletList(cloudletList);
CloudSim.terminateSimulation(Constants.SIMULATION_LIMIT);
double lastClock = CloudSim.startSimulation();
List<Cloudlet> newList = broker.getCloudletReceivedList();
Log.printLine("Received " + newList.size() + " cloudlets");
CloudSim.stopSimulation();
Helper.printResults(
datacenter,
vmList,
lastClock,
experimentName,
Constants.OUTPUT_CSV,
outputFolder);
} catch (Exception e) {
e.printStackTrace();
Log.printLine("The simulation has been terminated due to an unexpected error");
System.exit(0);
}
Log.printLine("Finished " + experimentName);
}
开发者ID:Udacity2048,项目名称:CloudSimDisk,代码行数:61,代码来源:NonPowerAware.java
注:本文中的org.cloudbus.cloudsim.power.PowerHost类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论