#define NOMINMAX #include "Prof.h" #include "../vfs_types.h" #include "../File/vfs_file.h" #include class CProfileStarter { public: CProfileStarter() { CProf::getProf(); } }; static CProfileStarter starter; CProf& CProf::getProf() { static CProf* _prof = new CProf; return *_prof; } CProf::CProf() { m_vMarker.resize(1024); _nextMarker = 0; } void CProf::clear() { for(unsigned int i = 0; i < _nextMarker; ++i) { m_vMarker[i].markername = ""; m_vMarker[i].time = 0; m_vMarker[i].call_count = 0; m_vMarker[i].success_count = 0; m_vMarker[i].fail_count = 0; } _nextMarker = 0; } CProf::tMarkerID CProf::registerMarker(const char *marker) { m_vMarker[_nextMarker].markername = marker; return _nextMarker++; } void CProf::startMarker(tMarkerID id) { m_vMarker[id].timer.startTimer(); } void CProf::stopMarker(tMarkerID id, bool success) { m_vMarker[id].timer.stopTimer(); m_vMarker[id].time += m_vMarker[id].timer.getElapsedTimeInSeconds(); m_vMarker[id].call_count++; if(success) m_vMarker[id].success_count++; else m_vMarker[id].fail_count++; } inline std::string multChar(std::string::value_type c, unsigned int multiplicity) { std::string s; s.resize(multiplicity); for(unsigned int i=0; i max_time) { max_time = m_vMarker[i].time; } std::string::size_type prefix_length = m_vMarker[i].markername.length(); if(prefix_length > max_prefix) { max_prefix = prefix_length; } } const unsigned int WIDTH = 40; std::stringstream line; long double ld_success, ld_failure; for(unsigned int i=0; i