Main Page   Class Hierarchy   Compound List   File List   Compound Members  

C_GeneratorStats Class Reference

#include <C_GeneratorStats.hpp>

List of all members.

Public Types

typedef C_GeneratorStats::_T_dynamicalRepartition T_dynamicalRepartition
enum  E_Action {
  E_CREATE_INCOMING_CALL, E_CALL_FAILED, E_CALL_REFUSED, E_CALL_INIT_SUCCESSFULLY_ENDED,
  E_CALL_TRAFFIC_SUCCESSFULLY_ENDED, E_CALL_DEFAULT_SUCCESSFULLY_ENDED, E_CALL_ABORT_SUCCESSFULLY_ENDED, E_SEND_MSG,
  E_RECV_MSG, E_RESET_PD_COUNTERS, E_RESET_PL_COUNTERS, E_FAILED_UNEXPECTED_MSG,
  E_FAILED_CANNOT_SEND_MSG, E_FAILED_ABORTED, E_FAILED_TIMEOUT, E_CREATE_OUTGOING_CALL,
  E_ADD_CALL_DURATION, E_ADD_RESPONSE_TIME_DURATION, E_FAILED_CALL_REJECTED, E_FAILED_MAX_UDP_RETRANS,
  E_FAILED_CMD_NOT_SENT, E_FAILED_REGEXP_DOESNT_MATCH, E_FAILED_REGEXP_HDR_NOT_FOUND
}
enum  E_CounterName {
  CPT_C_IncomingCallCreated, CPT_C_MsgSend, CPT_C_MsgRecv, CPT_C_CurrentCall,
  CPT_C_InitSuccessfulCall, CPT_C_TrafficSuccessfulCall, CPT_C_DefaultSuccessfulCall, CPT_C_AbortSuccessfulCall,
  CPT_C_FailedCall, CPT_C_RefusedCall, CPT_C_FailedCallAborted, CPT_C_FailedCallTimeout,
  CPT_C_FailedCallCannotSendMessage, CPT_C_FailedCallUnexpectedMessage, CPT_C_OutgoingCallCreated, CPT_C_NbOfCallUsedForAverageResponseTime,
  CPT_C_AverageResponseTime, CPT_C_NbOfCallUsedForAverageCallLength, CPT_C_AverageCallLength, CPT_C_FailedCallMaxUdpRetrans,
  CPT_C_FailedCallCallRejected, CPT_C_FailedCallCmdNotSent, CPT_C_FailedCallRegexpDoesntMatch, CPT_C_FailedCallRegexpHdrNotFound,
  CPT_PD_IncomingCallCreated, CPT_PD_MsgSend, CPT_PD_MsgRecv, CPT_PD_InitSuccessfulCall,
  CPT_PD_TrafficSuccessfulCall, CPT_PD_DefaultSuccessfulCall, CPT_PD_AbortSuccessfulCall, CPT_PD_FailedCall,
  CPT_PD_RefusedCall, CPT_PD_FailedCallAborted, CPT_PD_FailedCallTimeout, CPT_PD_FailedCallCannotSendMessage,
  CPT_PD_FailedCallUnexpectedMessage, CPT_PD_OutgoingCallCreated, CPT_PD_NbOfCallUsedForAverageResponseTime, CPT_PD_AverageResponseTime,
  CPT_PD_NbOfCallUsedForAverageCallLength, CPT_PD_AverageCallLength, CPT_PD_FailedCallMaxUdpRetrans, CPT_PD_FailedCallCallRejected,
  CPT_PD_FailedCallCmdNotSent, CPT_PD_FailedCallRegexpDoesntMatch, CPT_PD_FailedCallRegexpHdrNotFound, CPT_PL_IncomingCallCreated,
  CPT_PL_MsgSend, CPT_PL_MsgRecv, CPT_PL_InitSuccessfulCall, CPT_PL_TrafficSuccessfulCall,
  CPT_PL_DefaultSuccessfulCall, CPT_PL_AbortSuccessfulCall, CPT_PL_FailedCall, CPT_PL_RefusedCall,
  CPT_PL_FailedCallAborted, CPT_PL_FailedCallTimeout, CPT_PL_FailedCallCannotSendMessage, CPT_PL_FailedCallUnexpectedMessage,
  CPT_PL_OutgoingCallCreated, CPT_PL_NbOfCallUsedForAverageResponseTime, CPT_PL_AverageResponseTime, CPT_PL_NbOfCallUsedForAverageCallLength,
  CPT_PL_AverageCallLength, CPT_PL_FailedCallMaxUdpRetrans, CPT_PL_FailedCallCallRejected, CPT_PL_FailedCallCmdNotSent,
  CPT_PL_FailedCallRegexpDoesntMatch, CPT_PL_FailedCallRegexpHdrNotFound, E_NB_COUNTER
}

Public Methods

