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
d5318d27
Commit
d5318d27
authored
6 years ago
by
DonLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ParameterManagerDebugCacheFailureLog support
Used to debug cache CRC misses.
parent
bb3d1701
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 @
d5318d27
...
@@ -22,12 +22,9 @@
...
@@ -22,12 +22,9 @@
#include <QVariantAnimation>
#include <QVariantAnimation>
#include <QJsonArray>
#include <QJsonArray>
/* types for local parameter cache */
QGC_LOGGING_CATEGORY
(
ParameterManagerVerbose1Log
,
"ParameterManagerVerbose1Log"
)
typedef
QPair
<
int
/* FactMetaData::ValueType_t */
,
QVariant
/* Fact::rawValue */
>
ParamTypeVal
;
QGC_LOGGING_CATEGORY
(
ParameterManagerVerbose2Log
,
"ParameterManagerVerbose2Log"
)
typedef
QMap
<
QString
/* parameter name */
,
ParamTypeVal
>
CacheMapName2ParamTypeVal
;
QGC_LOGGING_CATEGORY
(
ParameterManagerDebugCacheFailureLog
,
"ParameterManagerDebugCacheFailureLog"
)
// Turn on to debug parameter cache crc misses
QGC_LOGGING_CATEGORY
(
ParameterManagerVerbose1Log
,
"ParameterManagerVerbose1Log"
)
QGC_LOGGING_CATEGORY
(
ParameterManagerVerbose2Log
,
"ParameterManagerVerbose2Log"
)
Fact
ParameterManager
::
_defaultFact
;
Fact
ParameterManager
::
_defaultFact
;
...
@@ -141,6 +138,24 @@ void ParameterManager::_parameterUpdate(int vehicleId, int componentId, QString
...
@@ -141,6 +138,24 @@ void ParameterManager::_parameterUpdate(int vehicleId, int componentId, QString
return
;
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
();
_initialRequestTimeoutTimer
.
stop
();
_waitingParamTimeoutTimer
.
stop
();
_waitingParamTimeoutTimer
.
stop
();
...
@@ -854,6 +869,14 @@ void ParameterManager::_tryCacheHashLoad(int vehicleId, int componentId, QVarian
...
@@ -854,6 +869,14 @@ void ParameterManager::_tryCacheHashLoad(int vehicleId, int componentId, QVarian
_parameterSetMajorVersion
=
-
1
;
_parameterSetMajorVersion
=
-
1
;
_clearMetaData
();
_clearMetaData
();
qCInfo
(
ParameterManagerLog
)
<<
"Parameters cache match failed"
<<
qPrintable
(
QFileInfo
(
cacheFile
).
absoluteFilePath
());
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)
...
@@ -1054,6 +1077,18 @@ void ParameterManager::_checkInitialLoadComplete(void)
// We aren't waiting for any more initial parameter updates, initial parameter loading is complete
// We aren't waiting for any more initial parameter updates, initial parameter loading is complete
_initialLoadComplete
=
true
;
_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"
;
qCDebug
(
ParameterManagerLog
)
<<
_logVehiclePrefix
()
<<
"Initial load complete"
;
// Check for index based load failures
// Check for index based load failures
...
@@ -1367,6 +1402,7 @@ void ParameterManager::_loadOfflineEditingParams(void)
...
@@ -1367,6 +1402,7 @@ void ParameterManager::_loadOfflineEditingParams(void)
_setupCategoryMap
();
_setupCategoryMap
();
_parametersReady
=
true
;
_parametersReady
=
true
;
_initialLoadComplete
=
true
;
_initialLoadComplete
=
true
;
_debugCacheCRC
.
clear
();
}
}
void
ParameterManager
::
saveToJson
(
int
componentId
,
const
QStringList
&
paramsToSave
,
QJsonObject
&
saveObject
)
void
ParameterManager
::
saveToJson
(
int
componentId
,
const
QStringList
&
paramsToSave
,
QJsonObject
&
saveObject
)
...
...
This diff is collapsed.
Click to expand it.
src/FactSystem/ParameterManager.h
View file @
d5318d27
...
@@ -30,6 +30,7 @@
...
@@ -30,6 +30,7 @@
Q_DECLARE_LOGGING_CATEGORY
(
ParameterManagerVerbose1Log
)
Q_DECLARE_LOGGING_CATEGORY
(
ParameterManagerVerbose1Log
)
Q_DECLARE_LOGGING_CATEGORY
(
ParameterManagerVerbose2Log
)
Q_DECLARE_LOGGING_CATEGORY
(
ParameterManagerVerbose2Log
)
Q_DECLARE_LOGGING_CATEGORY
(
ParameterManagerDebugCacheFailureLog
)
/// Connects to Parameter Manager to load/update Facts
/// Connects to Parameter Manager to load/update Facts
class
ParameterManager
:
public
QObject
class
ParameterManager
:
public
QObject
...
@@ -174,6 +175,13 @@ private:
...
@@ -174,6 +175,13 @@ private:
int
_parameterSetMajorVersion
;
///< Version for parameter set, -1 if not known
int
_parameterSetMajorVersion
;
///< Version for parameter set, -1 if not known
QObject
*
_parameterMetaData
;
///< Opaque data from FirmwarePlugin::loadParameterMetaDataCall
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
// Wait counts from previous parameter update cycle
int
_prevWaitingReadParamIndexCount
;
int
_prevWaitingReadParamIndexCount
;
int
_prevWaitingReadParamNameCount
;
int
_prevWaitingReadParamNameCount
;
...
...
This diff is collapsed.
Click to expand it.
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