utfcpp/test_drivers/performance/timer.h
ntrifunovic 988eb58264 Added performance testing
git-svn-id: http://svn.code.sf.net/p/utfcpp/code@39 a809a056-fc17-0410-9590-b4f493f8b08e
2006-08-11 21:42:05 +00:00

17 lines
430 B
C++

#include <ctime>
#include <iostream>
struct timer {
timer(std::ostream& report) : report(report)
{start = std::clock();}
~timer()
{
using namespace std;
end = clock();
unsigned milliseconds = (end - start)*1000 / CLOCKS_PER_SEC;
report << "Spent " << milliseconds << "ms here\n";
}
std::clock_t start;
std::clock_t end;
std::ostream& report;
};