コード例 #1
0
		public void ProfilesTwiceIfEnoughTimeHasPassed()
		{
			int count = 0;
			var profiler = new SystemProfiler(1000000);
			profiler.Updated += () => count++;
			profiler.Log(ProfilingMode.Fps, systemInformation);
			profiler.Log(ProfilingMode.Fps, systemInformation);
			Assert.AreEqual(2, profiler.GetProfilingResults(ProfilingMode.Fps).Calls);
			Assert.AreEqual(2, count);
		}
コード例 #2
0
		public void OnlyProfilesOnceIfTooShortATimeHasPassed()
		{
			int count = 0;
			var profiler = new SystemProfiler();
			profiler.Updated += () => count++;
			profiler.Log(ProfilingMode.Fps, systemInformation);
			profiler.Log(ProfilingMode.Fps, systemInformation);
			Assert.AreEqual(1, profiler.GetProfilingResults(ProfilingMode.Fps).Calls);
			Assert.AreEqual(1, count);
		}
コード例 #3
0
        public void ProfilesTwiceIfEnoughTimeHasPassed()
        {
            int count    = 0;
            var profiler = new SystemProfiler(1000000);

            profiler.Updated += () => count++;
            profiler.Log(ProfilingMode.Fps, systemInformation);
            profiler.Log(ProfilingMode.Fps, systemInformation);
            Assert.AreEqual(2, profiler.GetProfilingResults(ProfilingMode.Fps).Calls);
            Assert.AreEqual(2, count);
        }
コード例 #4
0
        public void OnlyProfilesOnceIfTooShortATimeHasPassed()
        {
            int count    = 0;
            var profiler = new SystemProfiler();

            profiler.Updated += () => count++;
            profiler.Log(ProfilingMode.Fps, systemInformation);
            profiler.Log(ProfilingMode.Fps, systemInformation);
            Assert.AreEqual(1, profiler.GetProfilingResults(ProfilingMode.Fps).Calls);
            Assert.AreEqual(1, count);
        }
コード例 #5
0
		public void LogMultipleSetsOfInfo()
		{
			var profiler = new SystemProfiler();
			profiler.Log(ProfilingMode.Fps | ProfilingMode.AvailableRam, systemInformation);
			Assert.AreEqual(1, profiler.GetProfilingResults(ProfilingMode.Fps).Calls);
			Assert.AreEqual(1, profiler.GetProfilingResults(ProfilingMode.AvailableRam).Calls);
		}
コード例 #6
0
        public void LogMultipleSetsOfInfo()
        {
            var profiler = new SystemProfiler();

            profiler.Log(ProfilingMode.Fps | ProfilingMode.AvailableRam, systemInformation);
            Assert.AreEqual(1, profiler.GetProfilingResults(ProfilingMode.Fps).Calls);
            Assert.AreEqual(1, profiler.GetProfilingResults(ProfilingMode.AvailableRam).Calls);
        }
コード例 #7
0
		public void LogInfo()
		{
			var profiler = new SystemProfiler();
			profiler.Log(ProfilingMode.Fps, systemInformation);
			SystemProfilerSection results = profiler.GetProfilingResults(ProfilingMode.Fps);
			Assert.IsTrue(results.TotalValue > 0.0f);
			Assert.AreEqual(1, results.Calls);
		}
コード例 #8
0
        public void CompareProfilerToSameResult()
        {
            var profiler = new SystemProfiler();

            profiler.Log(ProfilingMode.Fps, systemInformation);
            SystemProfilerSection results = profiler.GetProfilingResults(ProfilingMode.Fps);

            Assert.AreEqual(0, results.CompareTo(results));
        }
コード例 #9
0
		public void ProfilingWhenInactiveDoesNothing()
		{
			int count = 0;
			var profiler = new SystemProfiler { IsActive = false };
			profiler.Updated += () => count++;
			profiler.Log(ProfilingMode.Fps, systemInformation);
			Assert.AreEqual(0, profiler.GetProfilingResults(ProfilingMode.Fps).Calls);
			Assert.AreEqual(0, count);
		}
コード例 #10
0
        public void LogInfo()
        {
            var profiler = new SystemProfiler();

            profiler.Log(ProfilingMode.Fps, systemInformation);
            SystemProfilerSection results = profiler.GetProfilingResults(ProfilingMode.Fps);

            Assert.IsTrue(results.TotalValue > 0.0f);
            Assert.AreEqual(1, results.Calls);
        }
コード例 #11
0
        public void ResetProfilingResult()
        {
            var profiler = new SystemProfiler();

            profiler.Log(ProfilingMode.Fps, systemInformation);
            SystemProfilerSection results = profiler.GetProfilingResults(ProfilingMode.Fps);

            results.Reset();
            Assert.AreEqual(0, results.Calls);
            Assert.AreEqual(0, results.TotalValue);
        }
コード例 #12
0
        public void ProfilingWhenInactiveDoesNothing()
        {
            int count    = 0;
            var profiler = new SystemProfiler {
                IsActive = false
            };

            profiler.Updated += () => count++;
            profiler.Log(ProfilingMode.Fps, systemInformation);
            Assert.AreEqual(0, profiler.GetProfilingResults(ProfilingMode.Fps).Calls);
            Assert.AreEqual(0, count);
        }
コード例 #13
0
        public void CompareProfilerToOtherResult()
        {
            var profiler1 = new SystemProfiler();

            profiler1.Log(ProfilingMode.Fps, systemInformation);
            SystemProfilerSection results1 = profiler1.GetProfilingResults(ProfilingMode.Fps);
            var profiler2 = new SystemProfiler();

            profiler2.Log(ProfilingMode.Engine, systemInformation);
            SystemProfilerSection results2 = profiler2.GetProfilingResults(ProfilingMode.Fps);

            Assert.AreNotEqual(0, results1.CompareTo(results2));
        }
コード例 #14
0
		public void CompareProfilerToSameResult()
		{
			var profiler = new SystemProfiler();
			profiler.Log(ProfilingMode.Fps, systemInformation);
			SystemProfilerSection results = profiler.GetProfilingResults(ProfilingMode.Fps);
			Assert.AreEqual(0, results.CompareTo(results));
		}
コード例 #15
0
		public void ResetProfilingResult()
		{
			var profiler = new SystemProfiler();
			profiler.Log(ProfilingMode.Fps, systemInformation);
			SystemProfilerSection results = profiler.GetProfilingResults(ProfilingMode.Fps);
			results.Reset();
			Assert.AreEqual(0, results.Calls);
			Assert.AreEqual(0, results.TotalValue);
		}
コード例 #16
0
		public void CompareProfilerToOtherResult()
		{
			var profiler1 = new SystemProfiler();
			profiler1.Log(ProfilingMode.Fps, systemInformation);
			SystemProfilerSection results1 = profiler1.GetProfilingResults(ProfilingMode.Fps);
			var profiler2 = new SystemProfiler();
			profiler2.Log(ProfilingMode.Engine, systemInformation);
			SystemProfilerSection results2 = profiler2.GetProfilingResults(ProfilingMode.Fps);
			Assert.AreNotEqual(0, results1.CompareTo(results2));
		}