summaryrefslogtreecommitdiff
path: root/Servers/WindowServer/WSCPUMonitor.h
blob: e850029638cae8feb36facdf158f8c064dc5b03e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#pragma once

#include <AK/CircularQueue.h>
#include <LibCore/CFile.h>
#include <stdio.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;
    CFile m_proc_all;
    bool m_dirty { false };
};