Ejemplo n.º 1
0
 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));
     }
 }
Ejemplo n.º 2
0
            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));
            }
Ejemplo n.º 3
0
            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);
            }
Ejemplo n.º 4
0
            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;
                }
            }
Ejemplo n.º 5
0
 private bool hasCompletePass(InitActionComponent action)
 {
     return(action.HasCompletedPass);
 }
Ejemplo n.º 6
0
 private bool hasSecondPass(InitActionComponent action)
 {
     return(action.HasSecondPass);
 }
Ejemplo n.º 7
0
 private bool hasFirstPass(InitActionComponent action)
 {
     return(true);
 }
Ejemplo n.º 8
0
 private IEnumerator initCompleteCoroutineWrapper(InitActionComponent action)
 {
     action.OnInitializationComplete();
     yield break;
 }