SLikeNet 0.1.3

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
statistics.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21
22 #ifndef __RAK_NET_STATISTICS_H
23 #define __RAK_NET_STATISTICS_H
24
25 #include "PacketPriority.h"
26 #include "Export.h"
27 #include "types.h"
28
29 namespace SLNet
30 {
31
32 enum RNSPerSecondMetrics
33 {
35 USER_MESSAGE_BYTES_PUSHED,
36
39 USER_MESSAGE_BYTES_SENT,
40
42 USER_MESSAGE_BYTES_RESENT,
43
45 USER_MESSAGE_BYTES_RECEIVED_PROCESSED,
46
48 USER_MESSAGE_BYTES_RECEIVED_IGNORED,
49
51 ACTUAL_BYTES_SENT,
52
54 ACTUAL_BYTES_RECEIVED,
55
57 RNS_PER_SECOND_METRICS_COUNT
58 };
59
63 struct RAK_DLL_EXPORT RakNetStatistics
64 {
66 uint64_t valueOverLastSecond[RNS_PER_SECOND_METRICS_COUNT];
67
69 uint64_t runningTotal[RNS_PER_SECOND_METRICS_COUNT];
70
73 SLNet::TimeUS connectionStartTime;
74
77 bool isLimitedByCongestionControl;
78
80 uint64_t BPSLimitByCongestionControl;
81
83 bool isLimitedByOutgoingBandwidthLimit;
84
86 uint64_t BPSLimitByOutgoingBandwidthLimit;
87
89 unsigned int messageInSendBuffer[NUMBER_OF_PRIORITIES];
90
92 double bytesInSendBuffer[NUMBER_OF_PRIORITIES];
93
96 unsigned int messagesInResendBuffer;
97
99 uint64_t bytesInResendBuffer;
100
102 float packetlossLastSecond;
103
105 float packetlossTotal;
106
107 RakNetStatistics& operator +=(const RakNetStatistics& other)
108 {
109 unsigned i;
110 for (i=0; i < NUMBER_OF_PRIORITIES; i++)
111 {
112 messageInSendBuffer[i]+=other.messageInSendBuffer[i];
113 bytesInSendBuffer[i]+=other.bytesInSendBuffer[i];
114 }
115
116 for (i=0; i < RNS_PER_SECOND_METRICS_COUNT; i++)
117 {
118 valueOverLastSecond[i]+=other.valueOverLastSecond[i];
119 runningTotal[i]+=other.runningTotal[i];
120 }
121
122 return *this;
123 }
124 };
125
135 void RAK_DLL_EXPORT StatisticsToString(RakNetStatistics *s, char *buffer, int verbosityLevel);
136 void RAK_DLL_EXPORT StatisticsToString( RakNetStatistics *s, char *buffer, size_t bufferLength, int verbosityLevel );
137
138 } // namespace SLNet
139
140 #endif