logging: Add strdup current use to shell cmd
Add the number of strdup buffers currently in use to the `log strdup_utilization` shell command. Signed-off-by: Andrew Hedin <andrew.hedin@lairdconnect.com>
This commit is contained in:
parent
185545e9f4
commit
b52ad8f3e1
3 changed files with 16 additions and 0 deletions
|
@ -376,11 +376,15 @@ static int cmd_log_strdup_utilization(const struct shell *shell,
|
|||
#define CONFIG_LOG_STRDUP_MAX_STRING 0
|
||||
#endif
|
||||
|
||||
uint32_t cur_cnt = log_get_strdup_pool_current_utilization();
|
||||
uint32_t buf_cnt = log_get_strdup_pool_utilization();
|
||||
uint32_t buf_size = log_get_strdup_longest_string();
|
||||
uint32_t percent = CONFIG_LOG_STRDUP_BUF_COUNT ?
|
||||
buf_cnt * 100U / CONFIG_LOG_STRDUP_BUF_COUNT : 0U;
|
||||
|
||||
shell_print(shell, "Current utilization of the buffer pool: %d.",
|
||||
cur_cnt);
|
||||
|
||||
shell_print(shell,
|
||||
"Maximal utilization of the buffer pool: %d / %d (%d %%).",
|
||||
buf_cnt, CONFIG_LOG_STRDUP_BUF_COUNT, percent);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue