From 5f18f9bbba75025eaff128e7f8778e2b896061dd Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Thu, 7 Jul 2016 10:09:06 +0200 Subject: [PATCH] sdlog2: select MIN < MAX bytes to write Previously, the MAX and MIN were both 512 meaning that usually it would start writing at > 512 bytes but only write 512 bytes which results in a 512 bytes write shortly followed by a e.g. 30 bytes write. Also, performance (measured in missed poll updates) seems slightly better on Snapdragon with bigger chunks. --- src/modules/sdlog2/sdlog2.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/modules/sdlog2/sdlog2.c b/src/modules/sdlog2/sdlog2.c index 1f282d4787..af4cacceed 100644 --- a/src/modules/sdlog2/sdlog2.c +++ b/src/modules/sdlog2/sdlog2.c @@ -144,8 +144,14 @@ static bool logwriter_should_exit = false; /**< Logwriter thread exit flag */ static const unsigned MAX_NO_LOGFOLDER = 999; /**< Maximum number of log dirs */ static const unsigned MAX_NO_LOGFILE = 999; /**< Maximum number of log files */ static const int LOG_BUFFER_SIZE_DEFAULT = 8192; + +#if defined __PX4_POSIX +static const int MAX_WRITE_CHUNK = 2048; +static const int MIN_BYTES_TO_WRITE = 256; +#else static const int MAX_WRITE_CHUNK = 512; -static const int MIN_BYTES_TO_WRITE = 512; +static const int MIN_BYTES_TO_WRITE = 256; +#endif static bool _extended_logging = false; static bool _gpstime_only = false;