Skip to content

Commit

Permalink
add -h information
Browse files Browse the repository at this point in the history
  • Loading branch information
catscarlet committed Sep 28, 2015
1 parent 1a6ae4c commit 3114bb5
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions bash_cpustat.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash
_s=0
_a=0
sleep=1
#Simple output
simple_output(){
for (( i = 0; i < $NPROC; i++ )); do
Expand Down Expand Up @@ -31,8 +32,18 @@ done

do_help() {
cat <<EOF
A very simple cpu usage percentages monitor tools .simply calculate and output text of cpu usage percentages
Usage $0 [-a|-s|-h]
Options
-h: Print this messsage
-s: Print simple cpu usages
-a: Print all kinds of works of cpu usages
For more information , please refer to : https://github.com/catscarlet/cpustat
EOF
}

Expand Down Expand Up @@ -78,7 +89,7 @@ guest_nice_t1[$i]=${procstat_t1[10]}
#echo ${total_t1[$i]}
done

sleep 1
sleep $sleep

for (( i = 0; i < $NPROC; i++ )); do
((sedline=i+2))
Expand Down Expand Up @@ -114,7 +125,7 @@ for (( i = 0; i < $NPROC; i++ )); do
#echo ${total_subtracted[$i]}
done

[ "$1" = "" ] && _s=1
[ "$1" = "" ] && _s=1

if [ $_s = 1 ]; then
simple_output
Expand Down

0 comments on commit 3114bb5

Please sign in to comment.