summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/debug_menu.c53
-rw-r--r--firmware/common/dircache.c8
-rw-r--r--firmware/include/dircache.h1
3 files changed, 62 insertions, 0 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 1364637ab0..14cdd6cec7 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -1668,6 +1668,56 @@ static bool dbg_disk_info(void)
}
#endif /* !HAVE_MMC */
+#ifdef HAVE_DIRCACHE
+static bool dbg_dircache_info(void)
+{
+ bool done = false;
+ int line;
+ char buf[32];
+
+ lcd_setmargins(0, 0);
+ lcd_setfont(FONT_SYSFIXED);
+
+ while (!done)
+ {
+ line = 0;
+
+ lcd_clear_display();
+ snprintf(buf, sizeof(buf), "Cache initialized: %s",
+ dircache_is_enabled() ? "Yes" : "No");
+ lcd_puts(0, line++, buf);
+
+ snprintf(buf, sizeof(buf), "Cache size: %d B",
+ dircache_get_cache_size());
+ lcd_puts(0, line++, buf);
+
+ snprintf(buf, sizeof(buf), "Last size: %d B",
+ global_settings.dircache_size);
+ lcd_puts(0, line++, buf);
+
+ snprintf(buf, sizeof(buf), "Limit: %d B", DIRCACHE_LIMIT);
+ lcd_puts(0, line++, buf);
+
+ snprintf(buf, sizeof(buf), "Reserve: %d/%d B",
+ dircache_get_reserve_used(), DIRCACHE_RESERVE);
+ lcd_puts(0, line++, buf);
+
+ lcd_update();
+
+ switch (button_get_w_tmo(HZ/2))
+ {
+ case SETTINGS_OK:
+ case SETTINGS_CANCEL:
+ done = true;
+ break;
+ }
+ }
+
+ return false;
+}
+
+#endif /* HAVE_DIRCACHE */
+
#if CONFIG_CPU == SH7034
bool dbg_save_roms(void)
{
@@ -1804,6 +1854,9 @@ bool debug_menu(void)
#else
{ "View disk info", dbg_disk_info },
#endif
+#ifdef HAVE_DIRCACHE
+ { "View dircache info", dbg_dircache_info },
+#endif
#ifdef HAVE_LCD_BITMAP
{ "View audio thread", dbg_audio_thread },
#ifdef PM_DEBUG
diff --git a/firmware/common/dircache.c b/firmware/common/dircache.c
index 0d93a42a61..3048285ee6 100644
--- a/firmware/common/dircache.c
+++ b/firmware/common/dircache.c
@@ -494,6 +494,14 @@ int dircache_get_cache_size(void)
return dircache_size;
}
+int dircache_get_reserve_used(void)
+{
+ if (!dircache_is_enabled())
+ return 0;
+
+ return reserve_used;
+}
+
void dircache_disable(void)
{
int i;
diff --git a/firmware/include/dircache.h b/firmware/include/dircache.h
index 62c5bcd731..89c6a476cc 100644
--- a/firmware/include/dircache.h
+++ b/firmware/include/dircache.h
@@ -71,6 +71,7 @@ int dircache_save(const char *path);
int dircache_build(int last_size);
bool dircache_is_enabled(void);
int dircache_get_cache_size(void);
+int dircache_get_reserve_used(void);
void dircache_disable(void);
const struct dircache_entry *dircache_get_entry_ptr(const char *filename);
void dircache_copy_path(const struct dircache_entry *entry, char *buf, int size);