Add Semaphores and Ports data sources.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25011 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
const DataSource* kSources[] = {
|
||||
new UsedMemoryDataSource(),
|
||||
new CachedMemoryDataSource(),
|
||||
new SemaphoresDataSource(),
|
||||
new PortsDataSource(),
|
||||
new ThreadsDataSource(),
|
||||
new TeamsDataSource(),
|
||||
new CPUUsageDataSource(),
|
||||
@@ -340,6 +342,100 @@ CachedMemoryDataSource::Label() const
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
SemaphoresDataSource::SemaphoresDataSource()
|
||||
{
|
||||
SystemInfo info;
|
||||
|
||||
fMinimum = 0;
|
||||
fMaximum = info.MaxSemaphores();
|
||||
|
||||
fColor = (rgb_color){100, 200, 100};
|
||||
}
|
||||
|
||||
|
||||
SemaphoresDataSource::~SemaphoresDataSource()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
DataSource*
|
||||
SemaphoresDataSource::Copy() const
|
||||
{
|
||||
return new SemaphoresDataSource(*this);
|
||||
}
|
||||
|
||||
|
||||
int64
|
||||
SemaphoresDataSource::NextValue(SystemInfo& info)
|
||||
{
|
||||
return info.UsedSemaphores();
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
SemaphoresDataSource::Label() const
|
||||
{
|
||||
return "Semaphores";
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SemaphoresDataSource::AdaptiveScale() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
PortsDataSource::PortsDataSource()
|
||||
{
|
||||
SystemInfo info;
|
||||
|
||||
fMinimum = 0;
|
||||
fMaximum = info.MaxPorts();
|
||||
|
||||
fColor = (rgb_color){180, 200, 180};
|
||||
}
|
||||
|
||||
|
||||
PortsDataSource::~PortsDataSource()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
DataSource*
|
||||
PortsDataSource::Copy() const
|
||||
{
|
||||
return new PortsDataSource(*this);
|
||||
}
|
||||
|
||||
|
||||
int64
|
||||
PortsDataSource::NextValue(SystemInfo& info)
|
||||
{
|
||||
return info.UsedPorts();
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
PortsDataSource::Label() const
|
||||
{
|
||||
return "Ports";
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
PortsDataSource::AdaptiveScale() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
ThreadsDataSource::ThreadsDataSource()
|
||||
{
|
||||
SystemInfo info;
|
||||
|
||||
@@ -89,6 +89,32 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class SemaphoresDataSource : public DataSource {
|
||||
public:
|
||||
SemaphoresDataSource();
|
||||
virtual ~SemaphoresDataSource();
|
||||
|
||||
virtual DataSource* Copy() const;
|
||||
|
||||
virtual int64 NextValue(SystemInfo& info);
|
||||
virtual const char* Label() const;
|
||||
virtual bool AdaptiveScale() const;
|
||||
};
|
||||
|
||||
|
||||
class PortsDataSource : public DataSource {
|
||||
public:
|
||||
PortsDataSource();
|
||||
virtual ~PortsDataSource();
|
||||
|
||||
virtual DataSource* Copy() const;
|
||||
|
||||
virtual int64 NextValue(SystemInfo& info);
|
||||
virtual const char* Label() const;
|
||||
virtual bool AdaptiveScale() const;
|
||||
};
|
||||
|
||||
|
||||
class ThreadsDataSource : public DataSource {
|
||||
public:
|
||||
ThreadsDataSource();
|
||||
|
||||
@@ -53,6 +53,34 @@ SystemInfo::MaxMemory() const
|
||||
}
|
||||
|
||||
|
||||
uint32
|
||||
SystemInfo::UsedSemaphores() const
|
||||
{
|
||||
return fSystemInfo.used_sems;
|
||||
}
|
||||
|
||||
|
||||
uint32
|
||||
SystemInfo::MaxSemaphores() const
|
||||
{
|
||||
return fSystemInfo.max_sems;
|
||||
}
|
||||
|
||||
|
||||
uint32
|
||||
SystemInfo::UsedPorts() const
|
||||
{
|
||||
return fSystemInfo.used_ports;
|
||||
}
|
||||
|
||||
|
||||
uint32
|
||||
SystemInfo::MaxPorts() const
|
||||
{
|
||||
return fSystemInfo.max_ports;
|
||||
}
|
||||
|
||||
|
||||
uint32
|
||||
SystemInfo::UsedThreads() const
|
||||
{
|
||||
|
||||
@@ -18,6 +18,12 @@ public:
|
||||
uint64 UsedMemory() const;
|
||||
uint64 MaxMemory() const;
|
||||
|
||||
uint32 UsedSemaphores() const;
|
||||
uint32 MaxSemaphores() const;
|
||||
|
||||
uint32 UsedPorts() const;
|
||||
uint32 MaxPorts() const;
|
||||
|
||||
uint32 UsedThreads() const;
|
||||
uint32 MaxThreads() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user