static Profiler() { m_Context = new List <ContextAndTick>(); m_ThisFrameData = new List <Tuple <string[], double> >(); m_AllFrameData = new List <ProfileData>(); m_TotalTimeData = new ProfileData(null, 0d); m_Timer = new HighPerformanceTimer(); m_Timer.Start(); }
public static void ExitContext(string context_name) { if (m_Context[m_Context.Count - 1].Name != context_name) { Tracer.Error("Profiler.ExitProfiledContext: context_name does not match current context."); } string[] context = new string[m_Context.Count]; for (int i = 0; i < m_Context.Count; i++) { context[i] = m_Context[i].Name; } double ms = HighPerformanceTimer.SecondsFromTicks(m_Timer.ElapsedTicks - m_Context[m_Context.Count - 1].Tick) * 1000d; m_ThisFrameData.Add(new Tuple <string[], double>(context, ms)); m_Context.RemoveAt(m_Context.Count - 1); }
public static void EndFrame() { LastFrameTimeMS = HighPerformanceTimer.SecondsFromTicks(m_Timer.ElapsedTicks - m_BeginFrameTicks) * 1000d; m_TotalTimeData.AddNewHitLength(LastFrameTimeMS); }