Skip to content
Snippets Groups Projects
Commit 6e489aa1 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

Merge branch '5279-fix-listing-of-services' into 'master'

show consuming cpu processes with top and ps

See merge request !16
parents 329330b9 e75eb71b
No related branches found
No related tags found
1 merge request!16show consuming cpu processes with top and ps
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# 2022-03-09 v1.7 <axel.hahn@iml.unibe.ch> show most cpu intensive processes # 2022-03-09 v1.7 <axel.hahn@iml.unibe.ch> show most cpu intensive processes
# 2022-03-10 v1.8 <axel.hahn@iml.unibe.ch> add cli param -p; update help # 2022-03-10 v1.8 <axel.hahn@iml.unibe.ch> add cli param -p; update help
# 2022-03-22 v1.9 <axel.hahn@iml.unibe.ch> fix syntax error on 100% idle # 2022-03-22 v1.9 <axel.hahn@iml.unibe.ch> fix syntax error on 100% idle
# 2022-04-14 v1.10 <axel.hahn@iml.unibe.ch> show consuming cpu processes with top and ps
# ====================================================================== # ======================================================================
...@@ -155,8 +156,16 @@ echo "$plist" | grep "[0-9]" >/dev/null \ ...@@ -155,8 +156,16 @@ echo "$plist" | grep "[0-9]" >/dev/null \
typeset -i iUsed=$( echo $cpuNonIdle | cut -f 1 -d '.' ) typeset -i iUsed=$( echo $cpuNonIdle | cut -f 1 -d '.' )
if [ $iUsed -gt $iMinCpuUsageToShowProcesses ]; then if [ $iUsed -gt $iMinCpuUsageToShowProcesses ]; then
echo echo
echo "CPU usage is higher $iMinCpuUsageToShowProcesses percent ... showing most consuming processes:" echo "CPU usage is higher $iMinCpuUsageToShowProcesses percent ... showing most consuming processes"
echo "output of top :"
topout=$( top -b -n 1 -d 0.1 )
typeset -i iStart=$( echo "$topout" | grep -n "PID.*USER" | cut -f 1 -d ':' )
typeset -i iEnd=$iStart+5
echo "$topout" | sed -n "${iStart},${iEnd}p"
echo
echo "output of ps:"
ps aux | head -1; ps aux | sort -nrk 3,3 | head -n 5 ps aux | head -1; ps aux | sort -nrk 3,3 | head -n 5
echo
fi fi
echo " echo "
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment