本文整理汇总了Java中vnreal.algorithms.utils.SubgraphBasicVN.Utils.getCpuAvailable方法的典型用法代码示例。如果您正苦于以下问题:Java Utils.getCpuAvailable方法的具体用法?Java Utils.getCpuAvailable怎么用?Java Utils.getCpuAvailable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vnreal.algorithms.utils.SubgraphBasicVN.Utils
的用法示例。
在下文中一共展示了Utils.getCpuAvailable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sortSubNodesAccordingToCapacity
import vnreal.algorithms.utils.SubgraphBasicVN.Utils; //导入方法依赖的package包/类
private Vector<SubstrateNode> sortSubNodesAccordingToCapacity(
Vector<SubstrateNode> subNodeVector) {
for (int i = 0; i < subNodeVector.size(); i++) {
for (int j = 0; j < subNodeVector.size(); j++) {
if (Utils.getCpuAvailable(subNodeVector.get(i)) > Utils
.getCpuAvailable(subNodeVector.get(j))) {
SubstrateNode tempNode = subNodeVector.get(i);
subNodeVector.set(i, subNodeVector.get(j));
subNodeVector.set(j, tempNode);
}
}
}
return subNodeVector;
}
示例2: refreshInformation
import vnreal.algorithms.utils.SubgraphBasicVN.Utils; //导入方法依赖的package包/类
private boolean refreshInformation(VirtualNode hub,
Vector<VirtualNode> spokes, Vector<DistanceEntry> pathList,
Vector<SubstrateNode> subSpokes, Request request) {
spokes = sortVirtualNodesAccordingToCapacity(spokes);
// FIXME: changing the maximalBandwidth/CPUDemand to a more precise
//value for each link/node could result in a better acceptRatio
double maximalBandwidthDemand = Utils
.getBandwidthDemand(findDirectPathInVirt(hub, spokes.get(0),
request.getVirtualNetwork(), true));
double maximalCPUDemand = Utils.getCpuDemand(spokes.get(0)).getDemandedCycles();
// find the maximal needed bandwidth and cpu
for (VirtualNode spoke : spokes) {
if (maximalBandwidthDemand < Utils
.getBandwidthDemand(findDirectPathInVirt(hub, spoke,
request.getVirtualNetwork(), true))) {
maximalBandwidthDemand = Utils
.getBandwidthDemand(findDirectPathInVirt(hub, spoke,
request.getVirtualNetwork(), true));
}
if (maximalCPUDemand < Utils.getCpuDemand(spoke).getDemandedCycles()) {
maximalCPUDemand = Utils.getCpuDemand(spoke).getDemandedCycles();
}
}
DistributedAlgorithm.bellmanFordAlgorithmus(maximalBandwidthDemand);
for (SubstrateNode subNode : request
.getSubNodesWithoutEmbeddedVirtNodes()) {
if (Utils.getCpuAvailable(subNode) >= maximalCPUDemand
&& shortestKnownPath.get(subNode.getId()) != null) {
pathList.add(shortestKnownPath.get(subNode.getId()));
}
}
// FIXME: a more intelligent selection of the hub could result
//in a better acceptRatio
if (pathList.size() < spokes.size()) {
if (debug) {
System.out
.println("Hub-Knoten findet nicht genug Spokes-Knoten, "
+ "die die Bandbreiten/CPU-Demands erfuellen! ("
+ spokes.size()
+ " Knoten mit Bandbreitenanbindung "
+ maximalBandwidthDemand
+ " und CPU "
+ maximalCPUDemand + ")");
}
return false;
}
sortPathes(pathList);
// get as many substrate nodes as we need for the virtual spoke nodes
for (int x = 0; x < spokes.size(); x++) {
if (pathList.get(x).getN2().getId() != this.getId()) {
subSpokes.add(pathList.get(x).getN2());
} else {
subSpokes.add(pathList.get(x).getN1());
}
}
sortSubNodesAccordingToCapacity(subSpokes);
return true;
}