|
|
|
@ -71,7 +71,7 @@ namespace CriticalPathAnalyzer.Server.Tool {
|
|
|
|
|
int index = clusterNodes.Count;
|
|
|
|
|
var node = new ClusterNode() {
|
|
|
|
|
Index = index,
|
|
|
|
|
Clusters = new HashSet<Cluster>() {startingCluster},
|
|
|
|
|
Clusters = GetClustersConnectedThroughRelays(startingCluster),
|
|
|
|
|
Time = 0,
|
|
|
|
|
PrevNodeIndexes = new HashSet<int>(),
|
|
|
|
|
NextNodes = new Dictionary<int, int>(),
|
|
|
|
@ -127,7 +127,12 @@ namespace CriticalPathAnalyzer.Server.Tool {
|
|
|
|
|
private static void PropagateTimeDelay(List<ClusterNode> clusterNodes, List<int> startingNodeIndexes) {
|
|
|
|
|
var queue = new Queue<int>(startingNodeIndexes);
|
|
|
|
|
|
|
|
|
|
int iterations = 0;
|
|
|
|
|
while (queue.TryDequeue(out int index)) {
|
|
|
|
|
iterations++;
|
|
|
|
|
if (iterations % 1000 == 0) {
|
|
|
|
|
CriticalPathAnalyzerServer.LoggerInstance.Info($"{iterations} propagation iterations");
|
|
|
|
|
}
|
|
|
|
|
ClusterNode node = clusterNodes[index];
|
|
|
|
|
foreach ((int nextNodeIndex, int delay) in node.NextNodes) {
|
|
|
|
|
clusterNodes[nextNodeIndex].Time = node.Time + delay;
|
|
|
|
@ -158,7 +163,12 @@ namespace CriticalPathAnalyzer.Server.Tool {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int iterations = 0;
|
|
|
|
|
while (queue.TryDequeue(out ClusterNode node)) {
|
|
|
|
|
iterations++;
|
|
|
|
|
if (iterations % 1000 == 0) {
|
|
|
|
|
CriticalPathAnalyzerServer.LoggerInstance.Info($"{iterations} loop iterations");
|
|
|
|
|
}
|
|
|
|
|
foreach ((int nextNodeIndex, int _) in node.NextNodes) {
|
|
|
|
|
ClusterNode nextNode = clusterNodes[nextNodeIndex];
|
|
|
|
|
nextNode.PrevNodeIndexes.Remove(node.Index);
|
|
|
|
@ -253,6 +263,7 @@ namespace CriticalPathAnalyzer.Server.Tool {
|
|
|
|
|
// Collect all next clusters connected via a relay (from the control input side)
|
|
|
|
|
if (inputPeg.Address == component.Inputs[1].Address) {
|
|
|
|
|
// one of the sides
|
|
|
|
|
// TODO: need to recursively check for further relays
|
|
|
|
|
CollectPegClusters(component.Inputs[2].Address, clusters);
|
|
|
|
|
} else if (inputPeg.Address == component.Inputs[2].Address) {
|
|
|
|
|
// the other side
|
|
|
|
|