1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:37:45 +00:00

SystemMonitor: Use size_t for graph values

The memory and CPU graphs fail to display anything when the memory size
is larger than 2**31 bytes, because of the small range of int. This
commit makes replaces the type with size_t. Hopefully nobody will have
18 quintillion bytes of memory before this gets replaced. :^)
This commit is contained in:
sin-ack 2021-09-18 11:15:42 +00:00 committed by Andreas Kling
parent f73aa8e2bd
commit 7aa3cfda09
4 changed files with 9 additions and 9 deletions

View file

@ -15,15 +15,15 @@ class GraphWidget final : public GUI::Frame {
public:
virtual ~GraphWidget() override;
void set_max(int max) { m_max = max; }
int max() const { return m_max; }
void set_max(size_t max) { m_max = max; }
size_t max() const { return m_max; }
void add_value(Vector<int, 1>&&);
void add_value(Vector<size_t, 1>&&);
struct ValueFormat {
Gfx::ColorRole graph_color_role { Gfx::ColorRole::Base };
Color text_shadow_color { Color::Transparent };
Function<String(int)> text_formatter;
Function<String(size_t)> text_formatter;
};
void set_value_format(size_t index, ValueFormat&& format)
{
@ -38,9 +38,9 @@ private:
virtual void paint_event(GUI::PaintEvent&) override;
int m_max { 100 };
size_t m_max { 100 };
Vector<ValueFormat, 1> m_value_format;
CircularQueue<Vector<int, 1>, 4000> m_values;
CircularQueue<Vector<size_t, 1>, 4000> m_values;
bool m_stack_values { false };
Vector<Gfx::IntPoint, 1> m_calculated_points;