Debian Codegraph @

Source/Reasoner/Kernel/Calculation/CConcurrentTaskCalculationEnvironment.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_REASONER_KERNEL_CALCULATION_CCONCURRENTTASKCALCULATIONENVIRONMENT_H
22 #define KONCLUDE_REASONER_KERNEL_CALCULATION_CCONCURRENTTASKCALCULATIONENVIRONMENT_H
23
24 // Libraries includes
25
26
27 // Namespace includes
28 #include "CCalculationEnviroment.h"
29
30 // Other includes
31 #include "Reasoner/Kernel/Task/CSatisfiableCalculationTaskJobCallbackExecuter.h"
32 #include "Reasoner/Kernel/Task/CSatisfiableCalculationTaskStatusPropagator.h"
33
34 #include "Scheduler/CSingleThreadTaskProcessorUnit.h"
35 #include "Scheduler/CTaskProcessorSchedulerThread.h"
36 #include "Scheduler/CTaskProcessorCompletorThread.h"
37 #include "Scheduler/CTaskProcessorThread.h"
38
39 #include "Utilities/Memory/CCentralizedAllocationLimitation.h"
40
41
42
43 // Logger includes
44 #include "Logger/CLogger.h"
45
46
47
48 namespace Konclude {
49
50 using namespace Scheduler;
51 using namespace Utilities::Memory;
52
53 namespace Reasoner {
54
55 namespace Kernel {
56
57 using namespace Task;
58
59 namespace Calculation {
60
61
62 /*!
63 *
64 * \class CConcurrentTaskCalculationEnvironment
65 * \author Andreas Steigmiller
66 * \version 0.1
67 * \brief TODO
68 *
69 */
70 class CConcurrentTaskCalculationEnvironment : public CCalculationEnviroment {
71 // public methods
72 public:
73 //! Constructor
74 CConcurrentTaskCalculationEnvironment();
75
76 //! Destructor
77 virtual ~CConcurrentTaskCalculationEnvironment();
78
79
80 CConcurrentTaskCalculationEnvironment* initSingleTaskProcessor(CSingleThreadTaskProcessorUnit* processUnit);
81 CConcurrentTaskCalculationEnvironment* initMultiTaskProcessor(CTaskProcessorSchedulerThread* schedulerUnit, CTaskProcessorCompletorThread* completorUnit);
82 CConcurrentTaskCalculationEnvironment* appendMultiTaskProcessor(CTaskProcessorThread* processorUnit);
83 CConcurrentTaskCalculationEnvironment* initCallbackExecuter(CSatisfiableCalculationTaskJobCallbackExecuter* callbackExecuter);
84 CConcurrentTaskCalculationEnvironment* initStatusPropagator(CSatisfiableCalculationTaskStatusPropagator* statusPropagator);
85
86 CSingleThreadTaskProcessorUnit* getSingleTaskProcessorUnit();
87 CTaskEventHandlerBasedScheduler* getSchedulerTaskProcessorUnit();
88 CTaskEventHandlerBasedCompletor* getCompletorTaskProcessorUnit();
89 QList<CTaskEventHandlerBasedProcessor*> getTaskProcessorUnitList();
90
91 CSatisfiableCalculationTaskJobCallbackExecuter* getSatisfiableCalculationTaskJobCallbackExecuter();
92 CSatisfiableCalculationTaskStatusPropagator* getSatisfiableCalculationTaskStatusPropagator();
93
94 CCentralizedAllocationLimitation* getAllocationLimitation();
95 CConcurrentTaskCalculationEnvironment* setAllocationLimitation(CCentralizedAllocationLimitation* allocationLimitation);
96
97
98 cint64 getCalculationComputionTime();
99 cint64 getCalculationBlockingTime();
100 cint64 getCalculationMemoryConsumption();
101 cint64 getCalculationMemoryReserved();
102
103 cint64 getCalculationStatisticTasksProcessedCount();
104 cint64 getCalculationStatisticTasksAddedCount();
105 cint64 getCalculationStatisticTasksCreatedCount();
106 cint64 getCalculationStatisticTasksCompletedCount();
107 cint64 getCalculationStatisticTasksUpdatedCount();
108 cint64 getCalculationStatisticEventsProcessedCount();
109 cint64 getCalculationStatisticTasksRequestedCount();
110 cint64 getCalculationStatisticThreadsBlockedCount();
111
112
113 double getCalculationApproximatedRemainingTasksCount();
114
115
116
117 // protected methods
118 protected:
119
120 // protected variables
121 protected:
122 CSingleThreadTaskProcessorUnit* mProcessUnit;
123 CTaskEventHandlerBasedScheduler* mSchedulerUnit;
124 CTaskEventHandlerBasedCompletor* mCompletorUnit;
125 QList<CTaskProcessorThreadBase*> mThreadUnitList;
126 QList<CTaskEventHandlerBasedProcessor*> mProcessorUnitList;
127 CSatisfiableCalculationTaskJobCallbackExecuter* mCallbackExecuter;
128 CSatisfiableCalculationTaskStatusPropagator* mStatusPropagator;
129
130 CCentralizedAllocationLimitation* mAllocationLimitation;
131
132 QVector<cint64> mTaskCreatedDepthCountVec;
133 QVector<cint64> mTaskProcessedDepthCountVec;
134 QVector<double> mTaskRelativeIncreaseTaskPerDepthVec;
135 QVector<double> mTaskTotalIncreaseTaskPerDepthVec;
136
137 // private methods
138 private:
139
140 // private variables
141 private:
142
143 };
144
145 }; // end namespace Calculation
146
147 }; // end namespace Kernel
148
149 }; // end namespace Reasoner
150
151 }; // end namespace Konclude
152
153 #endif // KONCLUDE_REASONER_KERNEL_CALCULATION_CCONCURRENTTASKCALCULATIONENVIRONMENT_H