Mixe for Privacy and Anonymity in the Internet
CALogPacketStats.hpp
Go to the documentation of this file.
1 /*
2 Copyright (c) 2000, The JAP-Team
3 All rights reserved.
4 Redistribution and use in source and binary forms, with or without modification,
5 are permitted provided that the following conditions are met:
6 
7  - Redistributions of source code must retain the above copyright notice,
8  this list of conditions and the following disclaimer.
9 
10  - Redistributions in binary form must reproduce the above copyright notice,
11  this list of conditions and the following disclaimer in the documentation and/or
12  other materials provided with the distribution.
13 
14  - Neither the name of the University of Technology Dresden, Germany nor the names of its contributors
15  may be used to endorse or promote products derived from this software without specific
16  prior written permission.
17 
18 
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
20 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
21 AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
22 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
24 OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25 IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
27 */
28 #if !defined(__CA_LOG_PACKET_TIMES__)
29 #define __CA_LOG_PACKET_TIMES__
30 
31 #ifndef ONLY_LOCAL_PROXY
32 
33 #include "CAMutex.hpp"
34 #include "CAThread.hpp"
35 
36 #ifdef LOG_PACKET_TIMES
37 
38 class CALogPacketStats
39  {
40  public:
41  CALogPacketStats()
42  {
43  m_pthreadLog=NULL;
44  m_iLogIntervallInHalfMinutes=30;
45  resetTimeingStats();
46  }
47 
48  ~CALogPacketStats()
49  {
50  stop();
51  }
52 
53  SINT32 setLogIntervallInMinutes(UINT32 minutes)
54  {
55  m_iLogIntervallInHalfMinutes=minutes<<1;
56  return E_SUCCESS;
57  }
58 
59  SINT32 start();
60  SINT32 stop();
61  SINT32 addToTimeingStats( const tQueueEntry& oQueueEntry,
62  UINT32 uType,bool bUpstream);
63  SINT32 resetTimeingStats();
64  SINT32 logTimeingStats();
65 
66  private:
67  CAMutex m_csTimeingStats;
68  UINT32 m_iLogIntervallInHalfMinutes;
69  UINT32 m_timingMaxDataPacketUpstream,m_timingMaxDataPacketDownStream;
70  UINT32 m_timingMinDataPacketUpstream,m_timingMinDataPacketDownStream;
71  UINT32 m_timingCountDataPacketsUpstream,m_timingCountDataPacketsDownStream;
72  UINT64 m_timingSumDataPacketUpstream,m_timingSumDataPacketDownStream;
73  UINT32 m_timingMaxClosePacketUpstream;
74  UINT32 m_timingMinClosePacketUpstream;
75  UINT32 m_timingCountClosePacketsUpstream;
76  UINT64 m_timingSumClosePacketUpstream;
77  UINT32 m_timingMaxOpenPacketUpstream,m_timingMinOpenPacketUpstream;
78  UINT32 m_timingCountOpenPacketsUpstream;
79  UINT64 m_timingSumOpenPacketUpstream;
80 
81  //OP means "only proccessing" (without send or queueing times)
82  UINT32 m_timingMaxDataPacketUpstreamOP,m_timingMaxDataPacketDownStreamOP;
83  UINT32 m_timingMinDataPacketUpstreamOP,m_timingMinDataPacketDownStreamOP;
84  UINT64 m_timingSumDataPacketUpstreamOP,m_timingSumDataPacketDownStreamOP;
85  UINT32 m_timingMaxClosePacketUpstreamOP;
86  UINT32 m_timingMinClosePacketUpstreamOP;
87  UINT64 m_timingSumClosePacketUpstreamOP;
88  UINT32 m_timingMaxOpenPacketUpstreamOP,m_timingMinOpenPacketUpstreamOP;
89  UINT64 m_timingSumOpenPacketUpstreamOP;
90 
91  #ifdef USE_POOL
92  UINT32 m_timingMaxPoolPacketUpstream,m_timingMaxPoolPacketDownStream;
93  UINT32 m_timingMinPoolPacketUpstream,m_timingMinPoolPacketDownStream;
94  UINT32 m_timingCountPoolPacketsUpstream;
95  UINT64 m_timingSumPoolPacketUpstream;
96  UINT32 m_timingCountPoolPacketsDownStream;
97  UINT64 m_timingSumPoolPacketDownStream;
98  #endif
99  friend THREAD_RETURN loopLogPacketStats(void*);
100  volatile bool m_bRunLog;
101  CAThread* m_pthreadLog;
102  };
103 #endif //ONLY_LOCAL_PROXY
104 #endif
105 #endif
#define THREAD_RETURN
Definition: StdAfx.h:540
signed int SINT32
Definition: basetypedefs.h:132
unsigned int UINT32
Definition: basetypedefs.h:131
const SINT32 E_SUCCESS
Definition: errorcodes.hpp:2
Definition: typedefs.hpp:169