Added object_cache_get_usage() function that returns the memory
allocated by an object cache. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26835 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -52,6 +52,8 @@ void object_cache_free(object_cache *cache, void *object);
|
|||||||
status_t object_cache_reserve(object_cache *cache, size_t object_count,
|
status_t object_cache_reserve(object_cache *cache, size_t object_count,
|
||||||
uint32 flags);
|
uint32 flags);
|
||||||
|
|
||||||
|
void object_cache_get_usage(object_cache *cache, size_t *_allocatedMemory);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -594,7 +594,7 @@ object_cache_init(object_cache *cache, const char *name, size_t objectSize,
|
|||||||
cache->free_pages = area_free_pages;
|
cache->free_pages = area_free_pages;
|
||||||
}
|
}
|
||||||
|
|
||||||
register_low_resource_handler(object_cache_low_memory, cache,
|
register_low_resource_handler(object_cache_low_memory, cache,
|
||||||
B_KERNEL_RESOURCE_PAGES | B_KERNEL_RESOURCE_MEMORY, 5);
|
B_KERNEL_RESOURCE_PAGES | B_KERNEL_RESOURCE_MEMORY, 5);
|
||||||
|
|
||||||
MutexLocker _(sObjectCacheListLock);
|
MutexLocker _(sObjectCacheListLock);
|
||||||
@@ -904,6 +904,14 @@ object_cache_reserve(object_cache *cache, size_t objectCount, uint32 flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
object_cache_get_usage(object_cache *cache, size_t *_allocatedMemory)
|
||||||
|
{
|
||||||
|
MutexLocker _(cache->lock);
|
||||||
|
*_allocatedMemory = cache->usage;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
slab *
|
slab *
|
||||||
object_cache::InitSlab(slab *slab, void *pages, size_t byteCount)
|
object_cache::InitSlab(slab *slab, void *pages, size_t byteCount)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user