reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
StatisticsMessage.hxx
Go to the documentation of this file.
1#ifndef RESIP_StatisticsMessage_hxx
2#define RESIP_StatisticsMessage_hxx
3
4#include <iostream>
7#include "rutil/Mutex.hxx"
9
10namespace resip
11{
12class Subsystem;
13
15{
16 public:
18 class AtomicPayload;
19 StatisticsMessage(const AtomicPayload& payload);
21
22 virtual ~StatisticsMessage();
23
24 struct Payload
25 {
26 enum {MaxCode = 700};
27
28 Payload();
29
30 unsigned int tuFifoSize;
32 unsigned int transactionFifoSize;
33 unsigned int activeTimers;
34 unsigned int openTcpConnections; // .dlb. not implemented
37 unsigned int pendingDnsQueries; // .dlb. not implemented
38
39 unsigned int requestsSent; // includes retransmissions
40 unsigned int responsesSent; // includes retransmissions
41 unsigned int requestsRetransmitted; // counts each retransmission
42 unsigned int responsesRetransmitted; // counts each retransmission
43 unsigned int requestsReceived;
44 unsigned int responsesReceived;
45
46 unsigned int responsesByCode[MaxCode];
47
54
58
59 unsigned int sum2xxIn(MethodTypes method) const;
60 unsigned int sumErrIn(MethodTypes method) const;
61 unsigned int sum2xxOut(MethodTypes method) const;
62 unsigned int sumErrOut(MethodTypes method) const;
63 void zeroOut();
64
65 Payload& operator=(const Payload& payload);
66 };
67
68 void loadOut(Payload& payload) const;
69 static void logStats(const Subsystem& subsystem, const Payload& stats);
70
71 virtual EncodeStream& encode(EncodeStream& strm) const;
72 virtual EncodeStream& encodeBrief(EncodeStream& str) const;
73
74 Message* clone() const;
75
76 class AtomicPayload : private Payload
77 {
78 public:
80 void loadIn(const Payload& payload);
81 void loadOut(Payload& payload) const;
82 private:
83 mutable Mutex mMutex;
84
85 // dis-allowed by not implemented
87 AtomicPayload& operator=(const AtomicPayload&);
88 };
89
90 private:
91 const AtomicPayload& mPayload;
93};
94
96
97}
98
99#endif
100
101/* ====================================================================
102 * The Vovida Software License, Version 1.0
103 *
104 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
105 *
106 * Redistribution and use in source and binary forms, with or without
107 * modification, are permitted provided that the following conditions
108 * are met:
109 *
110 * 1. Redistributions of source code must retain the above copyright
111 * notice, this list of conditions and the following disclaimer.
112 *
113 * 2. Redistributions in binary form must reproduce the above copyright
114 * notice, this list of conditions and the following disclaimer in
115 * the documentation and/or other materials provided with the
116 * distribution.
117 *
118 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
119 * and "Vovida Open Communication Application Library (VOCAL)" must
120 * not be used to endorse or promote products derived from this
121 * software without prior written permission. For written
122 * permission, please contact vocal@vovida.org.
123 *
124 * 4. Products derived from this software may not be called "VOCAL", nor
125 * may "VOCAL" appear in their name, without prior written
126 * permission of Vovida Networks, Inc.
127 *
128 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
129 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
130 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
131 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
132 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
133 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
134 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
135 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
136 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
137 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
138 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
139 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
140 * DAMAGE.
141 *
142 * ====================================================================
143 *
144 * This software consists of voluntary contributions made by Vovida
145 * Networks, Inc. and many individuals on behalf of Vovida Networks,
146 * Inc. For more information on Vovida Networks, Inc., please see
147 * <http://www.vovida.org/>.
148 *
149 */
A base-class for messages used by applications.
The base-class used for message-passing.
Definition Message.hxx:21
virtual EncodeStream & encodeBrief(EncodeStream &str) const
output a brief description to stream
void loadOut(Payload &payload) const
static void logStats(const Subsystem &subsystem, const Payload &stats)
RESIP_HeapCount(StatisticsMessage)
virtual EncodeStream & encode(EncodeStream &strm) const
output the entire message to stream
friend EncodeStream & operator<<(EncodeStream &strm, const StatisticsMessage::Payload &stats)
Class used to specify what sub-system given sections of code belong to, for use by the logging system...
Definition Subsystem.hxx:34
dcm! – add UnusedChecking(_enum) below;
std::mutex Mutex
A semaphore that can be locked by only one thread at a time.
Definition Mutex.hxx:37
@ MAX_METHODS
EncodeStream & operator<<(EncodeStream &strm, const BaseException &e)
#define EncodeStream
unsigned int responsesSentByMethod[MAX_METHODS]
unsigned int sum2xxOut(MethodTypes method) const
unsigned int responsesSentByMethodByCode[MAX_METHODS][MaxCode]
unsigned int requestsSentByMethod[MAX_METHODS]
unsigned int responsesRetransmittedByMethod[MAX_METHODS]
unsigned int sum2xxIn(MethodTypes method) const
unsigned int responsesReceivedByMethodByCode[MAX_METHODS][MaxCode]
unsigned int requestsRetransmittedByMethod[MAX_METHODS]
unsigned int responsesRetransmittedByMethodByCode[MAX_METHODS][MaxCode]
unsigned int sumErrIn(MethodTypes method) const
Payload & operator=(const Payload &payload)
unsigned int sumErrOut(MethodTypes method) const
unsigned int requestsReceivedByMethod[MAX_METHODS]
unsigned int responsesReceivedByMethod[MAX_METHODS]
void list()
Definition userAdmin.cxx:66