diff options
author | Michael Giacomelli <giac2000@hotmail.com> | 2010-12-16 05:49:30 +0000 |
---|---|---|
committer | Michael Giacomelli <giac2000@hotmail.com> | 2010-12-16 05:49:30 +0000 |
commit | fa4977180944b63f42024dc5577a75d55f00c5ac (patch) | |
tree | efa675a15b4be99c7c6fbd671ff6ccb9f42a9ea4 | |
parent | abf40651815de8c23ec16edbe66242739909b828 (diff) | |
download | rockbox-fa4977180944b63f42024dc5577a75d55f00c5ac.tar.gz rockbox-fa4977180944b63f42024dc5577a75d55f00c5ac.zip |
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.c | 33 |
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) | |||
146 | /* recursively scan directories in search of files | 146 | /* recursively scan directories in search of files |
147 | and informs the user of the progress */ | 147 | and informs the user of the progress */ |
148 | bool result; | 148 | bool result; |
149 | static long lasttick=0; | ||
149 | int dirlen; | 150 | int dirlen; |
150 | DIR* dir; | 151 | DIR* dir; |
151 | struct dirent* entry; | 152 | struct dirent* entry; |
@@ -173,16 +174,20 @@ static bool _dir_properties(DPS* dps) | |||
173 | continue; /* skip these */ | 174 | continue; /* skip these */ |
174 | 175 | ||
175 | dps->dc++; /* new directory */ | 176 | dps->dc++; /* new directory */ |
176 | rb->lcd_clear_display(); | 177 | if (*rb->current_tick - lasttick > (HZ/8)) |
177 | rb->lcd_puts(0,0,"SCANNING..."); | 178 | { |
178 | rb->lcd_puts(0,1,dps->dirname); | 179 | lasttick = *rb->current_tick; |
179 | rb->lcd_puts(0,2,entry->d_name); | 180 | rb->lcd_clear_display(); |
180 | rb->lcd_putsf(0,3,"Directories: %d", dps->dc); | 181 | rb->lcd_puts(0,0,"SCANNING..."); |
181 | rb->lcd_putsf(0,4,"Files: %d", dps->fc); | 182 | rb->lcd_puts(0,1,dps->dirname); |
182 | log = human_size_log(dps->bc); | 183 | rb->lcd_puts(0,2,entry->d_name); |
183 | rb->lcd_putsf(0,5,"Size: %ld %cB", (long) (dps->bc >> (10*log)), | 184 | rb->lcd_putsf(0,3,"Directories: %d", dps->dc); |
184 | human_size_prefix[log]); | 185 | rb->lcd_putsf(0,4,"Files: %d", dps->fc); |
185 | rb->lcd_update(); | 186 | log = human_size_log(dps->bc); |
187 | rb->lcd_putsf(0,5,"Size: %ld %cB", (long) (dps->bc >> (10*log)), | ||
188 | human_size_prefix[log]); | ||
189 | rb->lcd_update(); | ||
190 | } | ||
186 | 191 | ||
187 | /* recursion */ | 192 | /* recursion */ |
188 | result = _dir_properties(dps); | 193 | result = _dir_properties(dps); |
@@ -211,9 +216,17 @@ static bool dir_properties(char* selected_file) | |||
211 | }; | 216 | }; |
212 | rb->strlcpy(dps.dirname, selected_file, MAX_PATH); | 217 | rb->strlcpy(dps.dirname, selected_file, MAX_PATH); |
213 | 218 | ||
219 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | ||
220 | rb->cpu_boost(true); | ||
221 | #endif | ||
222 | |||
214 | if(false == _dir_properties(&dps)) | 223 | if(false == _dir_properties(&dps)) |
215 | return false; | 224 | return false; |
216 | 225 | ||
226 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | ||
227 | rb->cpu_boost(false); | ||
228 | #endif | ||
229 | |||
217 | rb->strlcpy(str_dirname, selected_file, MAX_PATH); | 230 | rb->strlcpy(str_dirname, selected_file, MAX_PATH); |
218 | rb->snprintf(str_dircount, sizeof str_dircount, "Subdirs: %d", dps.dc); | 231 | rb->snprintf(str_dircount, sizeof str_dircount, "Subdirs: %d", dps.dc); |
219 | rb->snprintf(str_filecount, sizeof str_filecount, "Files: %d", dps.fc); | 232 | rb->snprintf(str_filecount, sizeof str_filecount, "Files: %d", dps.fc); |