Exemplo n.º 1
0
 public static void BeginFrame()
 {
     if (DwarfGame.IsConsoleVisible)
     {
         CurrentFrame = null;
         Functions.Clear();
         __pushFrame("Root");
     }
 }
Exemplo n.º 2
0
        public static void PopFrame()
        {
            if (DwarfGame.IsConsoleVisible && CurrentFrame != null)
            {
                CurrentFrame.Stopwatch.Stop();

                CurrentFrame.Ticks = CurrentFrame.Stopwatch.ElapsedTicks;
                CurrentFrame.Function.FrameTicks += CurrentFrame.Ticks;
                CurrentFrame = CurrentFrame.ParentFrame;
            }
        }
Exemplo n.º 3
0
        private static void __pushFrame(String Name)
        {
            PerformanceFunction Function;

            if (!Functions.TryGetValue(Name, out Function))
            {
                Function = new PerformanceFunction
                {
                    Name = Name
                };

                Functions.Add(Name, Function);
            }

            Function.FrameCalls += 1;

            CurrentFrame = new PerformanceFrame
            {
                ParentFrame = CurrentFrame,
                Stopwatch   = Stopwatch.StartNew(),
                Function    = Function
            };
        }