mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-26 01:15:37 +00:00
Get rid of a magic value in benchmark.c
Also update its value while at it. Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
This commit is contained in:
parent
5408f72027
commit
49e7a951da
|
@ -133,6 +133,16 @@ do { \
|
||||||
|
|
||||||
#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) && defined(MBEDTLS_MEMORY_DEBUG)
|
#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) && defined(MBEDTLS_MEMORY_DEBUG)
|
||||||
|
|
||||||
|
/* How much space to reserve for the title when printing heap usage results.
|
||||||
|
* Updated manually as the output of the following command:
|
||||||
|
*
|
||||||
|
* sed -n 's/.*[T]IME_PUBLIC.*"\(.*\)",/\1/p' programs/test/benchmark.c |
|
||||||
|
* awk '{print length+2}' | sort -rn | head -n1
|
||||||
|
*
|
||||||
|
* This computes the maximum length of a title +2 (because we appends "/s").
|
||||||
|
* (If the value is too small, the only consequence is poor alignement.) */
|
||||||
|
#define TITLE_SPACE 11
|
||||||
|
|
||||||
#define MEMORY_MEASURE_INIT \
|
#define MEMORY_MEASURE_INIT \
|
||||||
size_t max_used, max_blocks, max_bytes; \
|
size_t max_used, max_blocks, max_bytes; \
|
||||||
size_t prv_used, prv_blocks; \
|
size_t prv_used, prv_blocks; \
|
||||||
|
@ -141,8 +151,8 @@ do { \
|
||||||
|
|
||||||
#define MEMORY_MEASURE_PRINT( title_len ) \
|
#define MEMORY_MEASURE_PRINT( title_len ) \
|
||||||
mbedtls_memory_buffer_alloc_max_get( &max_used, &max_blocks ); \
|
mbedtls_memory_buffer_alloc_max_get( &max_used, &max_blocks ); \
|
||||||
for( ii = 12 > (title_len) ? 12 - (title_len) : 1; ii !=0; ii--) \
|
ii = TITLE_SPACE > (title_len) ? TITLE_SPACE - (title_len) : 1; \
|
||||||
mbedtls_printf( " " ); \
|
while( ii-- ) mbedtls_printf( " " ); \
|
||||||
max_used -= prv_used; \
|
max_used -= prv_used; \
|
||||||
max_blocks -= prv_blocks; \
|
max_blocks -= prv_blocks; \
|
||||||
max_bytes = max_used + MEM_BLOCK_OVERHEAD * max_blocks; \
|
max_bytes = max_used + MEM_BLOCK_OVERHEAD * max_blocks; \
|
||||||
|
|
Loading…
Reference in a new issue