本文整理匯總了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;
}