|
reSIProcate/stack
9694
|
00001 #ifndef RESIP_StatisticsMessage_hxx 00002 #define RESIP_StatisticsMessage_hxx 00003 00004 #include <iostream> 00005 #include "resip/stack/ApplicationMessage.hxx" 00006 #include "resip/stack/MethodTypes.hxx" 00007 #include "rutil/Mutex.hxx" 00008 #include "rutil/HeapInstanceCounter.hxx" 00009 00010 namespace resip 00011 { 00012 class Subsystem; 00013 00014 class StatisticsMessage : public ApplicationMessage 00015 { 00016 public: 00017 RESIP_HeapCount(StatisticsMessage); 00018 class AtomicPayload; 00019 StatisticsMessage(const AtomicPayload& payload); 00020 StatisticsMessage(const StatisticsMessage& rhs); 00021 00022 virtual ~StatisticsMessage(); 00023 00024 struct Payload 00025 { 00026 enum {MaxCode = 700}; 00027 00028 Payload(); 00029 00030 unsigned int tuFifoSize; 00031 unsigned int transportFifoSizeSum; 00032 unsigned int transactionFifoSize; 00033 unsigned int activeTimers; 00034 unsigned int openTcpConnections; // .dlb. not implemented 00035 unsigned int activeClientTransactions; 00036 unsigned int activeServerTransactions; 00037 unsigned int pendingDnsQueries; // .dlb. not implemented 00038 00039 unsigned int requestsSent; // includes retransmissions 00040 unsigned int responsesSent; // includes retransmissions 00041 unsigned int requestsRetransmitted; // counts each retransmission 00042 unsigned int responsesRetransmitted; // counts each retransmission 00043 unsigned int requestsReceived; 00044 unsigned int responsesReceived; 00045 00046 unsigned int responsesByCode[MaxCode]; 00047 00048 unsigned int requestsSentByMethod[MAX_METHODS]; 00049 unsigned int requestsRetransmittedByMethod[MAX_METHODS]; 00050 unsigned int requestsReceivedByMethod[MAX_METHODS]; 00051 unsigned int responsesSentByMethod[MAX_METHODS]; 00052 unsigned int responsesRetransmittedByMethod[MAX_METHODS]; 00053 unsigned int responsesReceivedByMethod[MAX_METHODS]; 00054 00055 unsigned int responsesSentByMethodByCode[MAX_METHODS][MaxCode]; 00056 unsigned int responsesRetransmittedByMethodByCode[MAX_METHODS][MaxCode]; 00057 unsigned int responsesReceivedByMethodByCode[MAX_METHODS][MaxCode]; 00058 00059 unsigned int sum2xxIn(MethodTypes method) const; 00060 unsigned int sumErrIn(MethodTypes method) const; 00061 unsigned int sum2xxOut(MethodTypes method) const; 00062 unsigned int sumErrOut(MethodTypes method) const; 00063 void zeroOut(); 00064 00065 Payload& operator=(const Payload& payload); 00066 }; 00067 00068 void loadOut(Payload& payload) const; 00069 static void logStats(const Subsystem& subsystem, const Payload& stats); 00070 00071 virtual EncodeStream& encode(EncodeStream& strm) const; 00072 virtual EncodeStream& encodeBrief(EncodeStream& str) const; 00073 00074 Message* clone() const; 00075 00076 class AtomicPayload : private Payload 00077 { 00078 public: 00079 AtomicPayload(); 00080 void loadIn(const Payload& payload); 00081 void loadOut(Payload& payload) const; 00082 private: 00083 mutable Mutex mMutex; 00084 00085 // dis-allowed by not implemented 00086 AtomicPayload(const AtomicPayload&); 00087 AtomicPayload& operator=(const AtomicPayload&); 00088 }; 00089 00090 private: 00091 const AtomicPayload& mPayload; 00092 friend EncodeStream& operator<<(EncodeStream& strm, const StatisticsMessage::Payload& stats); 00093 }; 00094 00095 EncodeStream& operator<<(EncodeStream& strm, const StatisticsMessage::Payload& stats); 00096 00097 } 00098 00099 #endif 00100 00101 /* ==================================================================== 00102 * The Vovida Software License, Version 1.0 00103 * 00104 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved. 00105 * 00106 * Redistribution and use in source and binary forms, with or without 00107 * modification, are permitted provided that the following conditions 00108 * are met: 00109 * 00110 * 1. Redistributions of source code must retain the above copyright 00111 * notice, this list of conditions and the following disclaimer. 00112 * 00113 * 2. Redistributions in binary form must reproduce the above copyright 00114 * notice, this list of conditions and the following disclaimer in 00115 * the documentation and/or other materials provided with the 00116 * distribution. 00117 * 00118 * 3. The names "VOCAL", "Vovida Open Communication Application Library", 00119 * and "Vovida Open Communication Application Library (VOCAL)" must 00120 * not be used to endorse or promote products derived from this 00121 * software without prior written permission. For written 00122 * permission, please contact vocal@vovida.org. 00123 * 00124 * 4. Products derived from this software may not be called "VOCAL", nor 00125 * may "VOCAL" appear in their name, without prior written 00126 * permission of Vovida Networks, Inc. 00127 * 00128 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED 00129 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00130 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND 00131 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA 00132 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES 00133 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, 00134 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00135 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00136 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 00137 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00138 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 00139 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 00140 * DAMAGE. 00141 * 00142 * ==================================================================== 00143 * 00144 * This software consists of voluntary contributions made by Vovida 00145 * Networks, Inc. and many individuals on behalf of Vovida Networks, 00146 * Inc. For more information on Vovida Networks, Inc., please see 00147 * <http://www.vovida.org/>. 00148 * 00149 */
1.7.5.1