public void StartBlock(string name, string memberName, int line, string file, int forceOrder = int.MaxValue) { Debug.Assert(!EnableAsserts || OwnerThread == Thread.CurrentThread); if (m_levelLimit != -1 && m_currentProfilingStack.Count >= m_levelLimit) { m_levelSkipCount++; return; } MyProfilerBlock profilingBlock = null; MyProfilerBlockKey key = new MyProfilerBlockKey(file, memberName, name, line, GetParentId()); if (!m_profilingBlocks.TryGetValue(key, out profilingBlock) && !m_blocksToAdd.TryGetValue(key, out profilingBlock)) { if (blockPool.Count == 0) { for (int i = 0; i < PROFILER_BLOCK_INCREMENT_STEP; i++) blockPool.Add(new MyProfilerBlock()); } profilingBlock = blockPool[0]; blockPool.RemoveAt(0); profilingBlock.SetBlockData(ref key, m_nextId++, forceOrder); if (m_currentProfilingStack.Count > 0) { profilingBlock.Parent = m_currentProfilingStack.Peek(); Debug.Assert(!profilingBlock.Parent.Children.Contains(profilingBlock), "Why is already between children?"); } m_blocksToAdd.Add(key, profilingBlock); } profilingBlock.Start(MemoryProfiling); m_currentProfilingStack.Push(profilingBlock); }
public static MyProfilerBlock CreateExternalBlock(string name, int blockId) { MyProfilerBlockKey key = new MyProfilerBlockKey(String.Empty, String.Empty, name, 0, ROOT_ID); return new MyProfilerBlock(ref key, String.Empty, blockId); }
public void SetBlockData(ref MyProfilerBlockKey key, int blockId, int forceOrder = int.MaxValue) { Id = blockId; Key = key; ForceOrder = forceOrder; }
public MyProfilerBlock(ref MyProfilerBlockKey key, string memberName, int blockId, int forceOrder = int.MaxValue) { Id = blockId; Key = key; ForceOrder = forceOrder; }
public void StartBlock(string name, string memberName, int line, string file) { Debug.Assert(!EnableAsserts || OwnerThread == Thread.CurrentThread); if (m_levelLimit != -1 && m_currentProfilingStack.Count >= m_levelLimit) { m_levelSkipCount++; return; } MyProfilerBlock profilingBlock = null; MyProfilerBlockKey key = new MyProfilerBlockKey(file, memberName, name, line, GetParentId()); if (!m_profilingBlocks.TryGetValue(key, out profilingBlock) && !m_blocksToAdd.TryGetValue(key, out profilingBlock)) { profilingBlock = new MyProfilerBlock(ref key, memberName, m_nextId++); if (m_currentProfilingStack.Count > 0) { profilingBlock.Parent = m_currentProfilingStack.Peek(); Debug.Assert(!profilingBlock.Parent.Children.Contains(profilingBlock), "Why is already between children?"); } m_blocksToAdd.Add(key, profilingBlock); } profilingBlock.Start(MemoryProfiling); m_currentProfilingStack.Push(profilingBlock); }
public MyProfilerBlock(ref MyProfilerBlockKey key, string memberName, int blockId) { Id = blockId; Key = key; }