void close ()
int computeStat (E_Action P_action)
int computeStat (E_Action P_action, unsigned long P_value)
int executeStatAction (E_Action P_action)
int executeStatAction (E_Action P_action, unsigned long P_value)
void displayScreen (int P_id, int P_sub_screen)
void makeFirstLog ()
void makeLog ()
void info_msg (char *P_msg)
void err_msg (char *P_msg)
void reset_cumul_counters ()
void activate_percent_traffic ()
void setRepartitionCallLength (unsigned int *repartition, int nombre)
void setRepartitionCallLength (char *liste)
void setRepartitionResponseTime (unsigned int *repartition, int nombre)
void setRepartitionResponseTime (char *liste)
void setFileName (char *name)
void setFileName (char *name, char *extension)
void displayData ()
void displayStat ()
void displayRepartition ()
void dumpData ()
int init ()
void displayScreen ()
void makeDisplay1 (bool P_display)
void makeDisplay2 ()
char * dumpCounters ()

Static Public Methods

C_GeneratorStats * instance ()


Detailed Description

This class provides some means to compute and display statistics. This is a singleton class.

Definition at line 50 of file C_GeneratorStats.hpp.


Member Enumeration Documentation

enum C_GeneratorStats::E_Action
 

Actions on counters

Definition at line 67 of file C_GeneratorStats.hpp.

00068   {
00069     E_CREATE_INCOMING_CALL,
00070     E_CALL_FAILED, 
00071     E_CALL_REFUSED,
00072     //    E_CALL_SUCCESSFULLY_ENDED,
00073 
00074 
00075     E_CALL_INIT_SUCCESSFULLY_ENDED,
00076     E_CALL_TRAFFIC_SUCCESSFULLY_ENDED,
00077     E_CALL_DEFAULT_SUCCESSFULLY_ENDED,
00078     E_CALL_ABORT_SUCCESSFULLY_ENDED,
00079 
00080     E_SEND_MSG,    
00081     E_RECV_MSG,
00082 
00083     E_RESET_PD_COUNTERS,
00084     E_RESET_PL_COUNTERS,
00085 
00086     E_FAILED_UNEXPECTED_MSG,
00087     E_FAILED_CANNOT_SEND_MSG,
00088     E_FAILED_ABORTED,
00089 
00090     E_FAILED_TIMEOUT,
00091 
00092     E_CREATE_OUTGOING_CALL,
00093    
00094 
00095     // Not used 
00096     E_ADD_CALL_DURATION,
00097     E_ADD_RESPONSE_TIME_DURATION,
00098     E_FAILED_CALL_REJECTED,
00099     E_FAILED_MAX_UDP_RETRANS,
00100     E_FAILED_CMD_NOT_SENT,
00101     E_FAILED_REGEXP_DOESNT_MATCH,
00102     E_FAILED_REGEXP_HDR_NOT_FOUND
00103   };

enum C_GeneratorStats::E_CounterName
 

Counters management

Definition at line 107 of file C_GeneratorStats.hpp.

00108   {
00109          // Cumulative counter
00110          CPT_C_IncomingCallCreated,
00111          CPT_C_MsgSend,    
00112          CPT_C_MsgRecv,
00113          CPT_C_CurrentCall,
00114 
00115 
00116          CPT_C_InitSuccessfulCall,
00117          CPT_C_TrafficSuccessfulCall,
00118          CPT_C_DefaultSuccessfulCall,
00119          CPT_C_AbortSuccessfulCall,
00120          CPT_C_FailedCall,
00121          CPT_C_RefusedCall,
00122          CPT_C_FailedCallAborted,
00123          CPT_C_FailedCallTimeout,
00124 
00125          CPT_C_FailedCallCannotSendMessage,
00126          CPT_C_FailedCallUnexpectedMessage,
00127          CPT_C_OutgoingCallCreated,
00128          CPT_C_NbOfCallUsedForAverageResponseTime,
00129          CPT_C_AverageResponseTime,
00130 
00131          // not used
00132          CPT_C_NbOfCallUsedForAverageCallLength,
00133          CPT_C_AverageCallLength,
00134          CPT_C_FailedCallMaxUdpRetrans,
00135          CPT_C_FailedCallCallRejected,
00136          CPT_C_FailedCallCmdNotSent,
00137          CPT_C_FailedCallRegexpDoesntMatch,
00138          CPT_C_FailedCallRegexpHdrNotFound,
00139 
00140          // Periodic Display counter
00141          CPT_PD_IncomingCallCreated, // must be the first PD counter (RESET_PD_COUNTER macro)
00142          CPT_PD_MsgSend,    
00143          CPT_PD_MsgRecv,
00144 
00145 
00146          CPT_PD_InitSuccessfulCall,
00147          CPT_PD_TrafficSuccessfulCall,
00148          CPT_PD_DefaultSuccessfulCall,
00149          CPT_PD_AbortSuccessfulCall,
00150          CPT_PD_FailedCall,
00151          CPT_PD_RefusedCall,
00152          CPT_PD_FailedCallAborted,
00153          CPT_PD_FailedCallTimeout,
00154 
00155          CPT_PD_FailedCallCannotSendMessage,
00156          CPT_PD_FailedCallUnexpectedMessage,
00157          CPT_PD_OutgoingCallCreated,
00158          CPT_PD_NbOfCallUsedForAverageResponseTime,
00159          CPT_PD_AverageResponseTime,
00160 
00161 
00162          // not used
00163          CPT_PD_NbOfCallUsedForAverageCallLength,
00164          CPT_PD_AverageCallLength,
00165          CPT_PD_FailedCallMaxUdpRetrans,
00166          CPT_PD_FailedCallCallRejected,
00167          CPT_PD_FailedCallCmdNotSent,
00168          CPT_PD_FailedCallRegexpDoesntMatch,
00169          CPT_PD_FailedCallRegexpHdrNotFound, // must be the last PD counter (RESET_PD_COUNTER macro)
00170 
00171          // Periodic logging counter
00172          CPT_PL_IncomingCallCreated, // must be the first PL counter (RESET_PL_COUNTER macro)
00173          CPT_PL_MsgSend,    
00174          CPT_PL_MsgRecv,
00175 
00176 
00177          CPT_PL_InitSuccessfulCall,
00178          CPT_PL_TrafficSuccessfulCall,
00179          CPT_PL_DefaultSuccessfulCall,
00180          CPT_PL_AbortSuccessfulCall,
00181          CPT_PL_FailedCall,
00182          CPT_PL_RefusedCall,
00183          CPT_PL_FailedCallAborted,
00184          CPT_PL_FailedCallTimeout,
00185 
00186 
00187          CPT_PL_FailedCallCannotSendMessage,
00188          CPT_PL_FailedCallUnexpectedMessage,
00189          CPT_PL_OutgoingCallCreated,
00190          CPT_PL_NbOfCallUsedForAverageResponseTime,
00191          CPT_PL_AverageResponseTime,
00192 
00193 
00194          // not used
00195          CPT_PL_NbOfCallUsedForAverageCallLength,
00196          CPT_PL_AverageCallLength,
00197          CPT_PL_FailedCallMaxUdpRetrans,
00198          CPT_PL_FailedCallCallRejected,
00199          CPT_PL_FailedCallCmdNotSent,
00200          CPT_PL_FailedCallRegexpDoesntMatch,
00201          CPT_PL_FailedCallRegexpHdrNotFound, // must be the last PL counter (RESET_PL_COUNTER macro)
00202 
00203          E_NB_COUNTER
00204   };


