From 002dd2203df7a6e777954af01e127e9e41a2afc0 Mon Sep 17 00:00:00 2001 From: Michiel Scholten Date: Sat, 5 Sep 2015 19:25:36 +0200 Subject: [PATCH] Handy script to get the real memory usage of a process --- bin/memused | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100755 bin/memused diff --git a/bin/memused b/bin/memused new file mode 100755 index 0000000..791bd76 --- /dev/null +++ b/bin/memused @@ -0,0 +1,9 @@ +#!/bin/bash +# Written by Alexander Löhner +# The Linux Counter Project + +if [[ "${1}" = "" ]]; then + echo "please add the name of the process as a parameter" + exit 1 +fi +echo "scale=2; `for i in $(pidof ${1}); do echo 0 $(awk '/Private/ {print \"+\", $2}' /proc/$i/smaps) | bc ; done | xargs | sed \"s/ / \+ /g\" | bc`/1000" | bc