refactor logger: add an enum for the reason of printing the cpu load

This commit is contained in:
Beat Küng
2018-05-03 10:54:56 +02:00
committed by Lorenz Meier
parent 2f553b956d
commit 9b72080ec1
2 changed files with 30 additions and 15 deletions

View File

@@ -161,6 +161,12 @@ public:
private:
enum class PrintLoadReason {
Preflight,
Postflight,
Watchdog
};
/**
* Write an ADD_LOGGED_MSG to the log for a all current subscriptions and instances
*/
@@ -297,12 +303,12 @@ private:
/**
* initialize the output for the process load, so that ~1 second later it will be written to the log
*/
void initialize_load_output();
void initialize_load_output(PrintLoadReason reason);
/**
* write the process load, which was previously initialized with initialize_load_output()
*/
void write_load_output(bool preflight);
void write_load_output();
static constexpr size_t MAX_TOPICS_NUM = 64; /**< Maximum number of logged topics */
@@ -344,6 +350,7 @@ private:
will be stopped after load printing */
print_load_s _load{}; ///< process load data
hrt_abstime _next_load_print{0}; ///< timestamp when to print the process load
PrintLoadReason _print_load_reason;
// control
param_t _sdlog_profile_handle{PARAM_INVALID};