Exemplo n.º 1
0
		private void AddAndStartNewSection(int category, string sectionName)
		{
			SectionMaps[category].Add(sectionName, Sections[category].Count);
			var section = new CodeProfilerSection(sectionName);
			Sections[category].Add(section);
			section.Start(pollingInterval);
		}
Exemplo n.º 2
0
        public void StoppingUpdatesSectionTotalTime()
        {
            var profiler = new CodeProfiler();

            profiler.Start(ProfilingMode.Rendering, Section);
            Thread.Sleep(1);
            profiler.Stop(ProfilingMode.Rendering, Section);
            CodeProfilerSection section = profiler.Sections[2][0];

            Assert.AreEqual(1, section.Calls);
            Assert.IsTrue(section.TotalTime > 0.0f);
        }
Exemplo n.º 3
0
        public void StartingCreatesASection()
        {
            var profiler = new CodeProfiler();

            profiler.Start(ProfilingMode.Rendering, Section);
            const int           SectionNumber = 2;
            CodeProfilerSection section       = profiler.Sections[SectionNumber][0];

            Assert.AreEqual(Section, section.Name);
            Assert.AreEqual(0, section.Calls);
            Assert.AreEqual(0.0f, section.TotalTime);
            Assert.AreEqual(1, profiler.SectionMaps[SectionNumber].Count);
            Assert.AreEqual(1, profiler.Sections[SectionNumber].Count);
        }