mikaku / Monitorix

Monitorix is a free, open source, lightweight system monitoring tool.

Home Page:https://www.monitorix.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Context switches in process module have negative values

bachandi opened this issue · comments

The context switches plot shows the negative ics values. I am not really sure why. In the legend the tcs=vcs+ics are written. Any reason for plotting n_ics=-1*ics and vcs in the same color instead of just tcs?

This is the current plot:
Bildschirmfoto 2022-10-18 um 12 54 03

If there is no reason it could be switched to just show tcs values:

index c8fdadd..febe227 100644
--- a/lib/process.pm
+++ b/lib/process.pm
@@ -1277,14 +1277,12 @@ sub process_cgi {
                        if($p) {
                                $str = trim((split(',', $process->{desc}->{$p} || ""))[0]) || $p;
                                $str =~ s/:/\\:/g;      # escape colons
-                               push(@tmpz, "LINE2:vcs" . $n . $LC[$n] . ":$str");
-                               push(@tmpz, "LINE2:n_ics" . $n . $LC[$n]);
+                               push(@tmpz, "LINE2:tcs" . $n . $LC[$n] . ":$str");
                                $str = sprintf("%-20s", substr($str, 0, 20));
-                               push(@tmp, "LINE2:vcs" . $n . $LC[$n] . ":$str");
-                               push(@tmp, "GPRINT:tcs" . $n . ":LAST:Cur\\: %4.0lf");
-                               push(@tmp, "GPRINT:tcs" . $n . ":MIN:  Min\\: %4.0lf");
-                               push(@tmp, "GPRINT:tcs" . $n . ":MAX:  Max\\: %4.0lf\\n");
-                               push(@tmp, "LINE2:n_ics" . $n . $LC[$n]);
+                               push(@tmp, "LINE2:tcs" . $n . $LC[$n] . ":$str");
+                               push(@tmp, "GPRINT:tcs" . $n . ":LAST:Cur\\: %4.2lf");
+                               push(@tmp, "GPRINT:tcs" . $n . ":MIN:  Min\\: %4.2lf");
+                               push(@tmp, "GPRINT:tcs" . $n . ":MAX:  Max\\: %4.2lf\\n");
                        }
                }
                if($title) {

Which will result in a plot like this:
Bildschirmfoto 2022-10-18 um 12 53 31

If I recall correctly, this is intended to differentiate between voluntary and involuntary context switches in the same graph and using the same color for each metric.

So, all involuntary context switches are negative and the voluntary ones are in positive values. This should show a more readable graph than using stacked values or using a unique value for each metric.

I hope this answers your question.

I see.
What do you think about adding a second label to the right and a different line style to clearly differentiate between those two lines like in the example below?

process17 1day-2

Looks good to me.
This will increase graph readability.