00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __MONITOR_H
00022 #define __MONITOR_H
00023
00024 #include <qdatetime.h>
00025 #include <qmutex.h>
00026 #include <qwaitcondition.h>
00027
00028 #ifdef __GEDDEI_BUILD
00029 #include "qfastwaitcondition.h"
00030 #include "processor.h"
00031 #else
00032 #include <qtextra/qfastwaitcondition.h>
00033 #include <geddei/processor.h>
00034 #endif
00035
00048 class Monitor: public Processor
00049 {
00050 virtual const bool processorStarted();
00051 virtual void processor();
00052 virtual void processorStopped();
00053 virtual const bool verifyAndSpecifyTypes(const SignalTypeRefs &inTypes, SignalTypeRefs &outTypes);
00054 virtual void initFromProperties(const Properties &properties);
00055 virtual void receivedPlunger();
00056 virtual void specifyOutputSpace(QValueVector<uint> &samples);
00057
00058 QMutex thePlunging;
00059 QFastWaitCondition thePlunge;
00060 uint thePlungersCaught;
00061
00062 uint theScope;
00063 float theFrequency;
00064
00065 uint theTotalSamples;
00066 double theTotalTime;
00067 QTime theTimer;
00068
00069 public:
00076 const double averageThroughput() { return double(elementsProcessed() * 32) / theTotalTime; }
00077
00083 const double elapsedTime() { return theTotalTime; }
00084
00090 const uint elementsProcessed() { return theTotalSamples * theScope; }
00091
00097 const uint samplesProcessed() { return theTotalSamples; }
00098
00105 const double signalProcessed() { return double(theTotalSamples) / theFrequency; }
00106
00115 const double timesFasterThanReal() { return signalProcessed() / theTotalTime; }
00116
00128 void waitForPlunger();
00129
00137 void resetPlungerMemory();
00138
00139 Monitor() : Processor("Monitor", NotMulti, Guarded), thePlungersCaught(0) {}
00140 };
00141
00142 #endif