Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
dcdb
dcdb
Commits
f384aa77
Commit
f384aa77
authored
Feb 28, 2020
by
Michael Ott
Browse files
Add getMsgRate() functions to SensorGroupInterface and OperatorInterface
parent
d5e7f10c
Changes
4
Hide whitespace changes
Inline
Side-by-side
analytics/includes/OperatorInterface.h
View file @
f384aa77
...
...
@@ -226,7 +226,15 @@ public:
*/
virtual
void
clearUnits
()
=
0
;
/**
/**
* @brief Returns the number of messages this operator will
* generate per second
*
* This method must be implemented in derived classes.
*/
virtual
float
getMsgRate
()
=
0
;
/**
* @brief Performs an on-demand compute task
*
* Unlike the protected computeAsync and compute methods, computeOnDemand allows to interactively
...
...
analytics/includes/OperatorTemplate.h
View file @
f384aa77
...
...
@@ -201,10 +201,23 @@ public:
virtual
void
releaseUnits
()
override
{}
/**
* @brief Clears all the units contained in this operator
*/
* @brief Clears all the units contained in this operator
*/
virtual
void
clearUnits
()
override
{
_units
.
clear
();
_baseUnits
.
clear
();
_unitID
=
-
1
;
}
/**
* @brief Returns the number of messages this operator will
* generate per second
*
* @return Messages/s
*/
virtual
float
getMsgRate
()
override
{
float
msgRate
=
0
;
for
(
const
auto
&
u
:
_units
)
{
msgRate
+=
(
float
)
u
->
getBaseOutputs
().
size
()
*
(
1000.0
f
/
(
float
)
_interval
)
/
(
float
)
_minValue
;
}
return
msgRate
;
}
/**
* @brief Initializes this operator
...
...
dcdbpusher/MQTTPusher.cpp
View file @
f384aa77
...
...
@@ -315,22 +315,13 @@ void MQTTPusher::computeMsgRate() {
bool
dynWarning
=
false
;
for
(
auto
&
p
:
_plugins
)
{
for
(
const
auto
&
g
:
p
.
configurator
->
getSensorGroups
())
{
for
(
const
auto
&
s
:
g
->
acquireSensors
())
{
if
(
s
->
getSubsampling
()
>
0
)
msgRate
+=
(
1000.0
f
/
(
float
)
g
->
getInterval
())
/
((
float
)
g
->
getMinValues
()
*
s
->
getSubsampling
());
}
g
->
releaseSensors
();
msgRate
+=
g
->
getMsgRate
();
}
}
for
(
auto
&
p
:
_operatorPlugins
)
for
(
const
auto
&
op
:
p
.
configurator
->
getOperators
())
{
if
(
op
->
getStreaming
()
&&
!
op
->
getDynamic
())
{
for
(
const
auto
&
u
:
op
->
getUnits
())
for
(
const
auto
&
s
:
u
->
getBaseOutputs
())
{
if
(
s
->
getSubsampling
()
>
0
)
msgRate
+=
(
1000.0
f
/
(
float
)
op
->
getInterval
())
/
((
float
)
op
->
getMinValues
()
*
s
->
getSubsampling
());
}
op
->
releaseUnits
();
msgRate
+=
op
->
getMsgRate
();
}
else
if
(
op
->
getDynamic
())
dynWarning
=
true
;
}
...
...
dcdbpusher/includes/SensorGroupInterface.h
View file @
f384aa77
...
...
@@ -192,6 +192,16 @@ class SensorGroupInterface {
virtual
void
releaseSensors
()
{
/* do nothing in base implementation */
}
/**
* @brief Compute message rate of this group.
*
* @details Computes the message rate based on number of message, interval
* and minValues
*
* @return The message rate in messages/s.
*/
virtual
float
getMsgRate
()
{
return
(
float
)
_baseSensors
.
size
()
*
(
1000.0
f
/
(
float
)
_interval
)
/
(
float
)
_minValues
;
}
/**
* @brief Print interface configuration.
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment