Beispiel #1
0
        public void FromSeconds_ShouldReturnTimeSpanThatRepresentsSpecifiedNumberOfSeconds_WithSingleTickPrecision(double seconds)
        {
            // Arrange
            // Act
            var actual = HighResolutionTimeSpan.FromSeconds(seconds);

            // Assert
            Assert.That(actual.TotalSeconds, Is.EqualTo(seconds).Within(0.0000001));
        }
        public IEnumerable <SystemExecutionTime> GetSystemsExecutionTime()
        {
            if (!_performanceStatisticsStorage.Frames.Any())
            {
                return(Enumerable.Empty <SystemExecutionTime>());
            }

            var avgFrameTimeInSeconds = _performanceStatisticsStorage.Frames.Average(f => f.Time.TotalSeconds);

            return(_performanceStatisticsStorage.SystemsFrames
                   .Select(systemFrames =>
            {
                var systemAvgFrameTimeInSeconds = systemFrames.Value.Average(f => f.Time.TotalSeconds);
                var systemAvgFrameTime = HighResolutionTimeSpan.FromSeconds(systemAvgFrameTimeInSeconds);

                return new SystemExecutionTime(
                    systemFrames.Key,
                    systemAvgFrameTime,
                    systemAvgFrameTimeInSeconds / avgFrameTimeInSeconds);
            }));
        }