mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2026-09-10 08:39:29 +00:00
fix sd test app mem usage (#3101)
This commit is contained in:
@@ -91,7 +91,7 @@ class SDCardTestThread {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr File::Size write_size = 16384;
|
static constexpr File::Size write_size = 4096; // will call it 4 times
|
||||||
static constexpr File::Size bytes_to_write = 16 * 1024 * 1024;
|
static constexpr File::Size bytes_to_write = 16 * 1024 * 1024;
|
||||||
static constexpr File::Size bytes_to_read = bytes_to_write;
|
static constexpr File::Size bytes_to_read = bytes_to_write;
|
||||||
|
|
||||||
@@ -160,12 +160,14 @@ class SDCardTestThread {
|
|||||||
sizeof(*buffer.get()) / sizeof(lfsr_word_t));
|
sizeof(*buffer.get()) / sizeof(lfsr_word_t));
|
||||||
|
|
||||||
const halrtcnt_t write_start = halGetCounterValue();
|
const halrtcnt_t write_start = halGetCounterValue();
|
||||||
const auto result_write = file.write(buffer->data(), buffer->size());
|
for (uint8_t i = 0; i < 4; i++) {
|
||||||
if (result_write.is_error()) {
|
const auto result_write = file.write(buffer->data(), buffer->size());
|
||||||
break;
|
if (result_write.is_error()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
_stats.write_bytes += buffer->size();
|
||||||
}
|
}
|
||||||
const halrtcnt_t write_end = halGetCounterValue();
|
const halrtcnt_t write_end = halGetCounterValue();
|
||||||
_stats.write_bytes += buffer->size();
|
|
||||||
_stats.write_count++;
|
_stats.write_count++;
|
||||||
|
|
||||||
const halrtcnt_t write_duration = write_end - write_start;
|
const halrtcnt_t write_duration = write_end - write_start;
|
||||||
@@ -202,12 +204,14 @@ class SDCardTestThread {
|
|||||||
const halrtcnt_t test_start = halGetCounterValue();
|
const halrtcnt_t test_start = halGetCounterValue();
|
||||||
while (!chThdShouldTerminate() && (_stats.read_bytes < bytes_to_read)) {
|
while (!chThdShouldTerminate() && (_stats.read_bytes < bytes_to_read)) {
|
||||||
const halrtcnt_t read_start = halGetCounterValue();
|
const halrtcnt_t read_start = halGetCounterValue();
|
||||||
const auto result_read = file.read(buffer->data(), buffer->size());
|
for (uint8_t i = 0; i < 4; i++) {
|
||||||
if (result_read.is_error()) {
|
const auto result_read = file.read(buffer->data(), buffer->size());
|
||||||
break;
|
if (result_read.is_error()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
_stats.read_bytes += buffer->size();
|
||||||
}
|
}
|
||||||
const halrtcnt_t read_end = halGetCounterValue();
|
const halrtcnt_t read_end = halGetCounterValue();
|
||||||
_stats.read_bytes += buffer->size();
|
|
||||||
_stats.read_count++;
|
_stats.read_count++;
|
||||||
|
|
||||||
const halrtcnt_t read_duration = read_end - read_start;
|
const halrtcnt_t read_duration = read_end - read_start;
|
||||||
|
|||||||
Reference in New Issue
Block a user