@@ -2679,7 +2679,7 @@ collect_processes_psutil() {
2679
2679
2680
2680
pid_history[${pid} ]=" 1"
2681
2681
2682
- # * Create small graphs for all visible processes using more than 1% cpu time
2682
+ # * Create small graphs for all visible processes using more than 1% rounded cpu time
2683
2683
pid_graph=" pid_${pid} _graph"
2684
2684
if ! local -n pid_count=" pid_${pid} _count" 2> /dev/null; then continue ; fi
2685
2685
@@ -2691,8 +2691,10 @@ collect_processes_psutil() {
2691
2691
elif [[ ${pid_count} -gt 0 ]]; then
2692
2692
if [[ ${cpu_int} -gt 9 ]]; then
2693
2693
create_mini_graph -nc -add-value " pid_${pid} _graph" " $(( cpu_int+ 15 )) "
2694
- else
2694
+ elif [[ ${cpu_int} -gt 0 ]] ; then
2695
2695
create_mini_graph -nc -add-value " pid_${pid} _graph" " $(( cpu_int+ 9 )) "
2696
+ else
2697
+ create_mini_graph -nc -add-value " pid_${pid} _graph" " 0"
2696
2698
fi
2697
2699
pid_count=$(( ${pid_count} - 1 ))
2698
2700
elif [[ ${pid_count} == " 0" ]]; then
@@ -2766,16 +2768,14 @@ collect_processes_psutil() {
2766
2768
2767
2769
2768
2770
2769
- # * Clear up memory by removing variables and graphs of no longer running processes
2771
+ # * Clear up memory
2770
2772
(( ++ proc[general_counter]))
2771
2773
if (( proc[general_counter]> 100 )) ; then
2772
2774
proc[general_counter]=0
2773
2775
for pids in ${! pid_history[@]} ; do
2774
- if [[ ! -e /proc/${pids} ]]; then
2775
- unset " pid_${pids} _graph" " pid_${pids} _graph_even" " pid_${pids} _graph_odd" " pid_${pids} _graph_last_type" " pid_${pids} _graph_last_val"
2776
- unset " pid_${pids} _count"
2777
- unset " pid_history[${pids} ]"
2778
- fi
2776
+ unset " pid_${pids} _graph" " pid_${pids} _graph_even" " pid_${pids} _graph_odd" " pid_${pids} _graph_last_type" " pid_${pids} _graph_last_val"
2777
+ unset " pid_${pids} _count"
2778
+ unset " pid_history[${pids} ]"
2779
2779
done
2780
2780
fi
2781
2781
0 commit comments