--- linuxsampler/trunk/src/linuxsampler.cpp 2005/03/02 16:25:27 419 +++ linuxsampler/trunk/src/linuxsampler.cpp 2005/03/03 03:25:17 420 @@ -25,6 +25,7 @@ #include #include "Sampler.h" +#include "engines/EngineFactory.h" #include "drivers/midi/MidiInputDeviceFactory.h" #include "drivers/audio/AudioOutputDeviceFactory.h" #include "engines/gig/Profiler.h" @@ -37,6 +38,7 @@ Sampler* pSampler = NULL; LSCPServer* pLSCPServer = NULL; pthread_t main_thread; +bool bPrintStatistics = false; bool profile = false; bool tune = true; @@ -117,12 +119,20 @@ rtEvents.push_back(LSCPEvent::event_stream_count); rtEvents.push_back(LSCPEvent::event_buffer_fill); - while(true) - { - /*printf("Voices: %3.3d (Max: %3.3d) Streams: %3.3d (Max: %3.3d, Unused: %3.3d)\r", - pEngine->ActiveVoiceCount, pEngine->ActiveVoiceCountMax, - pEngine->pDiskThread->ActiveStreamCount, pEngine->pDiskThread->ActiveStreamCountMax, Stream::GetUnusedStreams()); - fflush(stdout);*/ + while (true) { + if (bPrintStatistics) { + std::set engines = EngineFactory::EngineInstances(); + std::set::iterator itEngine = engines.begin(); + for (int i = 0; itEngine != engines.end(); itEngine++, i++) { + Engine* pEngine = *itEngine; + printf("Engine %d) Voices: %3.3d (Max: %3.3d) Streams: %3.3d (Max: %3.3d)\n", i, + pEngine->VoiceCount(), pEngine->VoiceCountMax(), + pEngine->DiskStreamCount(), pEngine->DiskStreamCountMax() + ); + fflush(stdout); + } + } + sleep(1); if (profile) { @@ -216,6 +226,7 @@ {"version",0,0,0}, {"profile",0,0,0}, {"no-tune",0,0,0}, + {"statistics",0,0,0}, {0,0,0,0} }; @@ -234,6 +245,7 @@ printf("--version prints version information\n"); printf("--profile profile synthesis algorithms\n"); printf("--no-tune disable assembly optimization\n"); + printf("--statistics prints periodically statistics\n"); exit(EXIT_SUCCESS); break; case 1: // --version @@ -246,6 +258,9 @@ case 3: // --no-tune tune = false; break; + case 4: // --statistics + bPrintStatistics = true; + break; } } }