|
reSIProcate/stack
9694
|
00001 #ifndef RESIP_StatisticsManager_hxx 00002 #define RESIP_StatisticsManager_hxx 00003 00004 #include "rutil/Timer.hxx" 00005 #include "rutil/Data.hxx" 00006 #include "resip/stack/StatisticsMessage.hxx" 00007 #include "resip/stack/StatisticsHandler.hxx" 00008 00009 namespace resip 00010 { 00011 class SipStack; 00012 class SipMessage; 00013 class TransactionController; 00014 00020 class StatisticsManager : public StatisticsMessage::Payload 00021 { 00022 public: 00023 // not implemented 00024 typedef enum 00025 { 00026 TransportFifoSize, 00027 TUFifoSize, 00028 ActiveTimers, 00029 OpenTcpConnections, 00030 ActiveClientTransactions, 00031 ActiveServerTransactions, 00032 PendingDnsQueries, 00033 StatsMemUsed 00034 } Measurement; 00035 00036 StatisticsManager(SipStack& stack, unsigned long intervalSecs=60); 00037 ~StatisticsManager(); 00038 00039 void process(); 00040 // not stricly thread-safe; needs to be called through the fifo somehow 00041 void setInterval(unsigned long intvSecs); 00042 00048 void setExternalStatsHandler(ExternalStatsHandler *handler) 00049 { 00050 mExternalHandler = handler; 00051 } 00052 00053 private: 00054 friend class TransactionState; 00055 bool sent(SipMessage* msg); 00056 bool retransmitted(MethodTypes type, bool request, unsigned int code); 00057 bool received(SipMessage* msg); 00058 00059 void poll(); // force an update 00060 00061 SipStack& mStack; 00062 UInt64 mInterval; 00063 UInt64 mNextPoll; 00064 00065 ExternalStatsHandler *mExternalHandler; 00066 // 00067 // When statistics are published, a copy of values are made 00068 // and copied into this member, and then reference to this is 00069 // published thru both ExternalHandler and posted to stack as message. 00070 // This payload is mutex protected. 00071 StatisticsMessage::AtomicPayload *mPublicPayload; 00072 }; 00073 00074 } 00075 00076 #endif 00077 00078 /* ==================================================================== 00079 * The Vovida Software License, Version 1.0 00080 * 00081 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved. 00082 * 00083 * Redistribution and use in source and binary forms, with or without 00084 * modification, are permitted provided that the following conditions 00085 * are met: 00086 * 00087 * 1. Redistributions of source code must retain the above copyright 00088 * notice, this list of conditions and the following disclaimer. 00089 * 00090 * 2. Redistributions in binary form must reproduce the above copyright 00091 * notice, this list of conditions and the following disclaimer in 00092 * the documentation and/or other materials provided with the 00093 * distribution. 00094 * 00095 * 3. The names "VOCAL", "Vovida Open Communication Application Library", 00096 * and "Vovida Open Communication Application Library (VOCAL)" must 00097 * not be used to endorse or promote products derived from this 00098 * software without prior written permission. For written 00099 * permission, please contact vocal@vovida.org. 00100 * 00101 * 4. Products derived from this software may not be called "VOCAL", nor 00102 * may "VOCAL" appear in their name, without prior written 00103 * permission of Vovida Networks, Inc. 00104 * 00105 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED 00106 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00107 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND 00108 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA 00109 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES 00110 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, 00111 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00112 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00113 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 00114 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00115 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 00116 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 00117 * DAMAGE. 00118 * 00119 * ==================================================================== 00120 * 00121 * This software consists of voluntary contributions made by Vovida 00122 * Networks, Inc. and many individuals on behalf of Vovida Networks, 00123 * Inc. For more information on Vovida Networks, Inc., please see 00124 * <http://www.vovida.org/>. 00125 * 00126 */
1.7.5.1