Skip to content

Add a config option changing the number of data points in the resource tab graphs

This Merge Request adds a config option to change the number of data points for the graphs in the resource tab, with a range of 30 to 600 points.
As a data point number configuration seems to be rare in system monitors, and i assume there is a reason for that, i can understand if this is not a wanted feature, in that case just go ahead and close this merge request.
However i really like this feature in the few system monitors that do have it, so i hope this will get merged.
For this change to really make sense i also had to change the time scale to allow showing minutes and hours.
If the time scale would have to show hours, minutes, and seconds it rounds the seconds to the nearest minute instead.

Images

Points set to 30 and interval set to 0.25s: Screenshot_from_2020-11-02_13-22-22 Points set to 600, interval set to 100s: Screenshot_from_2020-11-02_13-22-48 359 points and 10s interval to show that the longest time graph text still fits on the smallest window size:
Screenshot_from_2020-11-02_13-26-33_1
364 points and 10s interval to show that if minutes are 0 it shows hours and seconds: Screenshot_from_2020-11-02_13-28-52 The updated config window:
Screenshot_from_2020-11-03_10-14-42

Changes

  • Add a config option with range 30 to 600 to the config window that changes the amount of data points in the resource tab graphs
  • Change time scale of the resource tab to change hrs, mins, and secs

Notes

Due to these significant changes to the load_graph class there are a few things i want to note that may need changing.
The data field of the graph class is now a vector instead of an array to allow resizing it, however it could be changed to be an array that permanently has the size to allow max amount of data points(600).
I prefer it as a vector, however it should be relatively easy to change that.
Also legacy/gsm_color_button.c:855 now contains a break; because it seemed strange that way without, didn't seem to intentionally be missing one, and caused a warning.
And maybe because i didn't notice it was legacy while changing that.
While i would have preferred to show hours, minutes, and seconds there isn't enough space to do so, atleast not in one line with small window sizes.
It could be done in two lines, but i don't consider that a better solution.
I could change it to h, m, and s if that is the preferred solution tho.
And as a last note, due to net.values becoming a vector the memset at load_graph.cpp:861 now causes this warning ‘void* memset(void*, int, size_t)’ clearing an object of type ‘struct LoadGraph::<unnamed>’ with no trivial copy-assignment; use assignment or value-initialization instead [-Wclass-memaccess].
I did some testing, and it seems to me like that can just be removed, however as i assume there is a reason for it, and its only a warning, i just left it there for now.
The scale moves by 10 when pressing arrow keys, and 50 when pressing Page Up/Page Down.

Issues

  • For some reason the scale reacts inverted when pressing Up, Down, Page Up, or Page Down, but not when pressing Left or Right.
    This seems to be a gtk bug from what i could find, but i could not yet test this with a gtk version new enough to fix it.
Edited by ToMe25

Merge request reports