logging: Add common api for getting memory usage

Logging v2 did not support getting memory usage data. Adding this
support by creating common api for getting current and maximum
usage. Tracking of maximum usage is optional and can be enabled
using CONFIG_LOG_MEM_UTILIZATION.

Updated shell command to use common API.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
Krzysztof Chruscinski 2022-02-07 14:36:36 +01:00 committed by Anas Nashif
commit 81ce6db313
6 changed files with 103 additions and 18 deletions

View file

@ -53,4 +53,13 @@ config LOG2_FMT_SECTION
removing strings from final binary and should be used for dictionary
logging.
config LOG_MEM_UTILIZATION
bool "Enable tracking maximum memory utilization"
depends on LOG_MODE_DEFERRED
default y if LOG_CMDS
select MEM_SLAB_TRACE_MAX_UTILIZATION if LOG1
help
When enabled, maximum usage of memory used for log messages in deferred
mode is tracked. It can be used to trim LOG_BUFFER_SIZE.
endmenu