Exemple #1
0
        /// <summary>
        /// Return a child node for the given name.
        /// The children dictionary will be created if it does not already exist, and
        /// a new Node will be created if it's not already in the dictionary.
        /// Note that these allocations only happen once for a given timed block.
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public TimerNode GetChild(string name)
        {
            // Lazily create the children dictionary.
            if (m_Children == null)
            {
                m_Children = new Dictionary <string, TimerNode>();
            }

            if (!m_Children.ContainsKey(name))
            {
                var childFullName = m_FullName + s_Separator + name;
                var newChild      = new TimerNode(childFullName);
                m_Children[name] = newChild;
                return(newChild);
            }

            return(m_Children[name]);
        }
Exemple #2
0
 public void Reset(string name = "root")
 {
     m_Stack    = new Stack <TimerNode>();
     m_RootNode = new TimerNode(name, true);
     m_Stack.Push(m_RootNode);
 }