monitor icon indicating copy to clipboard operation
monitor copied to clipboard

Feature request: Add option to draw the CPU chart as a stacked area chart

Open andrewdbate opened this issue 2 years ago • 8 comments

I have a 6-core / 12-thread machine. When I am running a program that uses several threads and has high CPU usage (for example, compiling C++ with many worker threads or running database queries), the CPU chart in Monitor is difficult / impossible to read because the plots overlap on the plot area: screenshot-monitor

The Gnome System Monitor offers the choice of a stacked area chart that solves this problem. Here is a screenshot: screenshot-gnome-stacked

The Gnome System Monitor offers two options in its preferences. These are:

  • Draw CPU chart as stacked area chat, and
  • Draw CPU chart as smooth graph

Here is a screenshot of these options in the Gnome System Monitor preferences dialog: screenshot-gnome-preferences Here is the stacked area CPU chart from Gnome System Monitor but with smooth lines turned on: screenshot-gnome-stacked-smooth

In my opinion, the stacked chart has several advantages:

  • You can clearly see the total CPU usage of the system (it is the top line of the chart). While Monitor does show the current total CPU utilization (see the first screenshot above), sometimes you want to see the history of the total CPU usage graphed over the several seconds (as it goes up and down), not just the current CPU usage. You can easily do this with the stacked chart.
  • It is much easier to read how a particular CPU thread has contributed to the total CPU usage over time because you can look at its "slice" in the stack. You cannot really do this when the plots are drawn on top of each other (i.e. without being stacked).
  • A stacked chart still works well with several CPU threads to plot, whereas plotting them on top of each other (as Monitor currently does, i.e. without being stacked) can become unreadable on a many-core/many-thread machine.

Of the two Gnome System Monitor screenshots above showing the stacked charts, I personally prefer the first one without the smooth lines because having less detail makes it easier to identify what is going on with only a quick glance.

I am not necessarily suggesting changing the default chart, but having a stacked chart (without smooth lines) as an option would be very welcome.

andrewdbate avatar Jan 20 '22 20:01 andrewdbate

Didn't know that there is actually such a need. Yes I think it can be added, but needs design. I want to preserve informing of high thread usage, but it also needs to be indicated what colour a thread is on the plot.

And of course if You need "real" plot data, I have nothing against adding an option to disable smoothing.

stsdc avatar Jan 20 '22 21:01 stsdc

It would be good to have an option to disable smoothing. Gnome System Monitor allows smoothing to be disabled independently of the choice of the selected chart type (either regular or stacked).

Perhaps the option to disable smoothing should be a separate issue?

andrewdbate avatar Jan 20 '22 21:01 andrewdbate

Agree. I thought about this as a separate feature.

stsdc avatar Jan 20 '22 22:01 stsdc

I have now described the option for turning off smoothing in a separate feature request https://github.com/stsdc/monitor/issues/298.

So this issue should be just about implementing support for stacked CPU charts.

andrewdbate avatar Jan 20 '22 22:01 andrewdbate

Quick PoC.

obraz

stsdc avatar Feb 23 '22 00:02 stsdc

That looks really good! I think that is much easier to read!

andrewdbate avatar Feb 23 '22 00:02 andrewdbate

Here is how this looks on my system (screenshot from the 0.13.0 release): Screenshot from 2022-03-20 16 27 14

This is so much easier to read!

This might be because I have 12 cores, so lots of stacked chart areas, but because the area under each chart is drawn with alpha transparency and on top of each other, the colour seems to become brown (see arrow).

andrewdbate avatar Mar 20 '22 17:03 andrewdbate

Here is a screenshot of Gnome System Monitor. On the stacked area chart, only the area that corresponds to that core is shaded:

Screenshot from 2022-03-20 17 33 08

(Although Gnome System Monitor does not use transparency, I agree that the transparency in Monitor looks better.)

I think that only the area that corresponds to each core should be shaded (instead of shading everything under the line).

That would also fix the overlapping transparency/brown colour issue.

andrewdbate avatar Mar 20 '22 17:03 andrewdbate

Best I can do right now :sweat_smile:

Zrzut ekranu z 2023-01-22 14 36 22

stsdc avatar Jan 22 '23 13:01 stsdc

Looks like it fixes issue with mixing different colors. If you think there is more to do let me know!

stsdc avatar Jan 22 '23 14:01 stsdc