xref: /haiku/src/apps/activitymonitor/SystemInfo.h (revision 3b07762c548ec4016dea480d1061577cd15ec614)
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 			const system_info& Info() const { return fSystemInfo; }
49 
50 			uint64		NetworkReceived();
51 			uint64		NetworkSent();
52 
53 			uint32		UsedRunningApps() const;
54 			uint32		MaxRunningApps() const;
55 
56 			uint32		ClipboardSize() const;
57 			uint32		ClipboardTextSize() const;
58 
59 			uint32		MediaNodes() const;
60 			uint32		MediaConnections() const;	// UNIMPLEMENTED
61 			uint32		MediaBuffers() const;		// UNIMPLEMENTED
62 
63 private:
64 			void		_RetrieveNetwork();
65 
66 	system_info			fSystemInfo;
67 	cpu_info*			fCPUInfos;
68 	bigtime_t			fTime;
69 	bool				fRetrievedNetwork;
70 	uint64				fBytesReceived;
71 	uint64				fBytesSent;
72 	uint32				fRunningApps;
73 	uint32				fClipboardSize;
74 	uint32				fClipboardTextSize;
75 	uint32				fMediaNodes;
76 	uint32				fMediaConnections;
77 	uint32				fMediaBuffers;
78 };
79 
80 #endif	// SYSTEM_INFO_H
81