1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:07:35 +00:00

WindowServer: Move the CPU monitor thingy to its own class.

This commit is contained in:
Andreas Kling 2019-04-14 04:33:43 +02:00
parent f1b58d8d8c
commit c2093ad994
6 changed files with 106 additions and 83 deletions

View file

@ -0,0 +1,22 @@
#pragma once
#include <AK/CircularQueue.h>
class Painter;
class Rect;
class WSCPUMonitor {
public:
WSCPUMonitor();
bool is_dirty() const { return m_dirty; }
void set_dirty(bool dirty) { m_dirty = dirty; }
int capacity() const { return m_cpu_history.capacity(); }
void paint(Painter&, const Rect&);
private:
void get_cpu_usage(unsigned& busy, unsigned& idle);
CircularQueue<float, 30> m_cpu_history;
bool m_dirty { false };
};