private void trackLongestPath(InitActionComponent action, List <InitActionComponent> dependants, long ticks) { foreach (InitActionComponent dependant in dependants) { longestPaths[dependant.TopologicalIdentifier] = new KeyValuePair <string, TimeSpan>(action.TopologicalIdentifier, new TimeSpan(ticks)); } }
private void logActionDuration(InitActionComponent action, long ticks) { Type type = action.GetType(); if (!actionDurations.TryGetValue(type, out var value)) { value = new ActionDuration(); actionDurations[type] = value; } value.SetPassDuration(passName, new TimeSpan(ticks)); }
private void printLongestPath(InitActionComponent action, TimeSpan actionsTime) { TimeSpan timeSpan = new TimeSpan(actionsTime.Ticks); Stack <KeyValuePair <string, TimeSpan> > stack = new Stack <KeyValuePair <string, TimeSpan> >(); string key = action.TopologicalIdentifier; KeyValuePair <string, TimeSpan> value; while (longestPaths.TryGetValue(key, out value)) { stack.Push(value); key = value.Key; timeSpan = timeSpan.Add(value.Value); } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendFormat("Longest Path for {0}: {1:0.####} seconds\n", passName, timeSpan.TotalSeconds); while (stack.Count > 0) { value = stack.Pop(); stringBuilder.AppendFormat("\t{0} {1:0.####}\n", value.Key, value.Value.TotalSeconds); } stringBuilder.AppendFormat("\t{0} {1:0.####}\n", action.TopologicalIdentifier, actionsTime.TotalSeconds); }
private IEnumerator runActionAsyc(InitActionComponent action) { Stopwatch timer = new Stopwatch(); timer.Start(); if (conditionalRun(action)) { yield return(functor(action)); } activeActions--; timer.Stop(); logActionDuration(action, timer.ElapsedTicks); if (dependencies.ContainsKey(action.TopologicalIdentifier)) { List <InitActionComponent> actions = dependencies[action.TopologicalIdentifier]; dependencies.Remove(action.TopologicalIdentifier); runActions(actions); } else if (activeActions < 1) { complete = true; } }
private bool hasCompletePass(InitActionComponent action) { return(action.HasCompletedPass); }
private bool hasSecondPass(InitActionComponent action) { return(action.HasSecondPass); }
private bool hasFirstPass(InitActionComponent action) { return(true); }
private IEnumerator initCompleteCoroutineWrapper(InitActionComponent action) { action.OnInitializationComplete(); yield break; }