Member Function Documentation

void C_GeneratorStats::close  
 

Delete the single instance of the class.

Only one instance of C_GeneratorStats exists in the component. This instance is deleted when the close method is called.

Definition at line 43 of file C_GeneratorStats.cpp.

00044 {
00045 
00046   FREE_TABLE(m_ResponseTimeRepartition);
00047 
00048   FREE_TABLE(m_CallLengthRepartition) ;
00049 
00050   if(m_outputStream != NULL)
00051   {
00052     m_outputStream->close();
00053     DELETE_VAR(m_outputStream);
00054   }
00055 
00056   FREE_TABLE(m_fileName);
00057 
00058   FREE_TABLE(m_current_repartition_table);
00059 
00060 
00061   m_SizeOfResponseTimeRepartition = 0;
00062   m_SizeOfCallLengthRepartition   = 0;
00063   m_CallLengthRepartition         = NULL;
00064   m_fileName                      = NULL;
00065   m_ResponseTimeRepartition       = NULL;
00066   m_outputStream                  = NULL;
00067 
00068   DELETE_VAR(m_instance);
00069   m_instance                      = NULL;
00070 
00071 }

int C_GeneratorStats::computeStat E_Action    P_action
 

ComputeStat Methode are used to modify counter value It's the main interface to update counter

Returns:
0 if the action is known -1 else

Definition at line 367 of file C_GeneratorStats.cpp.

