summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Giacomelli <giac2000@hotmail.com>2010-12-16 05:49:30 +0000
committerMichael Giacomelli <giac2000@hotmail.com>2010-12-16 05:49:30 +0000
commitfa4977180944b63f42024dc5577a75d55f00c5ac (patch)
treeefa675a15b4be99c7c6fbd671ff6ccb9f42a9ea4
parentabf40651815de8c23ec16edbe66242739909b828 (diff)
Commit FS#11810 by Alexander Meshcheryakov. Boosts the CPU and limits LCD update rate while recursively scanning files in the properties plugin, improving its scan speed.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28841 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugins/properties.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/apps/plugins/properties.c b/apps/plugins/properties.c
index e127a2908e..80c6a83870 100644
--- a/apps/plugins/properties.c
+++ b/apps/plugins/properties.c
@@ -146,6 +146,7 @@ static bool _dir_properties(DPS* dps)
/* recursively scan directories in search of files
and informs the user of the progress */
bool result;
+ static long lasttick=0;
int dirlen;
DIR* dir;
struct dirent* entry;
@@ -173,16 +174,20 @@ static bool _dir_properties(DPS* dps)
continue; /* skip these */
dps->dc++; /* new directory */
- rb->lcd_clear_display();
- rb->lcd_puts(0,0,"SCANNING...");
- rb->lcd_puts(0,1,dps->dirname);
- rb->lcd_puts(0,2,entry->d_name);
- rb->lcd_putsf(0,3,"Directories: %d", dps->dc);
- rb->lcd_putsf(0,4,"Files: %d", dps->fc);
- log = human_size_log(dps->bc);
- rb->lcd_putsf(0,5,"Size: %ld %cB", (long) (dps->bc >> (10*log)),
- human_size_prefix[log]);
- rb->lcd_update();
+ if (*rb->current_tick - lasttick > (HZ/8))
+ {
+ lasttick = *rb->current_tick;
+ rb->lcd_clear_display();
+ rb->lcd_puts(0,0,"SCANNING...");
+ rb->lcd_puts(0,1,dps->dirname);
+ rb->lcd_puts(0,2,entry->d_name);
+ rb->lcd_putsf(0,3,"Directories: %d", dps->dc);
+ rb->lcd_putsf(0,4,"Files: %d", dps->fc);
+ log = human_size_log(dps->bc);
+ rb->lcd_putsf(0,5,"Size: %ld %cB", (long) (dps->bc >> (10*log)),
+ human_size_prefix[log]);
+ rb->lcd_update();
+ }
/* recursion */
result = _dir_properties(dps);
@@ -211,9 +216,17 @@ static bool dir_properties(char* selected_file)
};
rb->strlcpy(dps.dirname, selected_file, MAX_PATH);
+#ifdef HAVE_ADJUSTABLE_CPU_FREQ
+ rb->cpu_boost(true);
+#endif
+
if(false == _dir_properties(&dps))
return false;
+#ifdef HAVE_ADJUSTABLE_CPU_FREQ
+ rb->cpu_boost(false);
+#endif
+
rb->strlcpy(str_dirname, selected_file, MAX_PATH);
rb->snprintf(str_dircount, sizeof str_dircount, "Subdirs: %d", dps.dc);
rb->snprintf(str_filecount, sizeof str_filecount, "Files: %d", dps.fc);