* Added block cache memory usage data source.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31947 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2009-07-29 22:22:16 +00:00
parent 4b57427974
commit 87dacc8def
2 changed files with 64 additions and 2 deletions
+50 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2008, Axel Dörfler, [email protected]. All rights reserved.
* Copyright 2008-2009, Axel Dörfler, [email protected].
* Distributed under the terms of the MIT License.
*/
@@ -24,6 +24,7 @@ const DataSource* kSources[] = {
new CPUCombinedUsageDataSource(),
new NetworkUsageDataSource(true),
new NetworkUsageDataSource(false),
new BlockCacheDataSource(),
new SemaphoresDataSource(),
new PortsDataSource(),
new ThreadsDataSource(),
@@ -450,6 +451,54 @@ SwapSpaceDataSource::Primary() const
// #pragma mark -
BlockCacheDataSource::BlockCacheDataSource()
{
fColor = (rgb_color){0, 120, 0};
}
BlockCacheDataSource::~BlockCacheDataSource()
{
}
DataSource*
BlockCacheDataSource::Copy() const
{
return new BlockCacheDataSource(*this);
}
int64
BlockCacheDataSource::NextValue(SystemInfo& info)
{
system_memory_info memoryInfo;
status_t status = get_system_info_etc(B_MEMORY_INFO, &memoryInfo,
sizeof(system_memory_info));
if (status != B_OK)
return 0;
return memoryInfo.block_cache_memory;
}
const char*
BlockCacheDataSource::Label() const
{
return "Block Cache Memory Usage";
}
const char*
BlockCacheDataSource::ShortLabel() const
{
return "Block Cache";
}
// #pragma mark -
SemaphoresDataSource::SemaphoresDataSource()
{
SystemInfo info;
+14 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2008, Axel Dörfler, [email protected]. All rights reserved.
* Copyright 2008-2009, Axel Dörfler, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef DATA_SOURCE_H
@@ -115,6 +115,19 @@ public:
};
class BlockCacheDataSource : public MemoryDataSource {
public:
BlockCacheDataSource();
virtual ~BlockCacheDataSource();
virtual DataSource* Copy() const;
virtual int64 NextValue(SystemInfo& info);
virtual const char* Label() const;
virtual const char* ShortLabel() const;
};
class SemaphoresDataSource : public DataSource {
public:
SemaphoresDataSource();