mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 21:22:46 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			25 lines
		
	
	
	
		
			532 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
	
		
			532 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #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 };
 | |
| };
 | 
