1#!/bin/sh 2################################################################################ 3# 4# Copyright (C) 2022 Huawei Device Co., Ltd. 5# SPDX-License-Identifier: GPL-2.0 6# 7# Unless required by applicable law or agreed to in writing, software 8# distributed under the License is distributed on an "AS IS" BASIS, 9# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10# See the License for the specific language governing permissions and 11# limitations under the License. 12# 13################################################################################ 14# File: rss_monitor01.sh 15# 16# Description: Verify /proc/pid/rss take effect 17# 18# Authors: Liu Ke - liuke94@huawei.com 19# 20# History: Sep 20 2022 - init scripts 21# 22################################################################################ 23source tst_oh.sh 24 25do_setup() 26{ 27 zcat /proc/config.gz | grep CONFIG_RSS_THRESHOLD=y || tst_res TCONF "CONFIG_RSS_THRESHOLD=y not satisfied!" 28} 29 30do_test() 31{ 32 local ret=0 33 34 tst_res TINFO "Start to verify rss ." 35 flag=0 36 while (($flag < 1)) 37 do 38 pid=$(ps -ef | grep com.ohos.systemui | awk 'NR==1 {print $2}') 39 rss=$(cat /proc/$pid/rss | awk -F ':' '{print$2}'| awk '{print$1}') 40 statusVMRss=$(cat /proc/$pid/status | grep VmRSS | awk -F ':' '{print$2}' | awk '{print$1}') 41 if [ "$rss"x = "$statusVMRss"x ]; then 42 tst_res TPASS "rss info correct." 43 flag=1 44 else 45 flag=0 46 fi 47 done 48 49 50} 51 52do_clean() 53{ 54 55} 56 57do_setup 58do_test 59do_clean 60tst_exit 61