00368 {
00369   switch (P_action) {
00370 
00371   case E_CREATE_INCOMING_CALL :
00372 
00373     m_mutexTable[CPT_C_IncomingCallCreated].lock() ;
00374     m_counters [CPT_C_IncomingCallCreated]++;
00375     m_counters [CPT_PD_IncomingCallCreated]++;
00376     m_counters [CPT_PL_IncomingCallCreated]++;
00377     m_mutexTable[CPT_C_IncomingCallCreated].unlock() ;
00378 
00379     m_mutexTable[CPT_C_CurrentCall].lock();
00380     m_counters [CPT_C_CurrentCall]++;
00381     m_mutexTable[CPT_C_CurrentCall].unlock();
00382     break;
00383 
00384   case E_SEND_MSG :
00385     m_mutexTable[CPT_C_MsgSend].lock() ;
00386     m_counters [CPT_C_MsgSend]++;
00387     m_counters [CPT_PD_MsgSend]++;
00388     m_counters [CPT_PL_MsgSend]++;
00389     m_mutexTable[CPT_C_MsgSend].unlock() ;
00390     break;
00391     
00392   case E_RECV_MSG :
00393     m_mutexTable[CPT_C_MsgRecv].lock() ;
00394     m_counters [CPT_C_MsgRecv]++;
00395     m_counters [CPT_PD_MsgRecv]++;
00396     m_counters [CPT_PL_MsgRecv]++;
00397     m_mutexTable[CPT_C_MsgRecv].unlock() ;
00398     break;
00399     
00400   case E_CALL_FAILED :
00401     m_mutexTable[CPT_C_FailedCall].lock() ;
00402     m_counters [CPT_C_FailedCall]++;
00403     m_counters [CPT_PD_FailedCall]++;
00404     m_counters [CPT_PL_FailedCall]++;
00405     m_mutexTable[CPT_C_FailedCall].unlock() ;
00406     m_mutexTable[CPT_C_CurrentCall].lock();
00407     m_counters [CPT_C_CurrentCall]--;
00408     m_mutexTable[CPT_C_CurrentCall].unlock();
00409     break;
00410       
00411   case E_CALL_INIT_SUCCESSFULLY_ENDED :
00412     m_mutexTable[CPT_C_InitSuccessfulCall].lock() ;
00413     m_counters [CPT_C_InitSuccessfulCall]++;
00414     m_counters [CPT_PD_InitSuccessfulCall]++;
00415     m_counters [CPT_PL_InitSuccessfulCall]++;
00416     m_mutexTable[CPT_C_InitSuccessfulCall].unlock() ;
00417 
00418     m_mutexTable[CPT_C_CurrentCall].lock();
00419     m_counters [CPT_C_CurrentCall]--;
00420     m_mutexTable[CPT_C_CurrentCall].unlock();
00421     break;
00422 
00423   case E_CALL_TRAFFIC_SUCCESSFULLY_ENDED :
00424     m_mutexTable[CPT_C_TrafficSuccessfulCall].lock() ;
00425     m_counters [CPT_C_TrafficSuccessfulCall]++;
00426     m_counters [CPT_PD_TrafficSuccessfulCall]++;
00427     m_counters [CPT_PL_TrafficSuccessfulCall]++;
00428     m_mutexTable[CPT_C_TrafficSuccessfulCall].unlock() ;
00429 
00430     m_mutexTable[CPT_C_CurrentCall].lock();
00431     m_counters [CPT_C_CurrentCall]--;
00432     m_mutexTable[CPT_C_CurrentCall].unlock();
00433     break;
00434 
00435   case E_CALL_DEFAULT_SUCCESSFULLY_ENDED :
00436     m_mutexTable[CPT_C_DefaultSuccessfulCall].lock() ;
00437     m_counters [CPT_C_DefaultSuccessfulCall]++;
00438     m_counters [CPT_PD_DefaultSuccessfulCall]++;
00439     m_counters [CPT_PL_DefaultSuccessfulCall]++;
00440     m_mutexTable[CPT_C_DefaultSuccessfulCall].unlock() ;
00441 
00442     m_mutexTable[CPT_C_CurrentCall].lock();
00443     m_counters [CPT_C_CurrentCall]--;
00444     m_mutexTable[CPT_C_CurrentCall].unlock();
00445     break;
00446 
00447   case E_CALL_ABORT_SUCCESSFULLY_ENDED :
00448     m_mutexTable[CPT_C_AbortSuccessfulCall].lock() ;
00449     m_counters [CPT_C_AbortSuccessfulCall]++;
00450     m_counters [CPT_PD_AbortSuccessfulCall]++;
00451     m_counters [CPT_PL_AbortSuccessfulCall]++;
00452     m_mutexTable[CPT_C_AbortSuccessfulCall].unlock() ;
00453 
00454     m_mutexTable[CPT_C_CurrentCall].lock();
00455     m_counters [CPT_C_CurrentCall]--;
00456     m_mutexTable[CPT_C_CurrentCall].unlock();
00457     break;
00458 
00459   case E_FAILED_CANNOT_SEND_MSG :
00460     m_mutexTable[CPT_C_FailedCallCannotSendMessage].lock() ;
00461     m_counters [CPT_C_FailedCallCannotSendMessage]++;
00462     m_counters [CPT_PD_FailedCallCannotSendMessage]++;
00463     m_counters [CPT_PL_FailedCallCannotSendMessage]++;
00464     m_mutexTable[CPT_C_FailedCallCannotSendMessage].unlock() ;
00465     break;
00466 
00467   case E_FAILED_UNEXPECTED_MSG :
00468     m_mutexTable[CPT_C_FailedCallUnexpectedMessage].lock() ;
00469     m_counters [CPT_C_FailedCallUnexpectedMessage]++;
00470     m_counters [CPT_PD_FailedCallUnexpectedMessage]++;
00471     m_counters [CPT_PL_FailedCallUnexpectedMessage]++;
00472     m_mutexTable[CPT_C_FailedCallUnexpectedMessage].unlock() ;
00473     break;
00474     
00475   case E_RESET_PD_COUNTERS :
00476     m_mutexTable[CPT_PD_IncomingCallCreated].lock();
00477     m_counters[CPT_PD_IncomingCallCreated] = (unsigned long) 0;
00478     m_counters[CPT_PD_OutgoingCallCreated] = (unsigned long) 0;
00479     m_counters[CPT_PD_MsgRecv] = (unsigned long) 0;
00480     m_counters[CPT_PD_MsgSend] = (unsigned long) 0;
00481 
00482     m_counters[CPT_PD_InitSuccessfulCall] = (unsigned long) 0;
00483     m_counters[CPT_PD_TrafficSuccessfulCall] = (unsigned long) 0;
00484     m_counters[CPT_PD_DefaultSuccessfulCall] = (unsigned long) 0;
00485     m_counters[CPT_PD_AbortSuccessfulCall] = (unsigned long) 0;
00486 
00487     m_counters[CPT_PD_FailedCall] = (unsigned long) 0;
00488 
00489     GET_TIME (&m_pdStartTime);
00490     m_mutexTable[CPT_PD_IncomingCallCreated].unlock();
00491     break;
00492 
00493   case E_RESET_PL_COUNTERS :
00494     RESET_PL_COUNTERS (m_counters);
00495     GET_TIME (&m_plStartTime);
00496     break;
00497     
00498   case E_CREATE_OUTGOING_CALL :
00499 
00500     m_mutexTable [CPT_C_OutgoingCallCreated].lock() ;
00501     m_counters [CPT_C_OutgoingCallCreated]++;
00502     m_counters [CPT_PD_OutgoingCallCreated]++;
00503     m_counters [CPT_PL_OutgoingCallCreated]++;
00504     m_mutexTable [CPT_C_OutgoingCallCreated].unlock() ;
00505 
00506     m_mutexTable [CPT_C_CurrentCall].lock() ;
00507     m_counters [CPT_C_CurrentCall]++;
00508     m_mutexTable [CPT_C_CurrentCall].unlock() ;
00509     break;
00510 
00511 
00512     // NOT USED
00513   case E_FAILED_MAX_UDP_RETRANS :
00514     m_counters [CPT_C_FailedCallMaxUdpRetrans]++;
00515     m_counters [CPT_PD_FailedCallMaxUdpRetrans]++;
00516     m_counters [CPT_PL_FailedCallMaxUdpRetrans]++;
00517     break;
00518 
00519   case E_FAILED_CALL_REJECTED :
00520     m_counters [CPT_C_FailedCallCallRejected]++;
00521     m_counters [CPT_PD_FailedCallCallRejected]++;
00522     m_counters [CPT_PL_FailedCallCallRejected]++;
00523     break;
00524     
00525   case E_FAILED_CMD_NOT_SENT :
00526     m_counters [CPT_C_FailedCallCmdNotSent]++;
00527     m_counters [CPT_PD_FailedCallCmdNotSent]++;
00528     m_counters [CPT_PL_FailedCallCmdNotSent]++;
00529     break;
00530 
00531   case E_FAILED_REGEXP_DOESNT_MATCH :
00532     m_counters [CPT_C_FailedCallRegexpDoesntMatch]++;
00533     m_counters [CPT_PD_FailedCallRegexpDoesntMatch]++;
00534     m_counters [CPT_PL_FailedCallRegexpDoesntMatch]++;
00535     break;
00536     
00537   case E_FAILED_REGEXP_HDR_NOT_FOUND :
00538     m_counters [CPT_C_FailedCallRegexpHdrNotFound]++;
00539     m_counters [CPT_PD_FailedCallRegexpHdrNotFound]++;
00540     m_counters [CPT_PL_FailedCallRegexpHdrNotFound]++;
00541     break;
00542     
00543 
00544   default :
00545     GEN_FATAL(0,"C_GeneratorStats::ComputeStat() - Unrecognized Action " <<  P_action);
00546     break ;
00547   } /* end switch */
00548 
00549   return (0);
00550 }

