diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2015-09-29 15:06:20 +0200 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2015-09-29 16:05:27 +0200 |
commit | 5a00c0e8a75760434a74cda2317637d9c23854cb (patch) | |
tree | d4dfb5c17d4a9fb04d9fc1a7070f96f26fabda3c | |
parent | 5cfe49741a2749d05aebd703e087f6c252a222d2 (diff) |
kern/slab: print total used and reclaimable memory
* kern/slab.c (_slab_info): Print total used and reclaimable memory.
-rw-r--r-- | kern/slab.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/kern/slab.c b/kern/slab.c index d1473b6..4f32c8e 100644 --- a/kern/slab.c +++ b/kern/slab.c @@ -1436,7 +1436,10 @@ void kfree(vm_offset_t data, vm_size_t size) static void _slab_info(int (printx)(const char *fmt, ...)) { struct kmem_cache *cache; - vm_size_t mem_usage, mem_reclaimable; + vm_size_t mem_usage, mem_reclaimable, mem_total, mem_total_reclaimable; + + mem_total = 0; + mem_total_reclaimable = 0; printx("cache obj slab bufs objs bufs" " total reclaimable\n" @@ -1458,9 +1461,15 @@ static void _slab_info(int (printx)(const char *fmt, ...)) mem_usage, mem_reclaimable); simple_unlock(&cache->lock); + + mem_total += mem_usage; + mem_total_reclaimable += mem_reclaimable; } simple_unlock(&kmem_cache_list_lock); + + printx("total: %uk, reclaimable: %uk\n", + mem_total, mem_total_reclaimable); } void slab_info(void) |