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
1412cb1a
Commit
1412cb1a
authored
Jan 03, 2011
by
pixhawk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Speeded up logfile compression from quadratic to near-linear complexity
parent
38941da9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
2 deletions
+30
-2
LogCompressor.cc
src/LogCompressor.cc
+30
-2
No files found.
src/LogCompressor.cc
View file @
1412cb1a
...
...
@@ -125,7 +125,9 @@ void LogCompressor::run()
file
.
reset
();
QTextStream
data
(
&
file
);
int
linecounter
=
0
;
while
(
!
data
.
atEnd
())
{
quint64
lastTimeIndex
=
0
;
while
(
!
data
.
atEnd
())
{
linecounter
++
;
currentDataLine
=
linecounter
;
QString
line
=
data
.
readLine
();
...
...
@@ -140,7 +142,33 @@ void LogCompressor::run()
value
=
"NaN"
;
}
// Get matching output line
quint64
index
=
times
->
indexOf
(
time
);
// Constraining the search area might result in not finding a key,
// but it significantly reduces the time needed for the search
// setting a window of 1000 entries means that a 1 Hz data point
// can still be located
int
offsetLimit
=
200
;
quint64
offset
;
quint64
index
=
-
1
;
while
(
index
==
-
1
)
{
if
(
lastTimeIndex
>
offsetLimit
)
{
offset
=
lastTimeIndex
-
offsetLimit
;
}
else
{
offset
=
0
;
}
quint64
index
=
times
->
indexOf
(
time
,
offset
);
if
(
index
==
-
1
)
{
qDebug
()
<<
"INDEX NOT FOUND DURING LOGFILE PROCESSING, RESTARTING SEARCH"
;
// FIXME Reset and start without offset heuristic again
offsetLimit
+=
1000
;
}
}
lastTimeIndex
=
index
;
QString
outLine
=
outLines
->
at
(
index
);
QStringList
outParts
=
outLine
.
split
(
separator
);
// Replace measurement placeholder with current value
...
...
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