public CodeProfilingResultsFormatter(CodeProfilingResults results)
		{
			if (results.Sections.Count == 0)
				Summary = "(Nothing profiled)";
			else
				FormSummary(results);
		}
        public void EmptyProfilingSummary()
        {
            var profilingResults          = new CodeProfilingResults(new List <CodeProfilerSection>());
            var profilingResultsFormatter = new CodeProfilingResultsFormatter(profilingResults);
            var profiler = new CodeProfiler();

            Assert.AreEqual(profilingResultsFormatter.Summary,
                            profiler.GetProfilingResultsSummary(ProfilingMode.Rendering));
        }
Esempio n. 3
0
 public CodeProfilingResultsFormatter(CodeProfilingResults results)
 {
     if (results.Sections.Count == 0)
     {
         Summary = "(Nothing profiled)";
     }
     else
     {
         FormSummary(results);
     }
 }
		private void FormSummary(CodeProfilingResults results)
		{
			results.Sections.Sort();
			string sections = results.Sections.Count == 1 ? " section" : " sections";
			Summary = "We got " + results.Sections.Count + sections + " that took in total: " +
				results.TotalSectionTime + "s (which seems to be about " +
				(100.0f * results.TotalSectionTime / results.TotalTime) +
				"% of the total application time: " + results.TotalTime + "s)";

			if (results.TotalSectionTime > 0)
				foreach (CodeProfilerSection section in results.Sections)
					Summary += "\n Section " + section.Name + " took: " + section.TotalTime + "s (" +
						(100.0f * section.TotalTime / results.TotalSectionTime) + "%), Calls: " + section.Calls +
						", first time called: " + section.TimeCreated + "s";
		}
Esempio n. 5
0
        private void FormSummary(CodeProfilingResults results)
        {
            results.Sections.Sort();
            string sections = results.Sections.Count == 1 ? " section" : " sections";

            Summary = "We got " + results.Sections.Count + sections + " that took in total: " +
                      results.TotalSectionTime + "s (which seems to be about " +
                      (100.0f * results.TotalSectionTime / results.TotalTime) +
                      "% of the total application time: " + results.TotalTime + "s)";

            if (results.TotalSectionTime > 0)
            {
                foreach (CodeProfilerSection section in results.Sections)
                {
                    Summary += "\n Section " + section.Name + " took: " + section.TotalTime + "s (" +
                               (100.0f * section.TotalTime / results.TotalSectionTime) + "%), Calls: " + section.Calls +
                               ", first time called: " + section.TimeCreated + "s";
                }
            }
        }
Esempio n. 6
0
		public void EmptyProfilingSummary()
		{
			var profilingResults = new CodeProfilingResults(new List<CodeProfilerSection>());
			var profilingResultsFormatter = new CodeProfilingResultsFormatter(profilingResults);
			var profiler = new CodeProfiler();
			Assert.AreEqual(profilingResultsFormatter.Summary,
				profiler.GetProfilingResultsSummary(ProfilingMode.Rendering));
		}