mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-22 07:44:03 -04:00
DataFlash: added a perf counter for microSD overruns
this allows us to tell if a microSD can handle a high logging rate
This commit is contained in:
parent
03b5305837
commit
2dfe3cb844
@ -68,7 +68,8 @@ DataFlash_File::DataFlash_File(const char *log_directory) :
|
||||
#if CONFIG_HAL_BOARD == HAL_BOARD_PX4 || CONFIG_HAL_BOARD == HAL_BOARD_VRBRAIN
|
||||
,_perf_write(perf_alloc(PC_ELAPSED, "DF_write")),
|
||||
_perf_fsync(perf_alloc(PC_ELAPSED, "DF_fsync")),
|
||||
_perf_errors(perf_alloc(PC_COUNT, "DF_errors"))
|
||||
_perf_errors(perf_alloc(PC_COUNT, "DF_errors")),
|
||||
_perf_overruns(perf_alloc(PC_COUNT, "DF_overruns"))
|
||||
#endif
|
||||
{}
|
||||
|
||||
@ -194,6 +195,7 @@ void DataFlash_File::WriteBlock(const void *pBuffer, uint16_t size)
|
||||
uint16_t space = BUF_SPACE(_writebuf);
|
||||
if (space < size) {
|
||||
// discard the whole write, to keep the log consistent
|
||||
perf_count(_perf_overruns);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -648,10 +650,10 @@ void DataFlash_File::_io_timer(void)
|
||||
chunk, ensuring the directory entry is updated after each
|
||||
write.
|
||||
*/
|
||||
BUF_ADVANCEHEAD(_writebuf, nwritten);
|
||||
#if CONFIG_HAL_BOARD != HAL_BOARD_AVR_SITL && CONFIG_HAL_BOARD_SUBTYPE != HAL_BOARD_SUBTYPE_LINUX_NONE
|
||||
::fsync(_write_fd);
|
||||
#endif
|
||||
BUF_ADVANCEHEAD(_writebuf, nwritten);
|
||||
}
|
||||
perf_end(_perf_write);
|
||||
}
|
||||
|
@ -89,6 +89,7 @@ private:
|
||||
perf_counter_t _perf_write;
|
||||
perf_counter_t _perf_fsync;
|
||||
perf_counter_t _perf_errors;
|
||||
perf_counter_t _perf_overruns;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user