void C_GeneratorStats::displayData  
 

Display data periodically updated on screen.

Definition at line 1167 of file C_GeneratorStats.cpp.

01168 {
01169   long   localElapsedTime, globalElapsedTime ;
01170   struct timeval currentTime;
01171   float  averageCallRate;
01172   float  realInstantCallRate;
01173   unsigned long numberOfCall;
01174 
01175   GET_TIME (&currentTime);
01176   // computing the real call rate
01177   globalElapsedTime   = ms_difftime (&currentTime, &m_startTime);
01178   localElapsedTime    = ms_difftime (&currentTime, &m_pdStartTime);
01179   // the call rate is for all the call : incoming and outgoing
01180   numberOfCall        = m_counters[CPT_C_IncomingCallCreated] + m_counters[CPT_C_OutgoingCallCreated];
01181   averageCallRate     = (globalElapsedTime > 0 ? 1000*(float)numberOfCall/(float)globalElapsedTime : 0.0);
01182   numberOfCall        = m_counters[CPT_PD_IncomingCallCreated] + m_counters[CPT_PD_OutgoingCallCreated];
01183   realInstantCallRate = (localElapsedTime  > 0 ? 
01184                         1000*(float)numberOfCall / (float)localElapsedTime :
01185                         0.0);
01186 
01187   // display info
01188   DISPLAY_DLINE ();
01189   // build and display header info
01190   DISPLAY_TXT ("Start Time  ", formatTime(&m_startTime));
01191   DISPLAY_TXT ("Last Reset Time", formatTime(&m_pdStartTime));
01192   DISPLAY_TXT ("Current Time", formatTime(&currentTime));
01193 
01194   // printing the header in the middle
01195   DISPLAY_CROSS_LINE();
01196   DISPLAY_HEADER();
01197   DISPLAY_CROSS_LINE();
01198 
01199   DISPLAY_TXT_COL ("Elapsed Time", msToHHMMSSmmm(localElapsedTime),   msToHHMMSSmmm(globalElapsedTime));
01200 
01201   DISPLAY_VAL_RATEF_COL ("Call Rate",  realInstantCallRate, averageCallRate);
01202   DISPLAY_CROSS_LINE ();
01203  
01204   DISPLAY_2VAL  ("Incoming call created", m_counters[CPT_PD_IncomingCallCreated],
01205                                           m_counters[CPT_C_IncomingCallCreated]);
01206 
01207   DISPLAY_2VAL  ("OutGoing call created", m_counters[CPT_PD_OutgoingCallCreated],
01208                                           m_counters[CPT_C_OutgoingCallCreated]);
01209   DISPLAY_CUMUL ("Total Call created", m_counters[CPT_C_IncomingCallCreated] +
01210                                        m_counters[CPT_C_OutgoingCallCreated]);
01211   DISPLAY_PERIO ("Current Calls",       m_counters[CPT_C_CurrentCall]);
01212   DISPLAY_CROSS_LINE ();
01213 
01214 
01215   DISPLAY_2VAL  ("Successful init call", m_counters[CPT_PD_InitSuccessfulCall], 
01216                  m_counters[CPT_C_InitSuccessfulCall]);
01217 
01218   DISPLAY_2VAL  ("Successful traffic call", m_counters[CPT_PD_TrafficSuccessfulCall], 
01219                  m_counters[CPT_C_TrafficSuccessfulCall]);
01220 
01221   DISPLAY_2VAL  ("Successful default call", m_counters[CPT_PD_DefaultSuccessfulCall], 
01222                  m_counters[CPT_C_DefaultSuccessfulCall]);
01223 
01224   DISPLAY_2VAL  ("Successful abort call", m_counters[CPT_PD_AbortSuccessfulCall], 
01225                  m_counters[CPT_C_AbortSuccessfulCall]);
01226 
01227 
01228   DISPLAY_2VAL  ("Failed call",      m_counters[CPT_PD_FailedCall], m_counters[CPT_C_FailedCall]);
01229 
01230 
01231   DISPLAY_CROSS_LINE ();
01232   DISPLAY_TXT_COL ("Response Time", msToHHMMSSmmm( m_counters [CPT_PD_AverageResponseTime] ), 
01233                                     msToHHMMSSmmm( m_counters [CPT_C_AverageResponseTime] ));
01234   DISPLAY_TXT_COL ("Call Length", msToHHMMSSmmm( m_counters [CPT_PD_AverageCallLength] ), 
01235                                   msToHHMMSSmmm( m_counters [CPT_C_AverageCallLength] ));
01236   DISPLAY_CROSS_LINE ();
01237 
01238   DISPLAY_INFO("Average Response Time Repartition");
01239   displayRepartition(m_ResponseTimeRepartition, m_SizeOfResponseTimeRepartition);
01240   DISPLAY_INFO("Average Call Length Repartition");
01241   displayRepartition(m_CallLengthRepartition, m_SizeOfCallLengthRepartition);
01242 
01243 
01244   DISPLAY_DLINE ();
01245 } /* end of displayData () */

