Ejemplo n.º 1
0
void TimerTest::Execute() {

	Assert("Initial Time should be zero", Timer().CurrentTime() == 0);
	THROWCHECK("Stopping a timer that hasn't been started", Timer().Stop());
	THROWCHECK("Starting a timer that has already been started", Timer().Start().Start());
	
	Timer timer = Timer().Start();
	Wait(.1);
	Assert("Timer should now be greater than ,1", timer.CurrentTime() >= .1);
	timer.Stop();
	Assert("Timer should still be greater than ,1", timer.CurrentTime() >= .1);
	timer.Start();
	Wait(.1);
	Assert("Timer should now be greater than ,1", timer.CurrentTime() >= .2);
	timer.Stop();
	Assert("Timer should still be greater than ,1", timer.CurrentTime() >= .2);

	{
		TIMETHISBLOCK("1");
		{
			TIMETHISBLOCK("2");
		}
		{
			TIMETHISBLOCK("3");
		}
	}
	// TODO check output of this
	TimingPool::TimingSummary();
}
Ejemplo n.º 2
0
std::string TimingPool::TimingSummary() {
	const Timer internalTimer = Timer().Start();
	const int timingIterations = 1000000;
	for (int i = 0 ; i < timingIterations ; i++)
	{
		TIMETHISBLOCK("InternalTiming");
	}
	const double averageTimerTime = internalTimer.CurrentTime()/timingIterations;
	return ::TimingSummary("", static_cast<TimerTree*>(m_timerStack.Pointer()), m_names, averageTimerTime).first;
}