diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-11-28 11:53:55 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-11-28 13:09:11 +0100 |
commit | d006b46df31f6e5f28237fe40eafb135e684b739 (patch) | |
tree | e3f5956ae801329ae8f2891e9a62734833daa1d2 /cpukit/score/src/heapallocate.c | |
parent | score: Return heap stats via _Heap_Get_information (diff) | |
download | rtems-d006b46df31f6e5f28237fe40eafb135e684b739.tar.bz2 |
score: Add heap statistics
Add lifetime bytes allocated and freed since they were present in the
malloc statistics. Add number of failed allocations.
Diffstat (limited to 'cpukit/score/src/heapallocate.c')
-rw-r--r-- | cpukit/score/src/heapallocate.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/cpukit/score/src/heapallocate.c b/cpukit/score/src/heapallocate.c index 597077e280..a76ac04f49 100644 --- a/cpukit/score/src/heapallocate.c +++ b/cpukit/score/src/heapallocate.c @@ -254,10 +254,6 @@ void *_Heap_Allocate_aligned_with_boundary( } while ( search_again ); if ( alloc_begin != 0 ) { - /* Statistics */ - ++stats->allocs; - stats->searches += search_count; - block = _Heap_Block_allocate( heap, block, alloc_begin, alloc_size ); _Heap_Check_allocation( @@ -268,6 +264,14 @@ void *_Heap_Allocate_aligned_with_boundary( alignment, boundary ); + + /* Statistics */ + ++stats->allocs; + stats->searches += search_count; + stats->lifetime_allocated += _Heap_Block_size( block ); + } else { + /* Statistics */ + ++stats->failed_allocs; } /* Statistics */ |