summaryrefslogtreecommitdiff
path: root/apps/plugins/test_mem.c
diff options
context:
space:
mode:
authorAndree Buschmann <AndreeBuschmann@t-online.de>2010-12-02 22:18:53 +0000
committerAndree Buschmann <AndreeBuschmann@t-online.de>2010-12-02 22:18:53 +0000
commit1633d3f4790714f4d968764d0c3ce10122a3cb5e (patch)
tree3b348c16bc82fe9d1f3d0d91340a38bcccf63de4 /apps/plugins/test_mem.c
parent0f274ac852204d5485b6c4dfeafad3c7813007f6 (diff)
downloadrockbox-1633d3f4790714f4d968764d0c3ce10122a3cb5e.tar.gz
rockbox-1633d3f4790714f4d968764d0c3ce10122a3cb5e.zip
Changes to test_mem. Improve readability for smaller displays, increase loop count by a factor of 2, if needed,
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28726 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/test_mem.c')
-rw-r--r--apps/plugins/test_mem.c45
1 files changed, 25 insertions, 20 deletions
diff --git a/apps/plugins/test_mem.c b/apps/plugins/test_mem.c
index 2530982ca5..d3e1fa8c6b 100644
--- a/apps/plugins/test_mem.c
+++ b/apps/plugins/test_mem.c
@@ -142,18 +142,18 @@ enum test_type {
142 MEMCPY, 142 MEMCPY,
143}; 143};
144 144
145static const char tests[][3] = { 145static const char tests[][7] = {
146 [READ] = "rd", 146 [READ] = "read ",
147 [WRITE] = "wr", 147 [WRITE] = "write ",
148 [MEMSET] = "ms", 148 [MEMSET] = "memset",
149 [MEMCPY] = "mc", 149 [MEMCPY] = "memcpy",
150}; 150};
151 151
152static int line; 152static int line;
153#define TEST_MEM_PRINTF(...) rb->screens[0]->putsf(0, line++, __VA_ARGS__) 153#define TEST_MEM_PRINTF(...) rb->screens[0]->putsf(0, line++, __VA_ARGS__)
154 154
155static int test(volatile int *buf, int buf_size, int loop_cnt, 155static int test(volatile int *buf, int buf_size, int loop_cnt,
156 char *ramtype, enum test_type type) 156 enum test_type type)
157{ 157{
158 int delta, dMB; 158 int delta, dMB;
159 int last_tick = *rb->current_tick; 159 int last_tick = *rb->current_tick;
@@ -171,15 +171,16 @@ static int test(volatile int *buf, int buf_size, int loop_cnt,
171 171
172 if (delta <= 10) 172 if (delta <= 10)
173 { 173 {
174 TEST_MEM_PRINTF("DELTA TOO LOW, RESULT INACCURATE"); 174 /* The loop_cnt will be increased for the next measurement set until
175 * each measurement at least takes 10 ticks. This is to ensure a
176 * minimum accuracy. */
175 ret = 1; 177 ret = 1;
176 } 178 }
177 179
178 delta = delta>0 ? delta : delta+1; 180 delta = delta>0 ? delta : delta+1;
179 dMB = dMB_PER_SEC(buf_size, loop_cnt, delta); 181 dMB = dMB_PER_SEC(buf_size, loop_cnt, delta);
180 TEST_MEM_PRINTF("%s %s: %3d.%d MB/s (%3d ticks for %d MB)", 182 TEST_MEM_PRINTF("%s: %3d.%d MB/s (%3d ms)",
181 ramtype, tests[type], dMB/10, dMB%10, delta, 183 tests[type], dMB/10, dMB%10, delta*10);
182 (loop_cnt*buf_size*sizeof(buf[0]))>>20);
183 184
184 return ret; 185 return ret;
185} 186}
@@ -212,19 +213,23 @@ enum plugin_status plugin_start(const void* parameter)
212#endif 213#endif
213 TEST_MEM_PRINTF("loop#: %d", ++count); 214 TEST_MEM_PRINTF("loop#: %d", ++count);
214 215
216 TEST_MEM_PRINTF("DRAM cnt: %d size: %d MB", loop_repeat_dram,
217 (loop_repeat_dram*BUF_SIZE*sizeof(buf_dram[0]))>>20);
215 ret = 0; 218 ret = 0;
216 ret |= test(buf_dram, BUF_SIZE, loop_repeat_dram, "DRAM", READ); 219 ret |= test(buf_dram, BUF_SIZE, loop_repeat_dram, READ);
217 ret |= test(buf_dram, BUF_SIZE, loop_repeat_dram, "DRAM", WRITE); 220 ret |= test(buf_dram, BUF_SIZE, loop_repeat_dram, WRITE);
218 ret |= test(buf_dram, BUF_SIZE, loop_repeat_dram, "DRAM", MEMSET); 221 ret |= test(buf_dram, BUF_SIZE, loop_repeat_dram, MEMSET);
219 ret |= test(buf_dram, BUF_SIZE, loop_repeat_dram, "DRAM", MEMCPY); 222 ret |= test(buf_dram, BUF_SIZE, loop_repeat_dram, MEMCPY);
220 if (ret != 0) loop_repeat_dram += LOOP_REPEAT_DRAM; 223 if (ret != 0) loop_repeat_dram *= 2;
221#if defined(PLUGIN_USE_IRAM) 224#if defined(PLUGIN_USE_IRAM)
225 TEST_MEM_PRINTF("IRAM cnt: %d size: %d MB", loop_repeat_iram,
226 (loop_repeat_iram*BUF_SIZE*sizeof(buf_iram[0]))>>20);
222 ret = 0; 227 ret = 0;
223 ret |= test(buf_iram, BUF_SIZE, loop_repeat_iram, "IRAM", READ); 228 ret |= test(buf_iram, BUF_SIZE, loop_repeat_iram, READ);
224 ret |= test(buf_iram, BUF_SIZE, loop_repeat_iram, "IRAM", WRITE); 229 ret |= test(buf_iram, BUF_SIZE, loop_repeat_iram, WRITE);
225 ret |= test(buf_iram, BUF_SIZE, loop_repeat_iram, "IRAM", MEMSET); 230 ret |= test(buf_iram, BUF_SIZE, loop_repeat_iram, MEMSET);
226 ret |= test(buf_iram, BUF_SIZE, loop_repeat_iram, "IRAM", MEMCPY); 231 ret |= test(buf_iram, BUF_SIZE, loop_repeat_iram, MEMCPY);
227 if (ret != 0) loop_repeat_iram += LOOP_REPEAT_IRAM; 232 if (ret != 0) loop_repeat_iram *= 2;
228#endif 233#endif
229 234
230 rb->screens[0]->update(); 235 rb->screens[0]->update();