diff options
| author | Thomas Martitz <kugel@rockbox.org> | 2011-08-30 14:01:33 +0000 |
|---|---|---|
| committer | Thomas Martitz <kugel@rockbox.org> | 2011-08-30 14:01:33 +0000 |
| commit | d0b72e25903574acb1cf9184a6052cdd646dbc37 (patch) | |
| tree | 5be8db5ee00b2a727e4821cf51a5f7bcf3991073 /apps/debug_menu.c | |
| parent | c940811ade7d99a0e0d414df7c6509672413684a (diff) | |
| download | rockbox-d0b72e25903574acb1cf9184a6052cdd646dbc37.zip rockbox-d0b72e25903574acb1cf9184a6052cdd646dbc37.tar.gz rockbox-d0b72e25903574acb1cf9184a6052cdd646dbc37.tar.bz2 rockbox-d0b72e25903574acb1cf9184a6052cdd646dbc37.tar.xz | |
GSoC/Buflib: Add buflib memory alocator to the core.
The buflib memory allocator is handle based and can free and
compact, move or resize memory on demand. This allows to effeciently
allocate memory dynamically without an MMU, by avoiding fragmentation
through memory compaction.
This patch adds the buflib library to the core, along with
convinience wrappers to omit the context parameter. Compaction is
not yet enabled, but will be in a later patch. Therefore, this acts as a
replacement for buffer_alloc/buffer_get_buffer() with the benifit of a debug
menu.
See buflib.h for some API documentation.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30380 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/debug_menu.c')
| -rw-r--r-- | apps/debug_menu.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 9e4621b..fb8575e 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -79,6 +79,7 @@ #include "peakmeter.h" #endif #include "logfdisp.h" +#include "core_alloc.h" #if CONFIG_CODEC == SWCODEC #include "pcmbuf.h" #include "buffering.h" @@ -416,6 +417,22 @@ static bool dbg_buffering_thread(void) #endif /* CONFIG_CODEC */ #endif /* HAVE_LCD_BITMAP */ +static const char* bf_getname(int selected_item, void *data, + char *buffer, size_t buffer_len) +{ + (void)data; + core_print_block_at(selected_item, buffer, buffer_len); + return buffer; +} + +static bool dbg_buflib_allocs(void) +{ + struct simplelist_info info; + simplelist_info_init(&info, "mem allocs", core_get_num_blocks(), NULL); + info.get_name = bf_getname; + return simplelist_show_list(&info); +} + #if (CONFIG_PLATFORM & PLATFORM_NATIVE) static const char* dbg_partitions_getname(int selected_item, void *data, char *buffer, size_t buffer_len) @@ -2040,6 +2057,7 @@ static const struct the_menu_item menuitems[] = { { "pm histogram", peak_meter_histogram}, #endif /* PM_DEBUG */ #endif /* HAVE_LCD_BITMAP */ + { "View buflib allocs", dbg_buflib_allocs }, #ifndef SIMULATOR #if CONFIG_TUNER { "FM Radio", dbg_fm_radio }, |