Added block_cache_used_memory() that returns the memory allocated by all
block caches for the block cache buffers. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26836 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
5db876653b
commit
c79e66abb7
@ -14,9 +14,10 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern status_t block_cache_init(void);
|
extern status_t block_cache_init(void);
|
||||||
|
extern size_t block_cache_used_memory();
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* _KRENEL_BLOCK_CACHE_H */
|
#endif /* _KERNEL_BLOCK_CACHE_H */
|
||||||
|
21
src/system/kernel/cache/block_cache.cpp
vendored
21
src/system/kernel/cache/block_cache.cpp
vendored
@ -1807,6 +1807,27 @@ block_cache_init(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" size_t
|
||||||
|
block_cache_used_memory()
|
||||||
|
{
|
||||||
|
size_t usedMemory = 0;
|
||||||
|
|
||||||
|
MutexLocker _(sCachesLock);
|
||||||
|
|
||||||
|
DoublyLinkedList<block_cache>::Iterator it = sCaches.GetIterator();
|
||||||
|
while (block_cache* cache = it.Next()) {
|
||||||
|
if (cache == (block_cache*)&sMarkCache)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
size_t cacheUsedMemory;
|
||||||
|
object_cache_get_usage(cache->buffer_cache, &cacheUsedMemory);
|
||||||
|
usedMemory += cacheUsedMemory;
|
||||||
|
}
|
||||||
|
|
||||||
|
return usedMemory;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark - public transaction API
|
// #pragma mark - public transaction API
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user