void C_GeneratorStats::dumpData  
 

Dump data periodically in the file m_FileName

Definition at line 1931 of file C_GeneratorStats.cpp.

01932 {
01933   long   localElapsedTime, globalElapsedTime ;
01934   struct timeval currentTime;
01935   float  averageCallRate;
01936   float  realInstantCallRate;
01937   unsigned long numberOfCall;
01938 
01939   // computing the real call rate
01940   GET_TIME (&currentTime);
01941   globalElapsedTime   = ms_difftime (&currentTime, &m_startTime);
01942   localElapsedTime    = ms_difftime (&currentTime, &m_plStartTime);
01943   // the call rate is for all the call : incoming and outgoing
01944   numberOfCall        = m_counters[CPT_C_IncomingCallCreated] + m_counters[CPT_C_OutgoingCallCreated];
01945   averageCallRate     = (globalElapsedTime > 0 ? 1000*(float)numberOfCall/(float)globalElapsedTime : 0.0);
01946   numberOfCall        = m_counters[CPT_PL_IncomingCallCreated] + m_counters[CPT_PL_OutgoingCallCreated];
01947   realInstantCallRate = (localElapsedTime  > 0 ? 
01948                         1000*(float)numberOfCall / (float)localElapsedTime :
01949                         0.0);
01950 
01951 
01952   if(m_outputStream == NULL)
01953   {
01954     // if the file is still not opened, we opened it now
01955     NEW_VAR(m_outputStream,
01956             fstream_output(m_fileName));
01957     m_headerAlreadyDisplayed = false;
01958     
01959     if(m_outputStream == NULL) {
01960       iostream_error << "Unable to open log file !" << iostream_endl;
01961       exit(-1);
01962     }
01963  
01964     if(!m_outputStream->good()) {
01965       iostream_error << "Unable to open log file !" << iostream_endl;
01966       exit(-1);
01967          }
01968   }
01969 
01970   if(m_headerAlreadyDisplayed == false)
01971   {
01972     // header - it's dump in file only one time at the beginning of the file
01973     (*m_outputStream) << "StartTime;"
01974                       << "LastResetTime;"
01975                       << "CurrentTime;" 
01976                       << "ElapsedTime(P);"
01977                       << "ElapsedTime(C);"
01978                       << "CallRate(P);"
01979                       << "CallRate(C);"
01980                       << "IncomingCall(P);"
01981                       << "IncomingCall(C);"
01982                       << "OutgoingCall(P);"
01983                       << "OutgoingCall(C);"
01984                       << "TotalCallCreated;"
01985                       << "CurrentCall;"
01986                       << "InitSuccessfulCall(P);"
01987                       << "InitSuccessfulCall(C);"
01988                       << "TrafficSuccessfulCall(P);"
01989                       << "TrafficSuccessfulCall(C);"
01990                       << "DefaultSuccessfulCall(P);"
01991                       << "DefaultSuccessfulCall(C);"
01992                       << "AbortSuccessfulCall(P);"
01993                       << "AbortSuccessfulCall(C);"
01994                       << "FailedCall(P);"
01995                       << "FailedCall(C);"
01996                       << "FailedCannotSendMessage(P);"
01997                       << "FailedCannotSendMessage(C);"
01998                       << "FailedMaxUDPRetrans(P);"
01999                       << "FailedMaxUDPRetrans(C);"
02000                       << "FailedUnexpectedMessage(P);"
02001                       << "FailedUnexpectedMessage(C);"
02002                       << "FailedCallRejected(P);"
02003                       << "FailedCallRejected(C);"
02004                       << "FailedCmdNotSent(P);"
02005                       << "FailedCmdNotSent(C);"
02006                       << "FailedRegexpDoesntMatch(P);"
02007                       << "FailedRegexpDoesntMatch(C);"
02008                       << "FailedRegexpHdrNotFound(P);"
02009                       << "FailedRegexpHdrNotFound(C);"
02010                       << "ResponseTime(P);"
02011                       << "ResponseTime(C);"
02012                       << "CallLength(P);"
02013                       << "CallLength(C);";
02014     (*m_outputStream) << sRepartitionHeader(m_ResponseTimeRepartition, m_SizeOfResponseTimeRepartition,
02015                                             (char*) "ResponseTimeRepartition");
02016     (*m_outputStream) << sRepartitionHeader(m_CallLengthRepartition, m_SizeOfCallLengthRepartition,
02017                                             (char*) "CallLengthRepartition");
02018     (*m_outputStream) << iostream_endl;
02019     m_headerAlreadyDisplayed = true;
02020   }
02021 
02022   // content
02023   (*m_outputStream) << formatTime(&m_startTime)               << ";";
02024   (*m_outputStream) << formatTime(&m_plStartTime)             << ";";
02025   (*m_outputStream) << formatTime(&currentTime)               << ";"
02026                     << msToHHMMSS(localElapsedTime)           << ";";
02027   (*m_outputStream) << msToHHMMSS(globalElapsedTime)          << ";"
02028                     << realInstantCallRate                    << ";"
02029                     << averageCallRate                        << ";"
02030                     << m_counters[CPT_PL_IncomingCallCreated] << ";"
02031                     << m_counters[CPT_C_IncomingCallCreated]  << ";"
02032                     << m_counters[CPT_PL_OutgoingCallCreated] << ";"
02033                     << m_counters[CPT_C_OutgoingCallCreated]  << ";"
02034                     << m_counters[CPT_C_IncomingCallCreated]+ 
02035                        m_counters[CPT_C_OutgoingCallCreated]  << ";"
02036                     << m_counters[CPT_C_CurrentCall]          << ";"
02037                     << m_counters[CPT_PL_InitSuccessfulCall]     << ";"
02038                     << m_counters[CPT_C_InitSuccessfulCall]      << ";"
02039                     << m_counters[CPT_PL_TrafficSuccessfulCall]     << ";"
02040                     << m_counters[CPT_C_TrafficSuccessfulCall]      << ";"
02041                     << m_counters[CPT_PL_DefaultSuccessfulCall]     << ";"
02042                     << m_counters[CPT_C_DefaultSuccessfulCall]      << ";"
02043                     << m_counters[CPT_PL_AbortSuccessfulCall]     << ";"
02044                     << m_counters[CPT_C_AbortSuccessfulCall]      << ";"
02045                     << m_counters[CPT_PL_FailedCall]          << ";"
02046                     << m_counters[CPT_C_FailedCall]           << ";"
02047                     << m_counters[CPT_PL_FailedCallCannotSendMessage]   << ";"
02048                     << m_counters[CPT_C_FailedCallCannotSendMessage]   << ";"
02049                     << m_counters[CPT_PL_FailedCallMaxUdpRetrans]   << ";"
02050                     << m_counters[CPT_C_FailedCallMaxUdpRetrans]   << ";"
02051                     << m_counters[CPT_PL_FailedCallUnexpectedMessage]   << ";"
02052                     << m_counters[CPT_C_FailedCallUnexpectedMessage]   << ";"
02053                     << m_counters[CPT_PL_FailedCallCallRejected]   << ";"
02054                     << m_counters[CPT_C_FailedCallCallRejected]   << ";"
02055                     << m_counters[CPT_PL_FailedCallCmdNotSent]   << ";"
02056                     << m_counters[CPT_C_FailedCallCmdNotSent]   << ";"
02057                     << m_counters[CPT_PL_FailedCallRegexpDoesntMatch]   << ";"
02058                     << m_counters[CPT_C_FailedCallRegexpDoesntMatch]   << ";"
02059                     << m_counters[CPT_PL_FailedCallRegexpHdrNotFound]   << ";"
02060                     << m_counters[CPT_C_FailedCallRegexpHdrNotFound]   << ";";
02061                     // SF917289 << m_counters[CPT_C_UnexpectedMessage]    << ";";
02062   (*m_outputStream) << msToHHMMSSmmm( m_counters [CPT_PL_AverageResponseTime] ) << ";";
02063   (*m_outputStream) << msToHHMMSSmmm( m_counters [CPT_C_AverageResponseTime ] ) << ";";
02064   (*m_outputStream) << msToHHMMSSmmm( m_counters [CPT_PL_AverageCallLength  ] ) << ";";
02065   (*m_outputStream) << msToHHMMSSmmm( m_counters [CPT_C_AverageCallLength   ] ) << ";";
02066   (*m_outputStream) << sRepartitionInfo(m_ResponseTimeRepartition, m_SizeOfResponseTimeRepartition);
02067   (*m_outputStream) << sRepartitionInfo(m_CallLengthRepartition, m_SizeOfCallLengthRepartition);
02068   (*m_outputStream) << iostream_endl;
02069 
02070   // flushing the output file to let the tail -f working !
02071   (*m_outputStream).flush();
02072 
02073 } /* end of logData () */

