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
4e6cdf9a
Commit
4e6cdf9a
authored
Sep 08, 2016
by
Michael Ott
Browse files
Fix detection of outdated sensorcache entries
parent
7a60595f
Changes
1
Hide whitespace changes
Inline
Side-by-side
CollectAgent/sensorcache.cpp
View file @
4e6cdf9a
...
...
@@ -51,13 +51,17 @@ uint64_t SensorCache::getSensor(SensorId sid) {
}
if
(
it
->
second
.
deltaT
.
size
())
{
uint64_t
ts
=
Messaging
::
calculateTimestamp
()
/
1000000
;
uint64_t
ts
=
Messaging
::
calculateTimestamp
();
uint64_t
avg
=
0
;
for
(
std
::
list
<
uint32_t
>::
iterator
dt
=
it
->
second
.
deltaT
.
begin
();
dt
!=
it
->
second
.
deltaT
.
end
();
dt
++
)
{
avg
+=
*
dt
;
}
avg
/=
it
->
second
.
deltaT
.
size
();
if
((
ts
-
it
->
second
.
timestamp
)
>
5
*
avg
)
{
/*
* A SID is outdated if it's older than 5x the average sampling period.
* The 1000000 accounts for the conversion ns->ms in deltaT.
*/
if
((
ts
-
it
->
second
.
timestamp
)
>
5
*
1000000
*
avg
)
{
throw
std
::
out_of_range
(
"Sid outdated"
);
}
}
...
...
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