View Single Post
  #7   (View Single Post)  
Old 16th September 2009
tangram's Avatar
tangram tangram is offline
Real Name: Ricardo Jesus
Port Guard
 
Join Date: May 2008
Location: Portugal
Posts: 36
Default

Noticed that the output isn't correct, e.g. 0.0%: user | 0.0%: nice | 0.0%: system | 99.3%: interrupt | : idle.

The culprit is this part:
Code:
__freebsd() {
  top -s ${DELAY} -d 2 0  \
    | grep -m 1 CPU \
    | sed 's/,//g' \
    | awk '{ print $4": "$3" | "$6": "$5" | "$8": "$7" | "$10": "$9" | "$12": "$11 }'
  }
The fix is
Code:
__freebsd() {
  top -s ${DELAY} -d 2 0  \
    | grep -m 1 CPU \
    | sed 's/,//g' \
    | awk '{ print $2": "$3" | "$4": "$5" | "$6": "$7" | "$8": "$9" | "$10": "$11 }'
  }
__________________
BSD and Linux tips and tutorials: Blog Linux/BSD: sharing experiences
Reply With Quote