diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2013-02-12 21:00:05 +1100 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2013-02-12 21:01:13 +1100 |
commit | aaf30651df27e0eb6fab876502fa1e6c084160bf (patch) | |
tree | 57601fbe5e54ed290bc6c966b059af801bd0d1bb /apps/debug_menu.c | |
parent | 69228f92dbddc9940166c0d7af2b4c79d55f85e7 (diff) | |
download | rockbox-aaf30651df27e0eb6fab876502fa1e6c084160bf.tar.gz rockbox-aaf30651df27e0eb6fab876502fa1e6c084160bf.zip |
skin_engine: Add a debug screen to display skin ram usage
Change-Id: Ida9c33211d9360ac88e30a2cf8df9f191bee8b45
Diffstat (limited to 'apps/debug_menu.c')
-rw-r--r-- | apps/debug_menu.c | 57 |
1 files changed, 54 insertions, 3 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index a00dd48648..11399f37ca 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c | |||
@@ -86,6 +86,7 @@ | |||
86 | #ifdef HAVE_LCD_BITMAP | 86 | #ifdef HAVE_LCD_BITMAP |
87 | #include "scrollbar.h" | 87 | #include "scrollbar.h" |
88 | #include "peakmeter.h" | 88 | #include "peakmeter.h" |
89 | #include "skin_engine/skin_engine.h" | ||
89 | #endif | 90 | #endif |
90 | #include "logfdisp.h" | 91 | #include "logfdisp.h" |
91 | #include "core_alloc.h" | 92 | #include "core_alloc.h" |
@@ -555,8 +556,6 @@ static int bf_action_cb(int action, struct gui_synclist* list) | |||
555 | } | 556 | } |
556 | action = ACTION_REDRAW; | 557 | action = ACTION_REDRAW; |
557 | } | 558 | } |
558 | else if (action == ACTION_NONE) | ||
559 | action = ACTION_REDRAW; | ||
560 | return action; | 559 | return action; |
561 | } | 560 | } |
562 | 561 | ||
@@ -566,7 +565,7 @@ static bool dbg_buflib_allocs(void) | |||
566 | simplelist_info_init(&info, "mem allocs", core_get_num_blocks(), NULL); | 565 | simplelist_info_init(&info, "mem allocs", core_get_num_blocks(), NULL); |
567 | info.get_name = bf_getname; | 566 | info.get_name = bf_getname; |
568 | info.action_callback = bf_action_cb; | 567 | info.action_callback = bf_action_cb; |
569 | info.timeout = TIMEOUT_BLOCK; | 568 | info.timeout = HZ; |
570 | return simplelist_show_list(&info); | 569 | return simplelist_show_list(&info); |
571 | } | 570 | } |
572 | 571 | ||
@@ -2185,6 +2184,57 @@ static bool dbg_pic(void) | |||
2185 | } | 2184 | } |
2186 | #endif | 2185 | #endif |
2187 | 2186 | ||
2187 | #ifdef HAVE_LCD_BITMAP | ||
2188 | static bool dbg_skin_engine(void) | ||
2189 | { | ||
2190 | struct simplelist_info info; | ||
2191 | int i, ref_count, total = 0; | ||
2192 | char *path; | ||
2193 | size_t bytes; | ||
2194 | int path_prefix_len = strlen(ROCKBOX_DIR "/wps/"); | ||
2195 | simplelist_info_init(&info, "Skin engine usage", 0, NULL); | ||
2196 | simplelist_set_line_count(0); | ||
2197 | info.hide_selection = true; | ||
2198 | FOR_NB_SCREENS(j) { | ||
2199 | #if NB_SCREENS > 1 | ||
2200 | simplelist_addline("%s display:", | ||
2201 | j == 0 ? "Main" : "Remote"); | ||
2202 | #endif | ||
2203 | for (i = 0; i < skin_get_num_skins(); i++) { | ||
2204 | struct skin_stats *stats = skin_get_stats(i, j); | ||
2205 | if (stats->buflib_handles) | ||
2206 | { | ||
2207 | simplelist_addline("Skin ID: %d, %d allocations", | ||
2208 | i, stats->buflib_handles); | ||
2209 | simplelist_addline("\tskin: %d bytes", | ||
2210 | stats->tree_size); | ||
2211 | simplelist_addline("\tImages: %d bytes", | ||
2212 | stats->images_size); | ||
2213 | simplelist_addline("\tTotal: %d bytes", | ||
2214 | stats->tree_size + stats->images_size); | ||
2215 | total += stats->tree_size + stats->images_size; | ||
2216 | } | ||
2217 | } | ||
2218 | } | ||
2219 | simplelist_addline("Skin total usage: %d bytes", total); | ||
2220 | simplelist_addline("Backdrop Images:"); | ||
2221 | i = 0; | ||
2222 | while (skin_backdrop_get_debug(i++, &path, &ref_count, &bytes)) { | ||
2223 | if (ref_count > 0) { | ||
2224 | |||
2225 | if (!strncasecmp(path, ROCKBOX_DIR "/wps/", path_prefix_len)) | ||
2226 | path += path_prefix_len; | ||
2227 | simplelist_addline("%s", path); | ||
2228 | simplelist_addline("\tref_count: %d", ref_count); | ||
2229 | simplelist_addline("\tsize: %d", bytes); | ||
2230 | total += bytes; | ||
2231 | } | ||
2232 | } | ||
2233 | simplelist_addline("Total usage: %d bytes", total); | ||
2234 | return simplelist_show_list(&info); | ||
2235 | } | ||
2236 | #endif | ||
2237 | |||
2188 | 2238 | ||
2189 | /****** The menu *********/ | 2239 | /****** The menu *********/ |
2190 | static const struct { | 2240 | static const struct { |
@@ -2232,6 +2282,7 @@ static const struct { | |||
2232 | #ifndef APPLICATION | 2282 | #ifndef APPLICATION |
2233 | { "Screendump", dbg_screendump }, | 2283 | { "Screendump", dbg_screendump }, |
2234 | #endif | 2284 | #endif |
2285 | { "Skin Engine Ram usage", dbg_skin_engine }, | ||
2235 | #endif | 2286 | #endif |
2236 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) | 2287 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) |
2237 | { "View HW info", dbg_hw_info }, | 2288 | { "View HW info", dbg_hw_info }, |