36 #include <px4_platform_common/defines.h> 80 void start_log(
LogType type,
const char *filename);
87 int write_message(
LogType type,
void *ptr,
size_t size, uint64_t dropout_start = 0);
91 pthread_mutex_lock(&_mtx);
96 pthread_mutex_unlock(&_mtx);
101 pthread_cond_broadcast(&_cv);
106 return _buffers[(int)type].total_written();
111 return _buffers[(int)type].buffer_size();
116 return _buffers[(int)type].count();
121 _need_reliable_transfer = need_reliable;
126 return _need_reliable_transfer;
132 static void *run_helper(
void *);
142 int hardfault_store_filename(
const char *log_file);
147 int write(
LogType type,
void *ptr,
size_t size, uint64_t dropout_start);
150 static constexpr
size_t _min_write_chunk = 4096;
159 bool start_log(
const char *filename);
163 size_t get_read_ptr(
void **ptr,
bool *is_part);
168 inline void write_no_check(
void *ptr,
size_t size);
174 inline ssize_t write_to_file(
const void *buffer,
size_t size,
bool call_fsync)
const;
176 inline void fsync()
const;
184 bool _should_run =
false;
189 uint8_t *_buffer =
nullptr;
192 size_t _total_written = 0;
199 bool _exit_thread =
false;
200 bool _need_reliable_transfer =
false;
203 pthread_t _thread = 0;
size_t get_total_written(LogType type) const
static unsigned long _count
LogType
Defines different log (file) types.
reduced mission log (e.g. for geotagging)
High-resolution timer with callouts and timekeeping.
bool need_reliable_transfer() const
size_t buffer_size() const
void init()
Activates/configures the hardware registers.
const size_t _buffer_size
Writes logging data to a file.
size_t get_buffer_size(LogType type) const
size_t get_buffer_fill_count(LogType type) const
bool is_started(LogType type) const
static void write(bootloader_app_shared_t *pshared)
void set_need_reliable_transfer(bool need_reliable)
pthread_t thread_id() const
size_t total_written() const
const char * log_type_str(LogType type)
perf_counter_t _perf_fsync
perf_counter_t _perf_write
Performance measuring tools.