summaryrefslogtreecommitdiff
path: root/apps/debug_menu.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/debug_menu.c')
-rw-r--r--apps/debug_menu.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 6f7de6d54e..7c399350b2 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -131,6 +131,8 @@
131#include "rds.h" 131#include "rds.h"
132#endif 132#endif
133 133
134#include "talk.h"
135
134/*---------------------------------------------------*/ 136/*---------------------------------------------------*/
135/* SPECIAL DEBUG STUFF */ 137/* SPECIAL DEBUG STUFF */
136/*---------------------------------------------------*/ 138/*---------------------------------------------------*/
@@ -2130,6 +2132,67 @@ static bool dbg_scrollwheel(void)
2130} 2132}
2131#endif 2133#endif
2132 2134
2135static const char* dbg_talk_get_name(int selected_item, void *data,
2136 char *buffer, size_t buffer_len)
2137{
2138 struct talk_debug_data *talk_data = data;
2139 switch(selected_item)
2140 {
2141 case 0:
2142 if (talk_data)
2143 snprintf(buffer, buffer_len, "Current voice file: %s",
2144 talk_data->voicefile);
2145 else
2146 buffer = "No voice information available";
2147 break;
2148 case 1:
2149 snprintf(buffer, buffer_len, "Number of (empty) clips in voice file: (%d) %d",
2150 talk_data->num_empty_clips, talk_data->num_clips);
2151 break;
2152 case 2:
2153 snprintf(buffer, buffer_len, "Min/Avg/Max size of clips: %d / %d / %d",
2154 talk_data->min_clipsize, talk_data->avg_clipsize, talk_data->max_clipsize);
2155 break;
2156 case 3:
2157 snprintf(buffer, buffer_len, "Memory allocated: %ld.%02ld KB",
2158 talk_data->memory_allocated / 1024, talk_data->memory_allocated % 1024);
2159 break;
2160 case 4:
2161 snprintf(buffer, buffer_len, "Memory used: %ld.%02ld KB",
2162 talk_data->memory_used / 1024, talk_data->memory_used % 1024);
2163 break;
2164 case 5:
2165 snprintf(buffer, buffer_len, "Number of clips in cache: %d",
2166 talk_data->cached_clips);
2167 break;
2168 case 6:
2169 snprintf(buffer, buffer_len, "Cache hits / misses: %d / %d",
2170 talk_data->cache_hits, talk_data->cache_misses);
2171 break;
2172 default:
2173 buffer = "TODO";
2174 break;
2175 }
2176
2177 return buffer;
2178}
2179
2180static bool dbg_talk(void)
2181{
2182 struct simplelist_info list;
2183 struct talk_debug_data data;
2184 if (talk_get_debug_data(&data))
2185 simplelist_info_init(&list, "Voice Information:", 7, &data);
2186 else
2187 simplelist_info_init(&list, "Voice Information:", 1, NULL);
2188 list.scroll_all = true;
2189 list.hide_selection = true;
2190 list.timeout = HZ;
2191 list.get_name = dbg_talk_get_name;
2192
2193 return simplelist_show_list(&list);
2194}
2195
2133#ifdef HAVE_USBSTACK 2196#ifdef HAVE_USBSTACK
2134#if defined(ROCKBOX_HAS_LOGF) && defined(USB_ENABLE_SERIAL) 2197#if defined(ROCKBOX_HAS_LOGF) && defined(USB_ENABLE_SERIAL)
2135static bool toggle_usb_serial(void) 2198static bool toggle_usb_serial(void)
@@ -2361,6 +2424,7 @@ static const struct {
2361 && !defined(IPOD_MINI) && !defined(SIMULATOR)) 2424 && !defined(IPOD_MINI) && !defined(SIMULATOR))
2362 {"Debug scrollwheel", dbg_scrollwheel }, 2425 {"Debug scrollwheel", dbg_scrollwheel },
2363#endif 2426#endif
2427 {"Talk engine stats", dbg_talk },
2364}; 2428};
2365 2429
2366static int menu_action_callback(int btn, struct gui_synclist *lists) 2430static int menu_action_callback(int btn, struct gui_synclist *lists)