• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2# Copyright (c) 2021 Huawei Device Co., Ltd.
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15set -e
16
17pid=$(pidof $1)
18interval=1
19log_file="./usb_proclog.txt"
20cat /dev/null > $log_file
21while true
22do
23cat /proc/${pid}/status | grep -e VmRSS >> $log_file
24cpu=$(top -n 1 -p ${pid} | head -6 | tail -1 | cut -F 10)
25echo "Cpu:" $cpu >> $log_file
26cat /proc/${pid}/status | grep -e Threads >> $log_file
27sleep $interval
28done