|
INET Framework for OMNeT++/OMNEST
|
00001 //FIXME upgrade and put back!! 00002 #if 0//XXX 00003 00004 // 00005 // Copyright (C) 2005 Andras Varga 00006 // 00007 // This program is free software; you can redistribute it and/or 00008 // modify it under the terms of the GNU Lesser General Public License 00009 // as published by the Free Software Foundation; either version 2 00010 // of the License, or (at your option) any later version. 00011 // 00012 // This program is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU Lesser General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU Lesser General Public License 00018 // along with this program; if not, see <http://www.gnu.org/licenses/>. 00019 // 00020 00021 #ifndef __INET_THRUPUTMETERINGCHANNEL_H 00022 #define __INET_THRUPUTMETERINGCHANNEL_H 00023 00024 #include <omnetpp.h> 00025 #include "INETDefs.h" 00026 00050 class SIM_API ThruputMeteringChannel : public cDatarateChannel 00051 { 00052 protected: 00053 // configuration 00054 cPar *fmtp; // display format 00055 unsigned int batchSize; // number of packets in a batch 00056 simtime_t maxInterval; // max length of measurement interval (measurement ends 00057 // if either batchSize or maxInterval is reached, whichever 00058 // is reached first) 00059 00060 // global statistics 00061 long numPackets; 00062 double numBits; // double to avoid overflow 00063 00064 // current measurement interval 00065 simtime_t intvlStartTime; 00066 simtime_t intvlLastPkTime; 00067 unsigned long intvlNumPackets; 00068 unsigned long intvlNumBits; 00069 00070 // reading from last interval 00071 double currentBitPerSec; 00072 double currentPkPerSec; 00073 00074 protected: 00075 virtual void beginNewInterval(simtime_t now); 00076 virtual void updateDisplay(); 00077 00078 public: 00082 explicit ThruputMeteringChannel(const char *name=NULL); 00083 00087 ThruputMeteringChannel(const ThruputMeteringChannel& ch); 00088 00092 virtual ~ThruputMeteringChannel(); 00093 00097 ThruputMeteringChannel& operator=(const ThruputMeteringChannel& ch); 00098 00103 virtual ThruputMeteringChannel *dup() const {return new ThruputMeteringChannel(*this);} 00104 00108 virtual cPar& addPar(const char *s); 00109 00113 virtual cPar& addPar(cPar *p); 00114 00118 virtual bool deliver(cMessage *msg, simtime_t at); 00119 }; 00120 00121 #endif 00122 00123 00124 #endif 00125