00001 /* -*- Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */ 00002 /* 00003 * Copyright (c) Xerox Corporation 1997. All rights reserved. 00004 * 00005 * License is granted to copy, to use, and to make and to use derivative 00006 * works for research and evaluation purposes, provided that Xerox is 00007 * acknowledged in all documentation pertaining to any such copy or 00008 * derivative work. Xerox grants no other licenses expressed or 00009 * implied. The Xerox trade name should not be used in any advertising 00010 * without its written permission. 00011 * 00012 * XEROX CORPORATION MAKES NO REPRESENTATIONS CONCERNING EITHER THE 00013 * MERCHANTABILITY OF THIS SOFTWARE OR THE SUITABILITY OF THIS SOFTWARE 00014 * FOR ANY PARTICULAR PURPOSE. The software is provided "as is" without 00015 * express or implied warranty of any kind. 00016 * 00017 * These notices must be retained in any copies of any part of this 00018 * software. 00019 * @(#) $Header: /nfs/jade/vint/CVSROOT/ns-2/adc/estimator.h,v 1.7 1999/02/12 22:01:29 breslau Exp $ 00020 */ 00021 00022 //Estimator unit estimates average load every period interval of time 00023 00024 #ifndef ns_estimator_h 00025 #define ns_estimator_h 00026 00027 #include "connector.h" 00028 #include "measuremod.h" 00029 #include "timer-handler.h" 00030 00031 class Estimator; 00032 00033 class Estimator_Timer : public TimerHandler { 00034 public: 00035 Estimator_Timer(Estimator *est) : TimerHandler() { est_ = est;} 00036 00037 protected: 00038 virtual void expire(Event *e); 00039 Estimator *est_; 00040 }; 00041 00042 class Estimator : public NsObject { 00043 public: 00044 Estimator(); 00045 inline double avload() { return double(avload_);}; 00046 00047 inline virtual void change_avload(double incr) { avload_ += incr;} 00048 inline virtual void newflow(double) {}; 00049 int command(int argc, const char*const* argv); 00050 virtual void timeout(int); 00051 inline void recv(Packet *,Handler *){} 00052 virtual void start(); 00053 void stop(); 00054 void setmeasmod(MeasureMod *); 00055 void setactype(const char*); 00056 inline double &period(){ return period_;} 00057 void trace(TracedVar* v); 00058 protected: 00059 MeasureMod *meas_mod_; 00060 TracedDouble avload_; 00061 double period_; 00062 virtual void estimate()=0; 00063 Estimator_Timer est_timer_; 00064 TracedDouble measload_; 00065 Tcl_Channel tchan_; 00066 int src_; 00067 int dst_; 00068 double omeasload_; 00069 double oavload_; 00070 char *actype_; 00071 }; 00072 00073 #endif
1.3.3