int C_GeneratorStats::init  
 

initialize the class variable member

Definition at line 74 of file C_GeneratorStats.cpp.

00075 {
00076   if (m_initDone == false) {
00077     // reset of all counter
00078     RESET_COUNTERS(m_counters);
00079     GET_TIME (&m_startTime);
00080     memcpy   (&m_pdStartTime, &m_startTime, sizeof (struct timeval));
00081     memcpy   (&m_plStartTime, &m_startTime, sizeof (struct timeval));
00082     m_outputStream = NULL;
00083     m_headerAlreadyDisplayed = false;
00084     m_initDone = true ;
00085 
00086     m_current_repartition_table = NULL ;
00087     m_current_display_rep_id = 0 ;
00088     m_nb_display_rep_id = 2 ;
00089     ALLOC_TABLE(m_current_repartition_table, 
00090                 T_DisplayRepFct*, 
00091                 sizeof(T_DisplayRepFct), 2);
00092 
00093     m_current_repartition_table[0] = &C_GeneratorStats::displayRepartition_without_percent ;
00094     m_current_repartition_table[1] = &C_GeneratorStats::displayRepartition_with_percent ;
00095     m_current_repartition_display = m_current_repartition_table[0];
00096   }
00097   return(1);
00098 }

C_GeneratorStats * C_GeneratorStats::instance   [static]
 

