forked from Archive/PX4-Autopilot
refactor LogWriter: remove friend class Logger and use the public interface
This commit is contained in:
parent
dde96dd4d7
commit
04f301619f
|
@ -13,7 +13,6 @@ namespace logger
|
|||
|
||||
class LogWriter
|
||||
{
|
||||
friend class Logger;
|
||||
public:
|
||||
LogWriter(size_t buffer_size);
|
||||
~LogWriter();
|
||||
|
@ -59,6 +58,16 @@ public:
|
|||
return _total_written;
|
||||
}
|
||||
|
||||
size_t get_buffer_size() const
|
||||
{
|
||||
return _buffer_size;
|
||||
}
|
||||
|
||||
size_t get_buffer_fill_count() const
|
||||
{
|
||||
return _count;
|
||||
}
|
||||
|
||||
private:
|
||||
static void *run_helper(void *);
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ void Logger::status()
|
|||
|
||||
PX4_INFO("Wrote %4.2f MiB (avg %5.2f KiB/s)", (double)mebibytes, (double)(kibibytes / seconds));
|
||||
PX4_INFO("Dropouts: %zu (max len: %.3f s), max used buffer: %zu / %zu B",
|
||||
_write_dropouts, (double)_max_dropout_duration, _high_water, _writer._buffer_size);
|
||||
_write_dropouts, (double)_max_dropout_duration, _high_water, _writer.get_buffer_size());
|
||||
_high_water = 0;
|
||||
_max_dropout_duration = 0.f;
|
||||
}
|
||||
|
@ -555,8 +555,8 @@ void Logger::run()
|
|||
msg_id++;
|
||||
}
|
||||
|
||||
if (!_dropout_start && _writer._count > _high_water) {
|
||||
_high_water = _writer._count;
|
||||
if (!_dropout_start && _writer.get_buffer_fill_count() > _high_water) {
|
||||
_high_water = _writer.get_buffer_fill_count();
|
||||
}
|
||||
|
||||
/* release the log buffer */
|
||||
|
|
Loading…
Reference in New Issue