hce-node application
1.4.3
HCE Hierarchical Cluster Engine node application
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
DRCEResourceMonitor.hpp
Go to the documentation of this file.
1
14
#ifndef DRCE_RESOURCE_MONITOR_HPP
15
#define DRCE_RESOURCE_MONITOR_HPP
16
17
#include <Poco/Thread.h>
18
#include <Poco/Mutex.h>
19
#include <string>
20
#include <map>
21
22
#include "
DRCEAsyncTasksQueue.hpp
"
23
#include "
DRCEStatVariables.hpp
"
24
#include "
DRCEAvgCounts.hpp
"
25
#include "
LoggerStream.hpp
"
26
27
namespace
HCE
28
{
29
namespace
drce
30
{
31
//-----------------------------------------------------------------------------
32
class
DRCEResourceMonitor
:
public
Poco::Runnable
33
{
34
enum
{DEFAULT_TIME_PERIOD=10000};
35
public
:
36
DRCEResourceMonitor
(
DRCEAsyncTasksQueue
& asyncTasksQueue_,
37
CustomMessage
& message_);
38
~DRCEResourceMonitor
(
void
);
39
40
void
run
(
void
);
41
42
void
terminate
(
void
);
43
bool
isTerminated
(
void
);
44
45
void
setTimePeriod
(
unsigned
int
timePeriod_);
46
unsigned
int
getTimePeriod
(
void
);
47
48
void
fillFieldsArray
(
DRCEResultData
& resultData);
49
static
void
fillFieldsArray
(
DRCEResultData
& resultData,
DRCEAsyncTasksQueue
& asyncTasksQueue_,
CustomMessage
& message_,
DRCEResourceMonitor
* pResourceMonitor=
nullptr
);
50
static
bool
fillFieldsArray
(
DRCEResultDataItem
& resultDataItem,
DRCEAsyncTasksQueue
& asyncTasksQueue_,
CustomMessage
& message_,
DRCEResourceMonitor
* pResourceMonitor=
nullptr
);
51
52
StatVariables
getStatVariables
(
void
);
53
54
void
dump
(
StatVariables
& statVariables,
AvgCounts
& avgCounts);
55
void
restore
(
const
StatVariables
& statVariables,
const
AvgCounts
& avgCounts);
56
57
void
addTimeAsyncTask
(
size_t
value);
58
void
addTimeSyncTask
(
size_t
value);
59
void
addSizeInputBufferSyncTasks
(
size_t
value);
60
void
addSizeInputBufferAsyncTasks
(
size_t
value);
61
void
addSizeOutputBufferSyncTasks
(
size_t
value);
62
void
addSizeOutputBufferAsyncTasks
(
size_t
value);
63
void
addCpuUsageAsyncTasks
(
double
value);
64
void
addMemoryUsageAsyncTasks
(
size_t
value);
65
void
addCountAsyncTasksForMinute
(
double
value);
66
void
addCountSyncTasksForMinute
(
double
value);
67
void
incrementCountSyncTasks
(
void
);
68
void
incrementCountAsyncTasks
(
void
);
69
void
incrementCountSyncTasksFail
(
void
);
70
void
incrementCountAsyncTasksFail
(
void
);
71
private
:
72
template
<
class
T>
void
addStatValue(T value,
StatVariableData<T>
& statVariableData,
size_t
& count);
73
void
countTasksForMinute(Poco::Timestamp& ts,
size_t
& countSyncTasks,
size_t
& countAsyncTasks);
74
StatVariables
recountStatVariables(
void
);
75
void
setStatVariables(
StatVariables
&& rhs);
76
private
:
77
Poco::Thread thread;
78
Poco::Mutex mutex;
79
volatile
bool
terminated;
80
unsigned
int
timePeriod;
81
82
DRCEAsyncTasksQueue
& asyncTasksQueue;
83
CustomMessage
& message;
84
StatVariables
statVariables;
85
StatVariables
counterStatVariables;
86
87
AvgCounts
avgCounts;
88
};
89
//-----------------------------------------------------------------------------
90
//-----------------------------------------------------------------------------
91
}
// end namespace drce
92
}
// end namespace HCE
93
94
#endif // DRCE_RESOURCE_MONITOR_HPP
sources
utils
DRCE
src
DRCEResourceMonitor.hpp
Generated on Tue Jun 30 2015 19:42:11 for hce-node application by
1.8.1.2