Changeset d006b46d in rtems


Ignore:
Timestamp:
11/28/14 10:53:55 (9 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, 5, master
Children:
e37e8504
Parents:
2c3c657
git-author:
Sebastian Huber <sebastian.huber@…> (11/28/14 10:53:55)
git-committer:
Sebastian Huber <sebastian.huber@…> (11/28/14 12:09:11)
Message:

score: Add heap statistics

Add lifetime bytes allocated and freed since they were present in the
malloc statistics. Add number of failed allocations.

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libmisc/shell/print_heapinfo.c

    r2c3c657 rd006b46d  
    4444    "Maximum number of free blocks ever:       %12" PRIu32 "\n"
    4545    "Maximum number of blocks searched ever:   %12" PRIu32 "\n"
     46    "Lifetime number of bytes allocated:       %12" PRIu64 "\n"
     47    "Lifetime number of bytes freed:           %12" PRIu64 "\n"
     48    "Total number of searches:                 %12" PRIu32 "\n"
    4649    "Total number of successful allocations:   %12" PRIu32 "\n"
    47     "Total number of searches ever:            %12" PRIu32 "\n"
    48     "Total number of successful calls to free: %12" PRIu32 "\n"
     50    "Total number of failed allocations:       %12" PRIu32 "\n"
     51    "Total number of successful frees:        %12" PRIu32 "\n"
    4952    "Total number of successful resizes:       %12" PRIu32 "\n",
    5053    s->instance,
     
    5356    s->max_free_blocks,
    5457    s->max_search,
     58    s->lifetime_allocated,
     59    s->lifetime_freed,
     60    s->searches,
    5561    s->allocs,
    56     s->searches,
     62    s->failed_allocs,
    5763    s->frees,
    5864    s->resizes
  • cpukit/score/include/rtems/score/heap.h

    r2c3c657 rd006b46d  
    258258typedef struct {
    259259  /**
     260   * @brief Lifetime number of bytes allocated from this heap.
     261   *
     262   * This value is an integral multiple of the page size.
     263   */
     264  uint64_t lifetime_allocated;
     265
     266  /**
     267   * @brief Lifetime number of bytes freed to this heap.
     268   *
     269   * This value is an integral multiple of the page size.
     270   */
     271  uint64_t lifetime_freed;
     272
     273  /**
    260274   * @brief Instance number of this heap.
    261275   */
     
    304318
    305319  /**
     320   * @brief Total number of searches.
     321   */
     322  uint32_t searches;
     323
     324  /**
    306325   * @brief Total number of successful allocations.
    307326   */
     
    309328
    310329  /**
    311    * @brief Total number of searches ever.
    312    */
    313   uint32_t searches;
    314 
    315   /**
    316    * @brief Total number of successful calls to free.
     330   * @brief Total number of failed allocations.
     331   */
     332  uint32_t failed_allocs;
     333
     334  /**
     335   * @brief Total number of successful frees.
    317336   */
    318337  uint32_t frees;
  • cpukit/score/src/heapallocate.c

    r2c3c657 rd006b46d  
    255255
    256256  if ( alloc_begin != 0 ) {
    257     /* Statistics */
    258     ++stats->allocs;
    259     stats->searches += search_count;
    260 
    261257    block = _Heap_Block_allocate( heap, block, alloc_begin, alloc_size );
    262258
     
    269265      boundary
    270266    );
     267
     268    /* Statistics */
     269    ++stats->allocs;
     270    stats->searches += search_count;
     271    stats->lifetime_allocated += _Heap_Block_size( block );
     272  } else {
     273    /* Statistics */
     274    ++stats->failed_allocs;
    271275  }
    272276
  • cpukit/score/src/heapfree.c

    r2c3c657 rd006b46d  
    202202  ++stats->frees;
    203203  stats->free_size += block_size;
     204  stats->lifetime_freed += block_size;
    204205
    205206  return( true );
  • doc/shell/memory.t

    r2c3c657 rd006b46d  
    552552@item Maximum number of free blocks ever
    553553@item Maximum number of blocks searched ever
     554@item Lifetime number of bytes allocated
     555@item Lifetime number of bytes freed
     556@item Total number of searches
    554557@item Total number of successful allocations
    555 @item Total number of searches ever
    556 @item Total number of successful calls to free
     558@item Total number of failed allocations
     559@item Total number of successful frees
    557560@item Total number of successful resizes
    558561@end itemize
     
    576579SHLL [/] $ malloc
    577580C Program Heap and RTEMS Workspace are the same.
    578 Number of free blocks:                              14
    579 Largest free block:                          266157192
    580 Total bytes free:                            266164928
     581Number of free blocks:                               2
     582Largest free block:                          266207504
     583Total bytes free:                            266208392
    581584Number of used blocks:                             167
    582 Largest used block:                              16424
    583 Total bytes used:                                90888
     585Largest used block:                              16392
     586Total bytes used:                                83536
    584587Instance number:                                     0
    585 Size of the allocatable area in bytes:       266255816
    586 Minimum free size ever in bytes:             266156136
    587 Maximum number of free blocks ever:                 15
    588 Maximum number of blocks searched ever:             15
     588Size of the allocatable area in bytes:       266291928
     589Minimum free size ever in bytes:             266207360
     590Maximum number of free blocks ever:                  6
     591Maximum number of blocks searched ever:              5
     592Lifetime number of bytes allocated:              91760
     593Lifetime number of bytes freed:                   8224
     594Total number of searches:                          234
    589595Total number of successful allocations:            186
    590 Total number of searches ever:                     186
    591 Total number of successful calls to free:           19
     596Total number of failed allocations:                  0
     597Total number of successful frees:                   19
    592598Total number of successful resizes:                  0
    593599SHLL [/] $ malloc walk
Note: See TracChangeset for help on using the changeset viewer.