diff --git a/src/apps/activitymonitor/DataSource.cpp b/src/apps/activitymonitor/DataSource.cpp index 65096e4232..4b082015bc 100644 --- a/src/apps/activitymonitor/DataSource.cpp +++ b/src/apps/activitymonitor/DataSource.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2008, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Copyright 2008-2009, Axel Dörfler, axeld@pinc-software.de. * 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; diff --git a/src/apps/activitymonitor/DataSource.h b/src/apps/activitymonitor/DataSource.h index d4d1e91cdc..0a6d3ef9e8 100644 --- a/src/apps/activitymonitor/DataSource.h +++ b/src/apps/activitymonitor/DataSource.h @@ -1,5 +1,5 @@ /* - * Copyright 2008, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Copyright 2008-2009, Axel Dörfler, axeld@pinc-software.de. * 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();