Beispiel #1
0
 /// <summary>
 /// Ends the current active profiling block.
 /// </summary>
 public static void EndBlock()
 {
     if (rootBlock != currentBlock)
     {
         currentBlock.End();
         currentBlock = currentBlock.Parent;
     }
 }
Beispiel #2
0
        private Stopwatch _timer; // Internal timer for getting real time information

        #endregion Fields

        #region Constructors

        internal ProfileBlock(ProfileBlock p, string name)
        {
            _timer = new Stopwatch();
            Parent = p;
            Children = new List<ProfileBlock>();
            Time = MaxTime = LastTime = LastMaxTime = TotalTime = TotalMaxTime = TimeSpan.Zero;
            Count = LastCount = TotalCount = 0;

            int num = count++;
            if (String.IsNullOrEmpty(name))
                Name = "ProfileBlock" + num;
            else
                Name = name;
        }
Beispiel #3
0
        // Gets a child block with the given name, or creates a new child if none exists.
        public ProfileBlock GetChild(string name)
        {
            foreach (ProfileBlock p in Children)
                if (p.Name == name)
                    return p;

            ProfileBlock np = new ProfileBlock(this, name);
            Children.Add(np);
            return np;
        }
Beispiel #4
0
 static Debug()
 {
     currentBlock = rootBlock = new Debugging.ProfileBlock(null, "Root");
     TotalFrames = 0;
     UseProfilerFileDump = true;
 }
Beispiel #5
0
 internal static void EndFrame()
 {
     if (currentBlock != rootBlock)
     {
         EndBlock();
         ++TotalFrames;
         if (TotalFrames == 0)
             ++TotalFrames;
         rootBlock.EndFrame();
         currentBlock = rootBlock;
     }
 }
Beispiel #6
0
 /// <summary>
 /// Begins timing the block with the given name.
 /// </summary>
 /// <param name="name">The name of the block to start timing.</param>
 public static void BeginBlock(string name)
 {
     currentBlock = currentBlock.GetChild(name);
     currentBlock.Begin();
 }