KVIrc  4.9.2
DeveloperAPIs
KviLagMeter.h
Go to the documentation of this file.
1 #ifndef _KVI_LAGMETER_H_
2 #define _KVI_LAGMETER_H_
3 //=============================================================================
4 //
5 // File : KviLagMeter.h
6 // Creation date : Fri Oct 18 13:30:26 CEST 1999 by Juanjo Álvarez
7 //
8 // This file is part of the KVIrc IRC client distribution
9 // Copyright (C) 1999 Juanjo Álvarez
10 // Copyright (C) 2002-2010 Szymon Stefanek (pragma at kvirc dot net)
11 //
12 // This program is FREE software. You can redistribute it and/or
13 // modify it under the terms of the GNU General Public License
14 // as published by the Free Software Foundation; either version 2
15 // of the License, or (at your option) any later version.
16 //
17 // This program is distributed in the HOPE that it will be USEFUL,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 // See the GNU General Public License for more details.
21 //
22 // You should have received a copy of the GNU General Public License
23 // along with this program. If not, write to the Free Software Foundation,
24 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 //
26 //=============================================================================
27 
28 #include "kvi_settings.h"
29 #include "KviCString.h"
30 #include "KviPointerList.h"
31 
32 #include <QObject>
33 
34 class KviIrcConnection;
35 
37 {
38 public:
40  long lSecs; // since epoch
41  long lUSecs;
42  unsigned int uReliability; // [0-100]
43 };
44 
45 class KVIRC_API KviLagMeter : public QObject
46 {
47  Q_OBJECT
48  friend class KviIrcConnection;
49 
50 protected:
52  ~KviLagMeter();
53 
54 protected:
56  unsigned int m_uLag; // last computed lag
57  unsigned int m_uLastEmittedLag; // last emitted lag
58  long m_tLastCompleted; // time when the last lag was completed (gettimeofday!)
59  unsigned int m_uLastReliability; // how much reliable was the last completed check ?
61  long m_tFirstOwnCheck; // time when the first ping after a completed check was sent
62  long m_tLastOwnCheck; // time when the last ping was sent
63  bool m_bOnAlarm;
64  bool * m_pDeletionSignal; // we use this to signal our own delete
65 public:
66  // lag checks should be done only against the user's server
67  // please make SURE that the key is unique!
68  void lagCheckRegister(const char * key, unsigned int uReliability = 50);
69  bool lagCheckComplete(const char * key);
70  void lagCheckAbort(const char * key);
71  unsigned int lag() { return m_uLag; };
72  unsigned int secondsSinceLastCompleted();
73 
74 protected:
75  virtual void timerEvent(QTimerEvent * e);
76 };
77 
78 #endif // _KVI_LAGMETER_H_
Definition: KviCString.h:105
long lSecs
Definition: KviLagMeter.h:40
#define KVIRC_API
Definition: kvi_settings.h:128
char s char s char s s s s s char char c s *s c s s s d c s *s d c d d d d c
Definition: KviIrcNumericCodes.h:391
long lUSecs
Definition: KviLagMeter.h:41
An abstraction of a connection to an IRC server.
Definition: KviIrcConnection.h:95
bool * m_pDeletionSignal
Definition: KviLagMeter.h:64
#define e
Definition: detector.cpp:69
unsigned int m_uLastEmittedLag
Definition: KviLagMeter.h:57
Definition: KviLagMeter.h:36
unsigned int lag()
Definition: KviLagMeter.h:71
bool m_bOnAlarm
Definition: KviLagMeter.h:63
KviPointerList< KviLagCheck > * m_pCheckList
Definition: KviLagMeter.h:60
KviCString szKey
Definition: KviLagMeter.h:39
unsigned int m_uLag
Definition: KviLagMeter.h:56
C++ Template based double linked pointer list class.
long m_tLastCompleted
Definition: KviLagMeter.h:58
KviIrcConnection * m_pConnection
Definition: KviLagMeter.h:55
unsigned int m_uLastReliability
Definition: KviLagMeter.h:59
Definition: KviLagMeter.h:45
long m_tLastOwnCheck
Definition: KviLagMeter.h:62
This file contains compile time settings.
long m_tFirstOwnCheck
Definition: KviLagMeter.h:61
unsigned int uReliability
Definition: KviLagMeter.h:42