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:
parent
f1b58d8d8c
commit
c2093ad994
6 changed files with 106 additions and 83 deletions
22
Servers/WindowServer/WSCPUMonitor.h
Normal file
22
Servers/WindowServer/WSCPUMonitor.h
Normal 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 };
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue