Debugging

- Added timers to measure performance.
This commit is contained in:
Paul Beckingham 2009-06-23 01:23:46 -04:00
parent e59e35ae29
commit 50f000988b
4 changed files with 38 additions and 11 deletions

View file

@ -26,7 +26,11 @@
////////////////////////////////////////////////////////////////////////////////
#include <iostream>
#include <iomanip>
#include <Timer.h>
#include <sstream>
#include "Timer.h"
#include "Context.h"
extern Context context;
////////////////////////////////////////////////////////////////////////////////
// Timer starts when the object is constructed.
@ -43,13 +47,15 @@ Timer::~Timer ()
struct timeval end;
::gettimeofday (&end, NULL);
std::cout << "Timer " // No i18n
<< mDescription
<< " "
<< std::setprecision (6)
<< ((end.tv_sec - mStart.tv_sec) +
((end.tv_usec - mStart.tv_usec ) / 1000000.0))
<< std::endl;
std::stringstream s;
s << "Timer " // No i18n
<< mDescription
<< " "
<< std::setprecision (6)
<< ((end.tv_sec - mStart.tv_sec) + ((end.tv_usec - mStart.tv_usec )
/ 1000000.0));
context.debug (s.str ());
}
////////////////////////////////////////////////////////////////////////////////