xref: /haiku/src/apps/activitymonitor/SystemInfo.h (revision 9e25244c5e9051f6cd333820d6332397361abd6c)
1 /*
2  * Copyright 2008, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef SYSTEM_INFO_H
6 #define SYSTEM_INFO_H
7 
8 
9 #include <OS.h>
10 
11 #include <system_info.h>
12 
13 
14 class SystemInfoHandler;
15 
16 
17 class SystemInfo {
18 public:
19 						SystemInfo(SystemInfoHandler* handler = NULL);
20 						~SystemInfo();
21 
22 			uint64		CachedMemory() const;
23 			uint64		BlockCacheMemory() const;
24 			uint64		UsedMemory() const;
25 			uint64		MaxMemory() const;
26 
27 			uint32		PageFaults() const;
28 
29 			uint64		MaxSwapSpace() const;
30 			uint64		UsedSwapSpace() const;
31 
32 			uint32		UsedSemaphores() const;
33 			uint32		MaxSemaphores() const;
34 
35 			uint32		UsedPorts() const;
36 			uint32		MaxPorts() const;
37 
38 			uint32		UsedThreads() const;
39 			uint32		MaxThreads() const;
40 
41 			uint32		UsedTeams() const;
42 			uint32		MaxTeams() const;
43 
44 			bigtime_t	Time() const { return fTime; }
45 			uint32		CPUCount() const { return fSystemInfo.cpu_count; }
46 			bigtime_t	CPUActiveTime(uint32 cpu) const
47 							{ return fCPUInfos[cpu].active_time; }
48 			uint64		CPUCurrentFrequency(uint32 cpu) const
49 							{ return fCPUInfos[cpu].current_frequency; }
50 			const system_info& Info() const { return fSystemInfo; }
51 
52 			uint64		NetworkReceived();
53 			uint64		NetworkSent();
54 
55 			uint32		UsedRunningApps() const;
56 			uint32		MaxRunningApps() const;
57 
58 			uint32		ClipboardSize() const;
59 			uint32		ClipboardTextSize() const;
60 
61 			uint32		MediaNodes() const;
62 			uint32		MediaConnections() const;	// UNIMPLEMENTED
63 			uint32		MediaBuffers() const;		// UNIMPLEMENTED
64 
65 private:
66 			void		_RetrieveNetwork();
67 
68 	system_info			fSystemInfo;
69 	cpu_info*			fCPUInfos;
70 	bigtime_t			fTime;
71 	bool				fRetrievedNetwork;
72 	uint64				fBytesReceived;
73 	uint64				fBytesSent;
74 	uint32				fRunningApps;
75 	uint32				fClipboardSize;
76 	uint32				fClipboardTextSize;
77 	uint32				fMediaNodes;
78 	uint32				fMediaConnections;
79 	uint32				fMediaBuffers;
80 };
81 
82 #endif	// SYSTEM_INFO_H
83