Shadowrun: Awakened 29 September 2011 - Build 871
RakNetStatistics.h
Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 #ifndef __RAK_NET_STATISTICS_H
00011 #define __RAK_NET_STATISTICS_H
00012 
00013 #include "PacketPriority.h"
00014 #include "Export.h"
00015 #include "RakNetTypes.h"
00016 
00017 namespace RakNet
00018 {
00019 
00020 enum RNSPerSecondMetrics
00021 {
00023     USER_MESSAGE_BYTES_PUSHED,
00024 
00027     USER_MESSAGE_BYTES_SENT,
00028 
00030     USER_MESSAGE_BYTES_RESENT,
00031 
00033     USER_MESSAGE_BYTES_RECEIVED_PROCESSED,
00034 
00036     USER_MESSAGE_BYTES_RECEIVED_IGNORED,
00037 
00039     ACTUAL_BYTES_SENT,
00040 
00042     ACTUAL_BYTES_RECEIVED,
00043 
00045     RNS_PER_SECOND_METRICS_COUNT
00046 };
00047 
00051 struct RAK_DLL_EXPORT RakNetStatistics
00052 {
00054     uint64_t valueOverLastSecond[RNS_PER_SECOND_METRICS_COUNT];
00055 
00057     uint64_t runningTotal[RNS_PER_SECOND_METRICS_COUNT];
00058     
00061     RakNet::TimeUS connectionStartTime;
00062 
00065     bool isLimitedByCongestionControl;
00066 
00068     uint64_t BPSLimitByCongestionControl;
00069 
00071     bool isLimitedByOutgoingBandwidthLimit;
00072 
00074     uint64_t BPSLimitByOutgoingBandwidthLimit;
00075 
00077     unsigned int messageInSendBuffer[NUMBER_OF_PRIORITIES];
00078 
00080     double bytesInSendBuffer[NUMBER_OF_PRIORITIES];
00081 
00084     unsigned int messagesInResendBuffer;
00085 
00087     uint64_t bytesInResendBuffer;
00088 
00090     float packetlossLastSecond;
00091 
00093     float packetlossTotal;
00094 
00095     RakNetStatistics& operator +=(const RakNetStatistics& other)
00096     {
00097         unsigned i;
00098         for (i=0; i < NUMBER_OF_PRIORITIES; i++)
00099         {
00100             messageInSendBuffer[i]+=other.messageInSendBuffer[i];
00101             bytesInSendBuffer[i]+=other.bytesInSendBuffer[i];
00102         }
00103 
00104         for (i=0; i < RNS_PER_SECOND_METRICS_COUNT; i++)
00105         {
00106             valueOverLastSecond[i]+=other.valueOverLastSecond[i];
00107             runningTotal[i]+=other.runningTotal[i];
00108         }
00109 
00110         return *this;
00111     }
00112 };
00113 
00122 void RAK_DLL_EXPORT StatisticsToString( RakNetStatistics *s, char *buffer, int verbosityLevel );
00123 
00124 } // namespace RakNet
00125 
00126 #endif

Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.

GNU Lesser General Public License 3 Sourceforge.net