public override bool Equals(Object other) { if (other == null) { return(handle == default(ulong)); } RenderingSession oe = other as RenderingSession; if (oe == null) { return(base.Equals(other)); } return(handle == oe.handle); }
private void UpdateStats(RenderingSession session) { if (!session.IsConnected) { return; } if (session.GraphicsBinding.GetLastFrameStatistics(out FrameStatistics frameStatistics) != Result.Success) { return; } if (m_runningPerformanceAssesment == null) { m_runningPerformanceAssesment = session.Connection.QueryServerPerformanceAssessmentAsync(); } else if (m_runningPerformanceAssesment.IsCompleted) { m_lastPerformanceAssessment = m_runningPerformanceAssesment.Result; m_runningPerformanceAssesment = null; } // If 1 second has passed, clear the last stats list. var now = DateTime.Now.TimeOfDay.TotalSeconds; if (now > _currWindowStartTime + 1) { System.Diagnostics.Debug.Assert(!ReferenceEquals(_lastWindowFrameStats, _currWindowFrameStats)); Swap(ref _lastWindowFrameStats, ref _currWindowFrameStats); _currWindowFrameStats.Clear(); // Next list clearing should happen at least 1 second from now do { _currWindowStartTime += 1; } while (now > _currWindowStartTime + 1); } _currWindowFrameStats.Add(frameStatistics); _videoFramesDiscardedTotal += frameStatistics.VideoFramesDiscarded; }
/// <summary> /// Call every frame to collect statistics for given frame from the graphics binding. /// </summary> public void Update(RenderingSession session) { UpdateStats(session); }