New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bring in class LogListHelper into MavlinkLogHandler #14452
bring in class LogListHelper into MavlinkLogHandler #14452
Conversation
@bkueng, can you review? |
@@ -105,15 +65,42 @@ class MavlinkLogHandler | |||
unsigned get_size(); | |||
|
|||
private: | |||
enum class LOG_HANDLER_STATE { | |||
INACTIVE, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you clarify the difference between idle and inactive? Maybe use more descriptive names?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bkueng I tried not to change the logic too much, not for now. so INACTIVE is similar to the case that the LogListHelper has not been created.
I added notes, and I know its a bit confusing, but without wider changes I don't want to change it much more.
this is in order to avoid dynamic allocation of LogListHelper when downloading logs. LOG_HANDLER_STATE::INACTIVE state is the state to indicate that the behavior of LogListHelper not exists
fixed function name _close_and_ulink_files() to _close_and_unlink_files()
@bkueng thanks for the review, I have made changes. and rebased. |
661d538
to
1fdc8a8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, almost good to go.
I assume you tested this?
@bkueng Changes done according to your notes, thanks. |
this is followup to 'return with error from _log_request_list() in case of failed allocation #14451'
Describe problem solved by this pull request
The class LogListHelper created and destroyed dynamically during logs download process. which mean some
new
anddelete
built in in MavlinkLogHandler code. the existence of the class then checked, to decide the state of the downloader.This PR remove the dynamic allocation. to ensure enough memory on creation of MavlinkLogHandler (meaning, creation of mavlink instance)
Describe your solution
The class LogListHelper removed, all its functions and variants moved into MavlinkLogHandler and created when MavlinkLogHandler allocated.
LOG_HANDLER_STATE::INACTIVE state is the state to indicate that the behavior as if LogListHelper not exists
Describe possible alternatives
question:
now, on every creation of mavlink a MavlinkLogHandler allocated, with an about extra 150 bytes.
most of this memory is _current_log_filename[128].
661d538#diff-e56b8d1bc66526d6f124b0bf662f02fdR105
is that acceptable?
it can be done that only _current_log_filename[] will be malloc dynamically, only if process of download is initiated.
Test data / coverage
tested proper behavior on FMUv5, download speed hasn't been changed and still ~330kBps
Additional context
more improvements can be done to the module. the commits that done keep the exact same behavior. and according to the response about this change, I can do more small/big fix on the process of downloading logs.