Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
0c8da5af
Unverified
Commit
0c8da5af
authored
Mar 12, 2018
by
Don Gagne
Committed by
GitHub
Mar 12, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6193 from DonLakeFlyer/DebugParamCache
Add ParameterManagerDebugCacheFailureLog support
parents
bb3d1701
d5318d27
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
6 deletions
+50
-6
ParameterManager.cc
src/FactSystem/ParameterManager.cc
+42
-6
ParameterManager.h
src/FactSystem/ParameterManager.h
+8
-0
No files found.
src/FactSystem/ParameterManager.cc
View file @
0c8da5af
...
...
@@ -22,12 +22,9 @@
#include <QVariantAnimation>
#include <QJsonArray>
/* types for local parameter cache */
typedef
QPair
<
int
/* FactMetaData::ValueType_t */
,
QVariant
/* Fact::rawValue */
>
ParamTypeVal
;
typedef
QMap
<
QString
/* parameter name */
,
ParamTypeVal
>
CacheMapName2ParamTypeVal
;
QGC_LOGGING_CATEGORY
(
ParameterManagerVerbose1Log
,
"ParameterManagerVerbose1Log"
)
QGC_LOGGING_CATEGORY
(
ParameterManagerVerbose2Log
,
"ParameterManagerVerbose2Log"
)
QGC_LOGGING_CATEGORY
(
ParameterManagerVerbose1Log
,
"ParameterManagerVerbose1Log"
)
QGC_LOGGING_CATEGORY
(
ParameterManagerVerbose2Log
,
"ParameterManagerVerbose2Log"
)
QGC_LOGGING_CATEGORY
(
ParameterManagerDebugCacheFailureLog
,
"ParameterManagerDebugCacheFailureLog"
)
// Turn on to debug parameter cache crc misses
Fact
ParameterManager
::
_defaultFact
;
...
...
@@ -141,6 +138,24 @@ void ParameterManager::_parameterUpdate(int vehicleId, int componentId, QString
return
;
}
// Used to debug cache crc misses (turn on ParameterManagerDebugCacheFailureLog)
if
(
!
_initialLoadComplete
&&
!
_logReplay
&&
_debugCacheCRC
.
contains
(
componentId
)
&&
_debugCacheCRC
[
componentId
])
{
if
(
_debugCacheMap
[
componentId
].
contains
(
parameterName
))
{
const
ParamTypeVal
&
cacheParamTypeVal
=
_debugCacheMap
[
componentId
][
parameterName
];
size_t
dataSize
=
FactMetaData
::
typeToSize
(
static_cast
<
FactMetaData
::
ValueType_t
>
(
cacheParamTypeVal
.
first
));
const
void
*
cacheData
=
cacheParamTypeVal
.
second
.
constData
();
const
void
*
vehicleData
=
value
.
constData
();
if
(
memcmp
(
cacheData
,
vehicleData
,
dataSize
))
{
qDebug
()
<<
"Cache/Vehicle values differ for name:cache:actual"
<<
parameterName
<<
value
<<
cacheParamTypeVal
.
second
;
}
_debugCacheParamSeen
[
componentId
][
parameterName
]
=
true
;
}
else
{
qDebug
()
<<
"Parameter missing from cache"
<<
parameterName
;
}
}
_initialRequestTimeoutTimer
.
stop
();
_waitingParamTimeoutTimer
.
stop
();
...
...
@@ -854,6 +869,14 @@ void ParameterManager::_tryCacheHashLoad(int vehicleId, int componentId, QVarian
_parameterSetMajorVersion
=
-
1
;
_clearMetaData
();
qCInfo
(
ParameterManagerLog
)
<<
"Parameters cache match failed"
<<
qPrintable
(
QFileInfo
(
cacheFile
).
absoluteFilePath
());
if
(
ParameterManagerDebugCacheFailureLog
().
isDebugEnabled
())
{
_debugCacheCRC
[
componentId
]
=
true
;
_debugCacheMap
[
componentId
]
=
cacheMap
;
foreach
(
const
QString
&
name
,
cacheMap
.
keys
())
{
_debugCacheParamSeen
[
componentId
][
name
]
=
false
;
}
qgcApp
()
->
showMessage
(
tr
(
"Parameter cache CRC match failed"
));
}
}
}
...
...
@@ -1054,6 +1077,18 @@ void ParameterManager::_checkInitialLoadComplete(void)
// We aren't waiting for any more initial parameter updates, initial parameter loading is complete
_initialLoadComplete
=
true
;
// Parameter cache crc failure debugging
foreach
(
int
componentId
,
_debugCacheParamSeen
.
keys
())
{
if
(
!
_logReplay
&&
_debugCacheCRC
.
contains
(
componentId
)
&&
_debugCacheCRC
[
componentId
])
{
foreach
(
const
QString
&
paramName
,
_debugCacheParamSeen
[
componentId
].
keys
())
{
if
(
!
_debugCacheParamSeen
[
componentId
][
paramName
])
{
qDebug
()
<<
"Parameter in cache but not on vehicle componentId:Name"
<<
componentId
<<
paramName
;
}
}
}
}
_debugCacheCRC
.
clear
();
qCDebug
(
ParameterManagerLog
)
<<
_logVehiclePrefix
()
<<
"Initial load complete"
;
// Check for index based load failures
...
...
@@ -1367,6 +1402,7 @@ void ParameterManager::_loadOfflineEditingParams(void)
_setupCategoryMap
();
_parametersReady
=
true
;
_initialLoadComplete
=
true
;
_debugCacheCRC
.
clear
();
}
void
ParameterManager
::
saveToJson
(
int
componentId
,
const
QStringList
&
paramsToSave
,
QJsonObject
&
saveObject
)
...
...
src/FactSystem/ParameterManager.h
View file @
0c8da5af
...
...
@@ -30,6 +30,7 @@
Q_DECLARE_LOGGING_CATEGORY
(
ParameterManagerVerbose1Log
)
Q_DECLARE_LOGGING_CATEGORY
(
ParameterManagerVerbose2Log
)
Q_DECLARE_LOGGING_CATEGORY
(
ParameterManagerDebugCacheFailureLog
)
/// Connects to Parameter Manager to load/update Facts
class
ParameterManager
:
public
QObject
...
...
@@ -174,6 +175,13 @@ private:
int
_parameterSetMajorVersion
;
///< Version for parameter set, -1 if not known
QObject
*
_parameterMetaData
;
///< Opaque data from FirmwarePlugin::loadParameterMetaDataCall
typedef
QPair
<
int
/* FactMetaData::ValueType_t */
,
QVariant
/* Fact::rawValue */
>
ParamTypeVal
;
typedef
QMap
<
QString
/* parameter name */
,
ParamTypeVal
>
CacheMapName2ParamTypeVal
;
QMap
<
int
/* component id */
,
bool
>
_debugCacheCRC
;
///< true: debug cache crc failure
QMap
<
int
/* component id */
,
CacheMapName2ParamTypeVal
>
_debugCacheMap
;
QMap
<
int
/* component id */
,
QMap
<
QString
/* param name */
,
bool
/* seen */
>>
_debugCacheParamSeen
;
// Wait counts from previous parameter update cycle
int
_prevWaitingReadParamIndexCount
;
int
_prevWaitingReadParamNameCount
;
...
...
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