コード例 #1
0
ファイル: MyLog.cs プロジェクト: sebeksd/SpaceEngineers
        public void DecreaseIndent()
        {
            if (m_enabled == false)
            {
                return;
            }

            MyLogIndentValue indentValue;

            lock (m_lock)
            {
                int            threadId  = GetThreadId();
                MyLogIndentKey indentKey = new MyLogIndentKey(threadId, GetIdentByThread(threadId));

                //  If this fails, then order of IncreaseIndent/DecreaseIndent was wrong, or duplicate, etc
                MyDebug.AssertDebug(m_indents.ContainsKey(indentKey));

                indentValue = m_indents[indentKey];

                if (LogForMemoryProfiler)
                {
                    MyMemoryLogs.MyMemoryEvent memEvent = new MyMemoryLogs.MyMemoryEvent();
                    memEvent.DeltaTime        = (float)(DateTimeOffset.Now - indentValue.LastDateTimeOffset).TotalMilliseconds / 1000.0f;
                    memEvent.ManagedEndSize   = GetManagedMemory();
                    memEvent.ProcessEndSize   = GetSystemMemory();
                    memEvent.ManagedStartSize = indentValue.LastGcTotalMemory;
                    memEvent.ProcessStartSize = indentValue.LastWorkingSet;
                    MyMemoryLogs.EndEvent(memEvent);
                }
            }

            lock (m_lock)
            {
                int threadId = GetThreadId();
                m_indentsByThread[threadId] = GetIdentByThread(threadId) - 1;
            }
        }