collect-proc-info-memory.sh (1079B)
1 #!/bin/bash 2 # This Source Code Form is subject to the terms of the Mozilla Public 3 # License, v. 2.0. If a copy of the MPL was not distributed with this 4 # file, You can obtain one at http://mozilla.org/MPL/2.0/. 5 source $1/common.sh 6 7 TEST_TIME=$2 8 9 # waiting for test start signal 10 while true; do 11 if [ -f $TESTING_DIR/test_start.signal ]; then 12 break 13 fi 14 done 15 16 collect_mem_at() { 17 echo "Collecting mem info at $1s" 18 TRIES=0 19 while 20 OUTPUT=$(adb shell dumpsys meminfo) 21 TRIES=$(($TRIES+1)) 22 [ -z "$OUTPUT" -a $TRIES -lt 5 ] 23 do true; done 24 echo "Finished collecting mem info for $1s" 25 echo "$OUTPUT" > $TESTING_DIR/mem_info_$2.txt 26 } 27 28 collect_resources_at() { 29 sleep $1 30 collect_mem_at $1 $2 31 } 32 33 collect_resources_info() { 34 collect_resources_at 0 "01" & # at start 35 collect_resources_at $(($TEST_TIME/10)) "02" & # at 10% 36 collect_resources_at $(($TEST_TIME/2)) "03" & # at 50% 37 collect_resources_at $TEST_TIME "04" # at test end 38 } 39 40 print_info "$1" & print_info_pid=$! 41 collect_resources_info 42 kill "$print_info_pid"