本文整理汇总了Java中org.cloudbus.cloudsim.HostDynamicWorkload类的典型用法代码示例。如果您正苦于以下问题:Java HostDynamicWorkload类的具体用法?Java HostDynamicWorkload怎么用?Java HostDynamicWorkload使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HostDynamicWorkload类属于org.cloudbus.cloudsim包,在下文中一共展示了HostDynamicWorkload类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addHistoryEntry
import org.cloudbus.cloudsim.HostDynamicWorkload; //导入依赖的package包/类
/**
* Adds the history value.
*
* @param host the host
* @param metric the metric
*/
protected void addHistoryEntry(HostDynamicWorkload host, double metric) {
int hostId = host.getId();
if (!getTimeHistory().containsKey(hostId)) {
getTimeHistory().put(hostId, new LinkedList<Double>());
}
if (!getUtilizationHistory().containsKey(hostId)) {
getUtilizationHistory().put(hostId, new LinkedList<Double>());
}
if (!getMetricHistory().containsKey(hostId)) {
getMetricHistory().put(hostId, new LinkedList<Double>());
}
if (!getTimeHistory().get(hostId).contains(CloudSim.clock())) {
getTimeHistory().get(hostId).add(CloudSim.clock());
getUtilizationHistory().get(hostId).add(host.getUtilizationOfCpu());
getMetricHistory().get(hostId).add(metric);
}
}
开发者ID:gmartinezramirez,项目名称:Fog-Computing-Mobile-Architecture,代码行数:24,代码来源:PowerVmAllocationPolicyMigrationAbstract.java
示例2: getTimesBeforeHostShutdown
import org.cloudbus.cloudsim.HostDynamicWorkload; //导入依赖的package包/类
/**
* Gets the times before host shutdown.
*
* @param hosts the hosts
* @return the times before host shutdown
*/
public static List<Double> getTimesBeforeHostShutdown(List<Host> hosts) {
List<Double> timeBeforeShutdown = new LinkedList<Double>();
for (Host host : hosts) {
boolean previousIsActive = true;
double lastTimeSwitchedOn = 0;
for (HostStateHistoryEntry entry : ((HostDynamicWorkload) host).getStateHistory()) {
if (previousIsActive == true && entry.isActive() == false) {
timeBeforeShutdown.add(entry.getTime() - lastTimeSwitchedOn);
}
if (previousIsActive == false && entry.isActive() == true) {
lastTimeSwitchedOn = entry.getTime();
}
previousIsActive = entry.isActive();
}
}
return timeBeforeShutdown;
}
示例3: getSlaTimePerActiveHost
import org.cloudbus.cloudsim.HostDynamicWorkload; //导入依赖的package包/类
/**
* Gets the sla time per active host.
*
* @param hosts the hosts
* @return the sla time per active host
*/
protected static double getSlaTimePerActiveHost(List<Host> hosts) {
double slaViolationTimePerHost = 0;
double totalTime = 0;
for (Host _host : hosts) {
HostDynamicWorkload host = (HostDynamicWorkload) _host;
double previousTime = -1;
double previousAllocated = 0;
double previousRequested = 0;
boolean previousIsActive = true;
for (HostStateHistoryEntry entry : host.getStateHistory()) {
if (previousTime != -1 && previousIsActive) {
double timeDiff = entry.getTime() - previousTime;
totalTime += timeDiff;
if (previousAllocated < previousRequested) {
slaViolationTimePerHost += timeDiff;
}
}
previousAllocated = entry.getAllocatedMips();
previousRequested = entry.getRequestedMips();
previousTime = entry.getTime();
previousIsActive = entry.isActive();
}
}
return slaViolationTimePerHost / totalTime;
}
示例4: getSlaTimePerHost
import org.cloudbus.cloudsim.HostDynamicWorkload; //导入依赖的package包/类
/**
* Gets the sla time per host.
*
* @param hosts the hosts
* @return the sla time per host
*/
protected static double getSlaTimePerHost(List<Host> hosts) {
double slaViolationTimePerHost = 0;
double totalTime = 0;
for (Host _host : hosts) {
HostDynamicWorkload host = (HostDynamicWorkload) _host;
double previousTime = -1;
double previousAllocated = 0;
double previousRequested = 0;
for (HostStateHistoryEntry entry : host.getStateHistory()) {
if (previousTime != -1) {
double timeDiff = entry.getTime() - previousTime;
totalTime += timeDiff;
if (previousAllocated < previousRequested) {
slaViolationTimePerHost += timeDiff;
}
}
previousAllocated = entry.getAllocatedMips();
previousRequested = entry.getRequestedMips();
previousTime = entry.getTime();
}
}
return slaViolationTimePerHost / totalTime;
}