diff --git a/src/crc32.c b/src/crc32.c index 99ca9215195..0762ceda489 100644 --- a/src/crc32.c +++ b/src/crc32.c @@ -132,7 +132,14 @@ bool generic_crc32(target_s *const target, uint32_t *const result, const uint32_ for (size_t i = 0; i < read_len; i++) crc = crc32_calc(crc, bytes[i]); } - DEBUG_WARN("%" PRIu32 " ms\n", platform_time_ms() - start_time); +#if ENABLE_DEBUG == 1 + const uint32_t end_time = platform_time_ms(); + if (len > 512U) { + const uint32_t speed = len * 1000U / (end_time - start_time) / 1024U; + DEBUG_INFO("%s: len = %" PRIu32 ": %" PRIu32 " KiB/s,\t", __func__, (uint32_t)len, speed); + } + DEBUG_INFO("%" PRIu32 " ms\n", end_time - start_time); +#endif *result = crc; return true; } @@ -149,6 +156,9 @@ bool stm32_crc32(target_s *const target, uint32_t *const result, const uint32_t CRC_CR |= CRC_CR_RESET; +#if ENABLE_DEBUG == 1 + const uint32_t start_time = platform_time_ms(); +#endif uint32_t last_time = platform_time_ms(); const size_t adjusted_len = len & ~3U; for (size_t offset = 0; offset < adjusted_len; offset += sizeof(bytes)) { @@ -185,6 +195,14 @@ bool stm32_crc32(target_s *const target, uint32_t *const result, const uint32_t } } } +#if ENABLE_DEBUG == 1 + const uint32_t end_time = platform_time_ms(); + if (len > 512U) { + const uint32_t speed = len * 1000U / (end_time - start_time) / 1024U; + DEBUG_INFO("%s: len = %" PRIu32 ": %" PRIu32 " KiB/s,\t", __func__, (uint32_t)len, speed); + } + DEBUG_INFO("%" PRIu32 " ms\n", end_time - start_time); +#endif *result = crc; return true; }