I want to get the average memory usage of some android app. All I want to do is to fetch only the memory usage. For example, below script provide instantaneous memory usage of mobile_cep
application
adb shell dumpsys meminfo | grep mobile_cep
gives output as
233,328K: org.carleton.iot.mobile_cep (pid 27060 / activities)
While I am interested in getting 233,328K
value. I want to repeat this process several times and get an average value for memory usage. I am using below script to print 233,328K
value.
#!/bin/bash
counter=1
while [ $counter -le 10 ]
do
((counter++))
val1=$(adb shell dumpsys meminfo | grep mobile_cep)
val2=$($val1 | grep -i '\d\d\d,\d\d\dK')
echo $val2
done
echo done
however, I am not getting the desired result. What am I doing wrong?