2 * Copyright 2008-2009, Axel Dörfler, axeld@pinc-software.de.
3 * Distributed under the terms of the MIT License.
9 #include <InterfaceDefs.h>
22 DataSource(int64 initialMin
, int64 initialMax
);
24 DataSource(const DataSource
& other
);
25 virtual ~DataSource();
27 virtual DataSource
* Copy() const;
28 virtual DataSource
* CopyForCPU(int32 cpu
) const;
30 int64
Minimum() const;
31 int64
Maximum() const;
32 bigtime_t
RefreshInterval() const;
34 virtual void SetLimits(int64 min
, int64 max
);
35 virtual void SetRefreshInterval(bigtime_t interval
);
36 virtual void SetColor(rgb_color color
);
38 virtual int64
NextValue(SystemInfo
& info
);
39 virtual void Print(BString
& text
, int64 value
) const;
41 virtual const char* InternalName() const = 0;
42 virtual const char* Name() const;
43 virtual const char* Label() const;
44 virtual const char* ShortLabel() const;
45 virtual const char* Unit() const;
46 virtual rgb_color
Color() const;
47 virtual bool AdaptiveScale() const;
48 virtual scale_type
ScaleType() const;
49 virtual int32
CPU() const;
50 virtual bool PerCPU() const;
51 virtual bool MultiCPUOnly() const;
52 virtual bool Primary() const;
54 static int32
CountSources();
55 static const DataSource
* SourceAt(int32 index
);
56 static const DataSource
* FindSource(const char* internalName
);
57 static int32
IndexOf(const DataSource
* source
);
67 class MemoryDataSource
: public DataSource
{
70 virtual ~MemoryDataSource();
72 virtual void Print(BString
& text
, int64 value
) const;
73 virtual const char* Unit() const;
77 class UsedMemoryDataSource
: public MemoryDataSource
{
79 UsedMemoryDataSource();
80 virtual ~UsedMemoryDataSource();
82 virtual DataSource
* Copy() const;
84 virtual int64
NextValue(SystemInfo
& info
);
85 virtual const char* InternalName() const;
86 virtual const char* Label() const;
87 virtual const char* ShortLabel() const;
88 virtual bool Primary() const;
92 class CachedMemoryDataSource
: public MemoryDataSource
{
94 CachedMemoryDataSource();
95 virtual ~CachedMemoryDataSource();
97 virtual DataSource
* Copy() const;
99 virtual int64
NextValue(SystemInfo
& info
);
100 virtual const char* InternalName() const;
101 virtual const char* Label() const;
102 virtual const char* ShortLabel() const;
103 virtual bool Primary() const;
107 class SwapSpaceDataSource
: public MemoryDataSource
{
109 SwapSpaceDataSource();
110 virtual ~SwapSpaceDataSource();
112 virtual DataSource
* Copy() const;
114 virtual int64
NextValue(SystemInfo
& info
);
115 virtual const char* InternalName() const;
116 virtual const char* Label() const;
117 virtual const char* ShortLabel() const;
118 virtual bool Primary() const;
122 class BlockCacheDataSource
: public MemoryDataSource
{
124 BlockCacheDataSource();
125 virtual ~BlockCacheDataSource();
127 virtual DataSource
* Copy() const;
129 virtual int64
NextValue(SystemInfo
& info
);
130 virtual const char* InternalName() const;
131 virtual const char* Label() const;
132 virtual const char* ShortLabel() const;
136 class SemaphoresDataSource
: public DataSource
{
138 SemaphoresDataSource();
139 virtual ~SemaphoresDataSource();
141 virtual DataSource
* Copy() const;
143 virtual int64
NextValue(SystemInfo
& info
);
144 virtual const char* InternalName() const;
145 virtual const char* Label() const;
146 virtual const char* ShortLabel() const;
147 virtual bool AdaptiveScale() const;
151 class PortsDataSource
: public DataSource
{
154 virtual ~PortsDataSource();
156 virtual DataSource
* Copy() const;
158 virtual int64
NextValue(SystemInfo
& info
);
159 virtual const char* InternalName() const;
160 virtual const char* Label() const;
161 virtual bool AdaptiveScale() const;
165 class ThreadsDataSource
: public DataSource
{
168 virtual ~ThreadsDataSource();
170 virtual DataSource
* Copy() const;
172 virtual int64
NextValue(SystemInfo
& info
);
173 virtual const char* InternalName() const;
174 virtual const char* Label() const;
175 virtual bool AdaptiveScale() const;
179 class TeamsDataSource
: public DataSource
{
182 virtual ~TeamsDataSource();
184 virtual DataSource
* Copy() const;
186 virtual int64
NextValue(SystemInfo
& info
);
187 virtual const char* InternalName() const;
188 virtual const char* Label() const;
189 virtual bool AdaptiveScale() const;
193 class RunningAppsDataSource
: public DataSource
{
195 RunningAppsDataSource();
196 virtual ~RunningAppsDataSource();
198 virtual DataSource
* Copy() const;
200 virtual int64
NextValue(SystemInfo
& info
);
201 virtual const char* InternalName() const;
202 virtual const char* Label() const;
203 virtual const char* ShortLabel() const;
204 virtual bool AdaptiveScale() const;
208 class CPUUsageDataSource
: public DataSource
{
210 CPUUsageDataSource(int32 cpu
= 0);
211 CPUUsageDataSource(const CPUUsageDataSource
& other
);
212 virtual ~CPUUsageDataSource();
214 virtual DataSource
* Copy() const;
215 virtual DataSource
* CopyForCPU(int32 cpu
) const;
217 virtual void Print(BString
& text
, int64 value
) const;
218 virtual int64
NextValue(SystemInfo
& info
);
220 virtual const char* InternalName() const;
221 virtual const char* Name() const;
222 virtual const char* Label() const;
223 virtual const char* ShortLabel() const;
225 virtual int32
CPU() const;
226 virtual bool PerCPU() const;
227 virtual bool Primary() const;
230 void _SetCPU(int32 cpu
);
232 bigtime_t fPreviousActive
;
233 bigtime_t fPreviousTime
;
240 class CPUCombinedUsageDataSource
: public DataSource
{
242 CPUCombinedUsageDataSource();
243 CPUCombinedUsageDataSource(
244 const CPUCombinedUsageDataSource
& other
);
245 virtual ~CPUCombinedUsageDataSource();
247 virtual DataSource
* Copy() const;
249 virtual void Print(BString
& text
, int64 value
) const;
250 virtual int64
NextValue(SystemInfo
& info
);
252 virtual const char* InternalName() const;
253 virtual const char* Name() const;
254 virtual const char* Label() const;
255 virtual const char* ShortLabel() const;
257 virtual bool MultiCPUOnly() const;
258 virtual bool Primary() const;
261 bigtime_t fPreviousActive
;
262 bigtime_t fPreviousTime
;
266 class PageFaultsDataSource
: public DataSource
{
268 PageFaultsDataSource();
269 PageFaultsDataSource(
270 const PageFaultsDataSource
& other
);
271 virtual ~PageFaultsDataSource();
273 virtual DataSource
* Copy() const;
275 virtual void Print(BString
& text
, int64 value
) const;
276 virtual int64
NextValue(SystemInfo
& info
);
278 virtual const char* InternalName() const;
279 virtual const char* Name() const;
280 virtual const char* Label() const;
281 virtual const char* ShortLabel() const;
282 virtual bool AdaptiveScale() const;
283 virtual bool Primary() const;
286 uint32 fPreviousFaults
;
287 bigtime_t fPreviousTime
;
291 class NetworkUsageDataSource
: public DataSource
{
293 NetworkUsageDataSource(bool in
);
294 NetworkUsageDataSource(
295 const NetworkUsageDataSource
& other
);
296 virtual ~NetworkUsageDataSource();
298 virtual DataSource
* Copy() const;
300 virtual void Print(BString
& text
, int64 value
) const;
301 virtual int64
NextValue(SystemInfo
& info
);
303 virtual const char* InternalName() const;
304 virtual const char* Name() const;
305 virtual const char* Label() const;
306 virtual const char* ShortLabel() const;
307 virtual bool AdaptiveScale() const;
308 virtual scale_type
ScaleType() const;
309 virtual bool Primary() const;
313 uint64 fPreviousBytes
;
314 bigtime_t fPreviousTime
;
318 class ClipboardSizeDataSource
: public DataSource
{
320 ClipboardSizeDataSource(bool text
);
321 ClipboardSizeDataSource(
322 const ClipboardSizeDataSource
& other
);
323 virtual ~ClipboardSizeDataSource();
325 virtual DataSource
* Copy() const;
327 virtual int64
NextValue(SystemInfo
& info
);
329 virtual const char* InternalName() const;
330 virtual const char* Label() const;
331 virtual const char* Unit() const;
332 virtual bool AdaptiveScale() const;
339 class MediaNodesDataSource
: public DataSource
{
341 MediaNodesDataSource();
342 virtual ~MediaNodesDataSource();
344 virtual DataSource
* Copy() const;
346 virtual const char* InternalName() const;
347 virtual int64
NextValue(SystemInfo
& info
);
348 virtual const char* Label() const;
349 virtual bool AdaptiveScale() const;
352 #endif // DATA_SOURCE_H