Mixe for Privacy and Anonymity in the Internet
CALogPacketStats.hpp
Go to the documentation of this file.
00001 /*
00002 Copyright (c) 2000, The JAP-Team 
00003 All rights reserved.
00004 Redistribution and use in source and binary forms, with or without modification, 
00005 are permitted provided that the following conditions are met:
00006 
00007   - Redistributions of source code must retain the above copyright notice, 
00008     this list of conditions and the following disclaimer.
00009 
00010   - Redistributions in binary form must reproduce the above copyright notice, 
00011     this list of conditions and the following disclaimer in the documentation and/or 
00012     other materials provided with the distribution.
00013 
00014   - Neither the name of the University of Technology Dresden, Germany nor the names of its contributors 
00015     may be used to endorse or promote products derived from this software without specific 
00016     prior written permission. 
00017 
00018   
00019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS 
00020 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 
00021 AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
00022 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00023 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 
00024 OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 
00025 IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 
00026 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
00027 */
00028 #if !defined(__CA_LOG_PACKET_TIMES__)
00029 #define __CA_LOG_PACKET_TIMES__
00030 
00031 #ifndef ONLY_LOCAL_PROXY
00032 
00033 #include "CAMutex.hpp"
00034 #include "CAThread.hpp"
00035 
00036 #ifdef LOG_PACKET_TIMES
00037 
00038 class CALogPacketStats
00039   {
00040     public:
00041       CALogPacketStats()
00042         {
00043           m_pthreadLog=NULL;
00044           m_iLogIntervallInHalfMinutes=30;
00045           resetTimeingStats();
00046         }
00047 
00048       ~CALogPacketStats()
00049         {
00050           stop();
00051         }
00052 
00053       SINT32 setLogIntervallInMinutes(UINT32 minutes)
00054         {
00055           m_iLogIntervallInHalfMinutes=minutes<<1;
00056           return E_SUCCESS;
00057         }
00058 
00059       SINT32 start();
00060       SINT32 stop();
00061       SINT32 addToTimeingStats( const tQueueEntry& oQueueEntry,
00062                                 UINT32 uType,bool bUpstream);
00063       SINT32 resetTimeingStats();
00064       SINT32 logTimeingStats();
00065     
00066     private:
00067       CAMutex m_csTimeingStats;
00068       UINT32 m_iLogIntervallInHalfMinutes;
00069       UINT32 m_timingMaxDataPacketUpstream,m_timingMaxDataPacketDownStream;
00070       UINT32 m_timingMinDataPacketUpstream,m_timingMinDataPacketDownStream;
00071       UINT32 m_timingCountDataPacketsUpstream,m_timingCountDataPacketsDownStream;
00072       UINT64 m_timingSumDataPacketUpstream,m_timingSumDataPacketDownStream;
00073       UINT32 m_timingMaxClosePacketUpstream;
00074       UINT32 m_timingMinClosePacketUpstream;
00075       UINT32 m_timingCountClosePacketsUpstream;
00076       UINT64 m_timingSumClosePacketUpstream;
00077       UINT32 m_timingMaxOpenPacketUpstream,m_timingMinOpenPacketUpstream;
00078       UINT32 m_timingCountOpenPacketsUpstream;
00079       UINT64 m_timingSumOpenPacketUpstream;
00080 
00081       //OP means "only proccessing" (without send or queueing times)
00082       UINT32 m_timingMaxDataPacketUpstreamOP,m_timingMaxDataPacketDownStreamOP;
00083       UINT32 m_timingMinDataPacketUpstreamOP,m_timingMinDataPacketDownStreamOP;
00084       UINT64 m_timingSumDataPacketUpstreamOP,m_timingSumDataPacketDownStreamOP;
00085       UINT32 m_timingMaxClosePacketUpstreamOP;
00086       UINT32 m_timingMinClosePacketUpstreamOP;
00087       UINT64 m_timingSumClosePacketUpstreamOP;
00088       UINT32 m_timingMaxOpenPacketUpstreamOP,m_timingMinOpenPacketUpstreamOP;
00089       UINT64 m_timingSumOpenPacketUpstreamOP;
00090 
00091       #ifdef USE_POOL
00092         UINT32 m_timingMaxPoolPacketUpstream,m_timingMaxPoolPacketDownStream;
00093         UINT32 m_timingMinPoolPacketUpstream,m_timingMinPoolPacketDownStream;
00094         UINT32 m_timingCountPoolPacketsUpstream;
00095         UINT64 m_timingSumPoolPacketUpstream;
00096         UINT32 m_timingCountPoolPacketsDownStream;
00097         UINT64 m_timingSumPoolPacketDownStream;
00098       #endif
00099       friend THREAD_RETURN  loopLogPacketStats(void*);
00100       volatile bool         m_bRunLog;
00101       CAThread*             m_pthreadLog;
00102   };
00103 #endif //ONLY_LOCAL_PROXY
00104 #endif
00105 #endif