Debian Codegraph @

Source/Test/Evaluation/CReasonerMemoryUsageCheckingThread.h

raw
1 /*
2 * Copyright (C) 2013-2015, 2019 by the Konclude Developer Team.
3 *
4 * This file is part of the reasoning system Konclude.
5 * For details and support, see <http://konclude.com/>.
6 *
7 * Konclude is free software: you can redistribute it and/or modify
8 * it under the terms of version 3 of the GNU Lesser General Public
9 * License (LGPLv3) as published by the Free Software Foundation.
10 *
11 * Konclude is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU (Lesser) General Public License for more details.
15 *
16 * You should have received a copy of the GNU (Lesser) General Public
17 * License along with Konclude. If not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20
21 #ifndef KONCLUDE_TEST_EVALUATION_CREASONERMEMORYUSAGECHECKINGTHREAD_H
22 #define KONCLUDE_TEST_EVALUATION_CREASONERMEMORYUSAGECHECKINGTHREAD_H
23
24 // Libraries includes
25 #include <QString>
26 #include <QProcess>
27
28
29 // Namespace includes
30 #include "EvaluationSettings.h"
31
32
33 // Other includes
34 #include "Config/CConfiguration.h"
35 #include "Config/CConfigDataReader.h"
36
37 #include "Concurrent/CIntervalThread.h"
38
39 #include "Test/Evaluation/Events/CReasonerMemoryUsageFinishedEvent.h"
40
41
42
43 // Logger includes
44 #include "Logger/CLogger.h"
45 #include "Logger/CLogIdentifier.h"
46
47
48
49 namespace Konclude {
50
51 using namespace Config;
52 using namespace Logger;
53 using namespace Concurrent;
54
55 namespace Test {
56
57 namespace Evaluation {
58
59 using namespace Evaluation::Events;
60
61
62 /*!
63 *
64 * \class CReasonerMemoryUsageCheckingThread
65 * \author Andreas Steigmiller
66 * \version 0.1
67 * \brief TODO
68 *
69 */
70 class CReasonerMemoryUsageCheckingThread : public CIntervalThread, public CLogIdentifier {
71
72 // public methods
73 public:
74 //! Constructor
75 CReasonerMemoryUsageCheckingThread(CConfiguration *config, QString processId);
76
77 //! Destructor
78 virtual ~CReasonerMemoryUsageCheckingThread();
79
80
81 virtual cint64 getMemoryUsage(bool stopChecking = true);
82
83
84 // protected methods
85 protected:
86 virtual bool processCustomsEvents(QEvent::Type type, CCustomEvent* event);
87
88 virtual void threadStarted();
89 virtual void threadStopped();
90
91 virtual bool processTimer(qint64 timerID);
92
93
94
95 void checkMemory();
96
97 // protected variables
98 protected:
99 CConfiguration* mConfig;
100
101 QString mProcessId;
102 QString mMemoryCheckingProgramm;
103
104 cint64 mMaxMemoryUsage;
105 bool mChecking;
106 bool mContinue;
107
108 cint64 mMemoryCheckingIntervall;
109
110 const cint64 MEMORY_CHECKING_TIMER = 1;
111
112 // private methods
113 private:
114
115 // private variables
116 private:
117
118 };
119
120 }; // end namespace Evaluation
121
122 }; // end namespace Test
123
124 }; // end namespace Konclude
125
126 #endif // KONCLUDE_TEST_EVALUATION_CREASONERMEMORYUSAGECHECKINGTHREAD_H