# HG changeset patch # User Chris Cannam # Date 1374073157 -3600 # Node ID 97c53dfaf798e1e791bb54031228c04e4aa6ad63 # Parent 54829c1e155e878bd37e931275208685c4634091 Debug stuff diff -r 54829c1e155e -r 97c53dfaf798 data/fft/FFTDataServer.cpp --- a/data/fft/FFTDataServer.cpp Fri Jul 12 13:10:28 2013 +0100 +++ b/data/fft/FFTDataServer.cpp Wed Jul 17 15:59:17 2013 +0100 @@ -191,7 +191,7 @@ if (server->getFillCompletion() < 50) distance += 100; #ifdef DEBUG_FFT_SERVER - SVDEBUG << "FFTDataServer::getFuzzyInstance: Distance for server " << server << " is " << distance << ", best is " << bestdist << endl; + std::cerr << "FFTDataServer::getFuzzyInstance: Distance for server " << server << " is " << distance << ", best is " << bestdist << std::endl; #endif if (bestdist == -1 || distance < bestdist) { @@ -204,7 +204,7 @@ if (bestdist >= 0) { FFTDataServer *server = best->second.first; #ifdef DEBUG_FFT_SERVER - SVDEBUG << "FFTDataServer::getFuzzyInstance: We like server " << server << " (with distance " << bestdist << ")" << endl; + std::cerr << "FFTDataServer::getFuzzyInstance: We like server " << server << " (with distance " << bestdist << ")" << std::endl; #endif claimInstance(server, false); return server; @@ -228,7 +228,7 @@ FFTDataServer::findServer(QString n) { #ifdef DEBUG_FFT_SERVER - SVDEBUG << "FFTDataServer::findServer(\"" << n << "\")" << endl; + std::cerr << "FFTDataServer::findServer(\"" << n << "\")" << std::endl; #endif if (m_servers.find(n) != m_servers.end()) { @@ -236,7 +236,7 @@ FFTDataServer *server = m_servers[n].first; #ifdef DEBUG_FFT_SERVER - SVDEBUG << "FFTDataServer::findServer(\"" << n << "\"): found " << server << endl; + std::cerr << "FFTDataServer::findServer(\"" << n << "\"): found " << server << std::endl; #endif claimInstance(server, false); @@ -245,7 +245,7 @@ } #ifdef DEBUG_FFT_SERVER - SVDEBUG << "FFTDataServer::findServer(\"" << n << "\"): not found" << endl; + std::cerr << "FFTDataServer::findServer(\"" << n << "\"): not found" << std::endl; #endif return 0; @@ -264,7 +264,7 @@ "FFTDataServer::claimInstance::m_serverMapMutex"); #ifdef DEBUG_FFT_SERVER - SVDEBUG << "FFTDataServer::claimInstance(" << server << ")" << endl; + std::cerr << "FFTDataServer::claimInstance(" << server << ")" << std::endl; #endif for (ServerMap::iterator i = m_servers.begin(); i != m_servers.end(); ++i) { @@ -275,7 +275,7 @@ if (*j == server) { #ifdef DEBUG_FFT_SERVER - SVDEBUG << "FFTDataServer::claimInstance: found in released server list, removing from it" << endl; + std::cerr << "FFTDataServer::claimInstance: found in released server list, removing from it" << std::endl; #endif m_releasedServers.erase(j); break; @@ -285,7 +285,7 @@ ++i->second.second; #ifdef DEBUG_FFT_SERVER - SVDEBUG << "FFTDataServer::claimInstance: new refcount is " << i->second.second << endl; + std::cerr << "FFTDataServer::claimInstance: new refcount is " << i->second.second << std::endl; #endif return; @@ -309,7 +309,7 @@ "FFTDataServer::releaseInstance::m_serverMapMutex"); #ifdef DEBUG_FFT_SERVER - SVDEBUG << "FFTDataServer::releaseInstance(" << server << ")" << endl; + std::cerr << "FFTDataServer::releaseInstance(" << server << ")" << std::endl; #endif // -- if ref count > 0, decrement and return @@ -332,18 +332,18 @@ /*!!! if (server->m_lastUsedCache == -1) { // never used #ifdef DEBUG_FFT_SERVER - SVDEBUG << "FFTDataServer::releaseInstance: instance " + std::cerr << "FFTDataServer::releaseInstance: instance " << server << " has never been used, erasing" - << endl; + << std::endl; #endif delete server; m_servers.erase(i); } else { */ #ifdef DEBUG_FFT_SERVER - SVDEBUG << "FFTDataServer::releaseInstance: instance " + std::cerr << "FFTDataServer::releaseInstance: instance " << server << " no longer in use, marking for possible collection" - << endl; + << std::endl; #endif bool found = false; for (ServerQueue::iterator j = m_releasedServers.begin(); @@ -361,9 +361,9 @@ //!!! } } else { #ifdef DEBUG_FFT_SERVER - SVDEBUG << "FFTDataServer::releaseInstance: instance " + std::cerr << "FFTDataServer::releaseInstance: instance " << server << " now has refcount " << i->second.second - << endl; + << std::endl; #endif } return; @@ -378,8 +378,8 @@ FFTDataServer::purgeLimbo(int maxSize) { #ifdef DEBUG_FFT_SERVER - SVDEBUG << "FFTDataServer::purgeLimbo(" << maxSize << "): " - << m_releasedServers.size() << " candidates" << endl; + std::cerr << "FFTDataServer::purgeLimbo(" << maxSize << "): " + << m_releasedServers.size() << " candidates" << std::endl; #endif while (int(m_releasedServers.size()) > maxSize) { @@ -389,8 +389,8 @@ bool found = false; #ifdef DEBUG_FFT_SERVER - SVDEBUG << "FFTDataServer::purgeLimbo: considering candidate " - << server << endl; + std::cerr << "FFTDataServer::purgeLimbo: considering candidate " + << server << std::endl; #endif for (ServerMap::iterator i = m_servers.begin(); i != m_servers.end(); ++i) { @@ -405,8 +405,8 @@ break; } #ifdef DEBUG_FFT_SERVER - SVDEBUG << "FFTDataServer::purgeLimbo: looks OK, erasing it" - << endl; + std::cerr << "FFTDataServer::purgeLimbo: looks OK, erasing it" + << std::endl; #endif m_servers.erase(i); @@ -426,8 +426,8 @@ } #ifdef DEBUG_FFT_SERVER - SVDEBUG << "FFTDataServer::purgeLimbo(" << maxSize << "): " - << m_releasedServers.size() << " remain" << endl; + std::cerr << "FFTDataServer::purgeLimbo(" << maxSize << "): " + << m_releasedServers.size() << " remain" << std::endl; #endif } @@ -439,8 +439,8 @@ "FFTDataServer::modelAboutToBeDeleted::m_serverMapMutex"); #ifdef DEBUG_FFT_SERVER - SVDEBUG << "FFTDataServer::modelAboutToBeDeleted(" << model << ")" - << endl; + std::cerr << "FFTDataServer::modelAboutToBeDeleted(" << model << ")" + << std::endl; #endif for (ServerMap::iterator i = m_servers.begin(); i != m_servers.end(); ++i) { @@ -450,8 +450,8 @@ if (server->getModel() == model) { #ifdef DEBUG_FFT_SERVER - SVDEBUG << "FFTDataServer::modelAboutToBeDeleted: server is " - << server << endl; + std::cerr << "FFTDataServer::modelAboutToBeDeleted: server is " + << server << std::endl; #endif if (i->second.second > 0) { @@ -463,14 +463,14 @@ j != m_releasedServers.end(); ++j) { if (*j == server) { #ifdef DEBUG_FFT_SERVER - SVDEBUG << "FFTDataServer::modelAboutToBeDeleted: erasing from released servers" << endl; + std::cerr << "FFTDataServer::modelAboutToBeDeleted: erasing from released servers" << std::endl; #endif m_releasedServers.erase(j); break; } } #ifdef DEBUG_FFT_SERVER - SVDEBUG << "FFTDataServer::modelAboutToBeDeleted: erasing server" << endl; + std::cerr << "FFTDataServer::modelAboutToBeDeleted: erasing server" << std::endl; #endif m_servers.erase(i); delete server; @@ -841,7 +841,7 @@ // preconditions: m_caches[c] exists and contains a file writer; // m_cacheVectorLock is not locked by this thread #ifdef DEBUG_FFT_SERVER - SVDEBUG << "FFTDataServer::makeCacheReader(" << c << ")" << endl; + std::cerr << "FFTDataServer::makeCacheReader(" << c << ")" << std::endl; #endif QThread *me = QThread::currentThread(); @@ -875,7 +875,7 @@ cb = m_caches.at(deleteCandidate); if (cb && cb->fileCacheReader.find(me) != cb->fileCacheReader.end()) { #ifdef DEBUG_FFT_SERVER - SVDEBUG << "FFTDataServer::makeCacheReader: Deleting probably unpopular reader " << deleteCandidate << " for this thread (as I create reader " << c << ")" << endl; + std::cerr << "FFTDataServer::makeCacheReader: Deleting probably unpopular reader " << deleteCandidate << " for this thread (as I create reader " << c << ")" << std::endl; #endif delete cb->fileCacheReader[me]; cb->fileCacheReader.erase(me); @@ -901,8 +901,8 @@ if (!cache->haveSetColumnAt(col)) { Profiler profiler("FFTDataServer::getMagnitudeAt: filling"); #ifdef DEBUG_FFT_SERVER - SVDEBUG << "FFTDataServer::getMagnitudeAt: calling fillColumn(" - << x << ")" << endl; + std::cerr << "FFTDataServer::getMagnitudeAt: calling fillColumn(" + << x << ")" << std::endl; #endif fillColumn(x); } @@ -1130,7 +1130,7 @@ if (!cache->haveSetColumnAt(col)) { Profiler profiler("FFTDataServer::getValuesAt: filling"); #ifdef DEBUG_FFT_SERVER - SVDEBUG << "FFTDataServer::getValuesAt(" << x << ", " << y << "): filling" << endl; + std::cerr << "FFTDataServer::getValuesAt(" << x << ", " << y << "): filling" << std::endl; #endif fillColumn(x); } @@ -1189,7 +1189,7 @@ /*!!! if (m_lastUsedCache == -1) { if (m_suspended) { - SVDEBUG << "FFTDataServer::isColumnReady(" << x << "): no cache, calling resume" << endl; + std::cerr << "FFTDataServer::isColumnReady(" << x << "): no cache, calling resume" << std::endl; resume(); } m_fillThread->start(); @@ -1258,12 +1258,12 @@ endFrame -= winsize / 2; #ifdef DEBUG_FFT_SERVER_FILL - SVDEBUG << "FFTDataServer::fillColumn: requesting frames " + std::cerr << "FFTDataServer::fillColumn: requesting frames " << startFrame + pfx << " -> " << endFrame << " ( = " << endFrame - (startFrame + pfx) << ") at index " << off + pfx << " in buffer of size " << m_fftSize << " with window size " << m_windowSize - << " from channel " << m_channel << endl; + << " from channel " << m_channel << std::endl; #endif QMutexLocker locker(&m_fftBuffersLock); @@ -1370,7 +1370,7 @@ } if (m_suspended) { -// SVDEBUG << "FFTDataServer::fillColumn(" << x << "): calling resume" << endl; +// std::cerr << "FFTDataServer::fillColumn(" << x << "): calling resume" << std::endl; // resume(); } } @@ -1446,7 +1446,7 @@ FFTDataServer::FillThread::run() { #ifdef DEBUG_FFT_SERVER_FILL - SVDEBUG << "FFTDataServer::FillThread::run()" << endl; + std::cerr << "FFTDataServer::FillThread::run()" << std::endl; #endif m_extent = 0; @@ -1454,7 +1454,7 @@ while (!m_server.m_model->isReady() && !m_server.m_exiting) { #ifdef DEBUG_FFT_SERVER_FILL - SVDEBUG << "FFTDataServer::FillThread::run(): waiting for model " << m_server.m_model << " to be ready" << endl; + std::cerr << "FFTDataServer::FillThread::run(): waiting for model " << m_server.m_model << " to be ready" << std::endl; #endif sleep(1); } @@ -1476,7 +1476,7 @@ try { m_server.fillColumn(int((f - start) / m_server.m_windowIncrement)); } catch (std::exception &e) { - SVDEBUG << "FFTDataServer::FillThread::run: exception: " << e.what() << endl; + std::cerr << "FFTDataServer::FillThread::run: exception: " << e.what() << std::endl; m_error = e.what(); m_server.fillComplete(); m_completion = 100; @@ -1525,7 +1525,7 @@ try { m_server.fillColumn(int((f - start) / m_server.m_windowIncrement)); } catch (std::exception &e) { - SVDEBUG << "FFTDataServer::FillThread::run: exception: " << e.what() << endl; + std::cerr << "FFTDataServer::FillThread::run: exception: " << e.what() << std::endl; m_error = e.what(); m_server.fillComplete(); m_completion = 100; @@ -1567,7 +1567,7 @@ m_extent = end; #ifdef DEBUG_FFT_SERVER - SVDEBUG << "FFTDataServer::FillThread::run exiting" << endl; + std::cerr << "FFTDataServer::FillThread::run exiting" << std::endl; #endif }