Get the single instance of the class.

Only one instance of C_GeneratorStats exists in the component. This instance is automatically created the first time the instance() method is called.

Returns:
the single instance of the C_GeneratorStats class.

Definition at line 34 of file C_GeneratorStats.cpp.

00035 {
00036    if (m_instance == NULL) {
00037      NEW_VAR(m_instance, C_GeneratorStats()) ;
00038    }
00039    return m_instance;
00040 }

void C_GeneratorStats::setRepartitionCallLength unsigned int *    repartition,
int    nombre
 

setRepartitionCallLength

  • set the unsigned int table passed in parameter as the repartition table for call length This is done by calling the initRepartition methode on the m_CallLengthRepartition variable
  • set the char* list of int (must be separeted with coma as the repartition table for call length This is done by calling the createIntegerTable to transform the char* list into unsigned int list. Then the initRepartition methode is call with the created unsigned int list and the m_CallLengthRepartition variable
setRepartitionResponseTime Same than setRepartitionCallLength with the variable m_ResponseTimeRepartition variable instead of m_CallLengthRepartition variable

Definition at line 299 of file C_GeneratorStats.cpp.

00300 {
00301   initRepartition(repartition, 
00302                   nombre, 
00303                   &m_CallLengthRepartition, 
00304                   &m_SizeOfCallLengthRepartition);
00305 } 


The documentation for this class was generated from the following files:
Generated on Wed Mar 7 14:44:59 2007 for Seagull by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002