mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-28 22:47:20 +02:00
Debugging
- Added timers to measure performance.
This commit is contained in:
parent
e59e35ae29
commit
50f000988b
4 changed files with 38 additions and 11 deletions
|
@ -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 ());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue