Mercurial > hg > svcore
diff base/Profiler.cpp @ 408:115f60df1e4d
* Speed up spectrogram painting by releasing mutex in FFTDataServer
while calculating data prior to writing it, and by adding whole-column
value query methods to FFT objects
* Add paint cache to Thumbwheel -- repaints of this widget were slowing
down the whole spectrogram repaint
* More uses of MutexLocker (named and with debug) and more profile
points
* Make startup much quicker some of the time, with OSC server in place
author | Chris Cannam |
---|---|
date | Thu, 08 May 2008 14:46:22 +0000 |
parents | dc46851837d6 |
children | 29efe322ab47 |
line wrap: on
line diff
--- a/base/Profiler.cpp Tue Apr 29 15:34:17 2008 +0000 +++ b/base/Profiler.cpp Thu May 08 14:46:22 2008 +0000 @@ -161,7 +161,7 @@ for (TimeRMap::const_iterator i = worstmap.end(); i != worstmap.begin(); ) { --i; fprintf(stderr, "%-40s %s ms\n", i->second, - (i->first * 1000).toString().c_str(), i->second); + (i->first * 1000).toString().c_str()); } fprintf(stderr, "\nBy number of calls:\n"); @@ -175,9 +175,10 @@ #ifndef NO_TIMING -Profiler::Profiler(const char* c, bool showOnDestruct) - : m_c(c), - m_showOnDestruct(showOnDestruct) +Profiler::Profiler(const char* c, bool showOnDestruct) : + m_c(c), + m_showOnDestruct(showOnDestruct), + m_ended(false) { m_startCPU = clock(); @@ -202,6 +203,12 @@ Profiler::~Profiler() { + if (!m_ended) end(); +} + +void +Profiler::end() +{ clock_t elapsedCPU = clock() - m_startCPU; struct timeval tv; @@ -214,6 +221,8 @@ cerr << "Profiler : id = " << m_c << " - elapsed = " << ((elapsedCPU * 1000) / CLOCKS_PER_SEC) << "ms CPU, " << elapsedTime << " real" << endl; + + m_ended = true; } #endif