From 45c4d69332e52f760d6a22c86b83efb497424e55 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Tue, 21 Feb 2023 16:07:55 +0100 Subject: [PATCH] tools: add `tools/rpi_mem_usage.sh` script --- tools/rpi_mem_usage.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 tools/rpi_mem_usage.sh diff --git a/tools/rpi_mem_usage.sh b/tools/rpi_mem_usage.sh new file mode 100755 index 0000000..b8a3cd5 --- /dev/null +++ b/tools/rpi_mem_usage.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +get_mem() { + local mem=$(vcgencmd get_mem "$1" | cut -d= -f2) + shift + echo -e "$@\t\t$mem" +} + +( + get_mem arm "Total ARM" + get_mem gpu "Total GPU" + get_mem malloc_total "GPU Malloc" + get_mem malloc "GPU Malloc Free" + get_mem reloc_total "GPU Reloc" + get_mem reloc "GPU Reloc Free" + cat /sys/kernel/debug/vcsm-cma/state | grep "SIZE" | awk '{s+=$2} END {printf("CMA\t\t\t%.1fMB\n", s/1024/1024)}' +) + +echo "--------" +vcdbg reloc | sed -s 's/^/reloc: /' + +echo "--------" +vcdbg malloc | sed -s 's/^/maloc: /' +echo "--------" +cat /sys/kernel/debug/vcsm-cma/state | sed -s 's/^/cma: /' +echo "--------"