本文整理汇总了Java中org.cloudbus.cloudsim.util.MathUtil.trimZeroTail方法的典型用法代码示例。如果您正苦于以下问题:Java MathUtil.trimZeroTail方法的具体用法?Java MathUtil.trimZeroTail怎么用?Java MathUtil.trimZeroTail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.cloudbus.cloudsim.util.MathUtil
的用法示例。
在下文中一共展示了MathUtil.trimZeroTail方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUtilizationHistory
import org.cloudbus.cloudsim.util.MathUtil; //导入方法依赖的package包/类
/**
* Gets the host utilization history.
*
* @return the host utilization history
*/
protected double[] getUtilizationHistory() {
double[] utilizationHistory = new double[PowerVm.HISTORY_LENGTH];
double hostMips = getTotalMips();
for (PowerVm vm : this.<PowerVm> getVmList()) {
for (int i = 0; i < vm.getUtilizationHistory().size(); i++) {
utilizationHistory[i] += vm.getUtilizationHistory().get(i) * vm.getMips() / hostMips;
}
}
return MathUtil.trimZeroTail(utilizationHistory);
}
开发者ID:gmartinezramirez,项目名称:Fog-Computing-Mobile-Architecture,代码行数:16,代码来源:PowerHostUtilizationHistory.java
示例2: getUtilizationHistory
import org.cloudbus.cloudsim.util.MathUtil; //导入方法依赖的package包/类
/**
* Gets the host CPU utilization percentage history (between [0 and 1], where 1 is 100%).
* Each value into the returned array is the CPU utilization percentage for
* a time interval equal to the {@link Datacenter#getSchedulingInterval()}.
* @return
*/
public double[] getUtilizationHistory() {
final double[] utilizationHistory = new double[PowerVm.MAX_HISTORY_ENTRIES];
final double totalMipsCapacity = getTotalMipsCapacity();
for (final PowerVm vm : this.<PowerVm>getVmCreatedList()) {
for (int i = 0; i < vm.getUtilizationHistory().size(); i++) {
utilizationHistory[i] += vm.getUtilizationHistory().get(i) * vm.getTotalMipsCapacity() / totalMipsCapacity;
}
}
return MathUtil.trimZeroTail(utilizationHistory);
}