Main Page   Class Hierarchy   Compound List   File List   Compound Members  

C_ProtocolStats.hpp

00001 /*
00002  *  This program is free software; you can redistribute it and/or modify
00003  *  it under the terms of the GNU General Public License as published by
00004  *  the Free Software Foundation; either version 2 of the License, or
00005  *  (at your option) any later version.
00006  *
00007  *  This program is distributed in the hope that it will be useful,
00008  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00009  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010  *  GNU General Public License for more details.
00011  *
00012  *  You should have received a copy of the GNU General Public License
00013  *  along with this program; if not, write to the Free Software
00014  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00015  *
00016  * (c)Copyright 2006 Hewlett-Packard Development Company, LP.
00017  *
00018  */
00019 
00020 #ifndef _C_PROTOCOL_STATS_H
00021 #define _C_PROTOCOL_STATS_H
00022 
00023 #include "iostream_t.hpp"
00024 #include "C_ProtocolFrame.hpp"
00025 #include "Utils.hpp"
00026 #include "C_DisplayObject.hpp"
00027 #include "C_ProtocolStatsFrame.hpp"
00028 
00029 #include "C_Semaphore.hpp"
00030 #include "fstream_t.hpp"
00031 #include "TimeUtils.hpp"
00032 
00033 #define TIME_LENGTH 32
00034 
00035 class C_ProtocolStats : public C_DisplayObject, 
00036                         public C_ProtocolStatsFrame {
00037 
00038 public:
00039 
00040   C_ProtocolStats(C_ProtocolFrame *P_protocol) ;
00041   virtual ~C_ProtocolStats();
00042 
00043   void updateStats (T_ProtocolStatDataType P_type,
00044                     T_ProtocolStatDataAction P_action,
00045                     int P_id);
00046 
00047   iostream_output& display (iostream_output& P_stream);
00048 
00049   void display_stats_message ();
00050   void display_stats_sub_message ();
00051 
00052   void displayScreen() ;
00053   void setCurrentScreen(bool P_first) ;
00054 
00055 
00056   void set_file_name     (char * name)   ;
00057   void make_first_log    ()              ;
00058   void make_log          ()              ;
00059   int  init () ;
00060   void do_log       () ;
00061 
00062   void reset_cumul_counters () ;  
00063 
00064 
00065 protected:
00066 private:
00067 
00068   class C_CounterData {
00069   public:
00070     T_CounterType m_counter_value                ;
00071     T_CounterType m_counter_periodic_value       ;
00072 
00073     // log stat
00074     T_CounterType m_counter_log_value            ;
00075     T_CounterType m_counter_periodic_log_value   ;
00076     
00077     C_Semaphore   m_sem                          ;
00078     C_Semaphore   m_sem_log                      ;
00079 
00080   } ;
00081 
00082   typedef C_CounterData *C_pCounterData ;
00083 
00084   int              m_nb_counter_msg ;
00085   int              m_nb_counter_msg_comp ;
00086 
00087   C_pCounterData  *m_counter_msg_comp_table ;
00088   C_pCounterData  *m_counter_msg_table ;
00089 
00090   int             *m_id_msg_table ;
00091   int             *m_id_msg_comp_table ;
00092   int              m_max_id_msg ;
00093   int              m_max_id_msg_comp ;
00094 
00095   char            *m_message_name ;
00096   char            *m_message_component_name ;
00097   char           **m_message_names ;
00098   char           **m_message_component_names ;
00099 
00100 
00101   typedef void (C_ProtocolStats::* T_DisplayProtocolFct)() ;
00102 
00103   int                   m_current_proto_stat_id      ;
00104   int                   m_nb_stat_proto_id           ;
00105   T_DisplayProtocolFct *m_current_proto_stat_table   ;
00106   T_DisplayProtocolFct  m_current_proto_stat_display ;
00107 
00108 
00109 
00110   bool                     m_initDone ;
00111   struct timeval           m_startTime;
00112   struct timeval           m_plStartTime;
00113 
00114   bool                     m_headerAlreadyDisplayed;
00115   char                    *m_fileName;
00116   fstream_output          *m_outputStream;
00117   char* formatTime (struct timeval* P_tv);
00118   char* msToHHMMSS (unsigned long P_ms);
00119 
00120   bool                     m_do_log  ;
00121 
00122   int                      m_counter_message        ;
00123   int                      m_counter_message_comp   ;
00124 
00125   bool                     m_other_msg_screen       ;
00126   bool                     m_other_msg_screen_comp  ;
00127 
00128 
00129 } ;
00130 
00131 #endif // _C_PROTOCOL_STATS_H
00132 
00133 
00134 
00135 
00136 
00137 
00138 
00139 
00140 
00141 
00142 
00143 
00144 
00145 
00146 
00147 
00148 
00149 
00150 

Generated on Wed Mar 7 14:44:54 2007 for Seagull by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002