summaryrefslogtreecommitdiffstats
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
parent0f274ac852204d5485b6c4dfeafad3c7813007f6 (diff)
downloadrockbox-1633d3f4790714f4d968764d0c3ce10122a3cb5e.tar.gz
rockbox-1633d3f4790714f4d968764d0c3ce10122a3cb5e.tar.bz2
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
-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 {
MEMCPY,
};
-static const char tests[][3] = {
- [READ] = "rd",
- [WRITE] = "wr",
- [MEMSET] = "ms",
- [MEMCPY] = "mc",
+static const char tests[][7] = {
+ [READ] = "read ",
+ [WRITE] = "write ",
+ [MEMSET] = "memset",
+ [MEMCPY] = "memcpy",
};
static int line;
#define TEST_MEM_PRINTF(...) rb->screens[0]->putsf(0, line++, __VA_ARGS__)
static int test(volatile int *buf, int buf_size, int loop_cnt,
- char *ramtype, enum test_type type)
+ enum test_type type)
{
int delta, dMB;
int last_tick = *rb->current_tick;
@@ -171,15 +171,16 @@ static int test(volatile int *buf, int buf_size, int loop_cnt,
if (delta <= 10)
{
- TEST_MEM_PRINTF("DELTA TOO LOW, RESULT INACCURATE");
+ /* The loop_cnt will be increased for the next measurement set until
+ * each measurement at least takes 10 ticks. This is to ensure a
+ * minimum accuracy. */
ret = 1;
}
delta = delta>0 ? delta : delta+1;
dMB = dMB_PER_SEC(buf_size, loop_cnt, delta);
- TEST_MEM_PRINTF("%s %s: %3d.%d MB/s (%3d ticks for %d MB)",
- ramtype, tests[type], dMB/10, dMB%10, delta,
- (loop_cnt*buf_size*sizeof(buf[0]))>>20);
+ TEST_MEM_PRINTF("%s: %3d.%d MB/s (%3d ms)",
+ tests[type], dMB/10, dMB%10, delta*10);
return ret;
}
@@ -212,19 +213,23 @@ enum plugin_status plugin_start(const void* parameter)
#endif
TEST_MEM_PRINTF("loop#: %d", ++count);
+ TEST_MEM_PRINTF("DRAM cnt: %d size: %d MB", loop_repeat_dram,
+ (loop_repeat_dram*BUF_SIZE*sizeof(buf_dram[0]))>>20);
ret = 0;
- ret |= test(buf_dram, BUF_SIZE, loop_repeat_dram, "DRAM", READ);
- ret |= test(buf_dram, BUF_SIZE, loop_repeat_dram, "DRAM", WRITE);
- ret |= test(buf_dram, BUF_SIZE, loop_repeat_dram, "DRAM", MEMSET);
- ret |= test(buf_dram, BUF_SIZE, loop_repeat_dram, "DRAM", MEMCPY);
- if (ret != 0) loop_repeat_dram += LOOP_REPEAT_DRAM;
+ ret |= test(buf_dram, BUF_SIZE, loop_repeat_dram, READ);
+ ret |= test(buf_dram, BUF_SIZE, loop_repeat_dram, WRITE);
+ ret |= test(buf_dram, BUF_SIZE, loop_repeat_dram, MEMSET);
+ ret |= test(buf_dram, BUF_SIZE, loop_repeat_dram, MEMCPY);
+ if (ret != 0) loop_repeat_dram *= 2;
#if defined(PLUGIN_USE_IRAM)
+ TEST_MEM_PRINTF("IRAM cnt: %d size: %d MB", loop_repeat_iram,
+ (loop_repeat_iram*BUF_SIZE*sizeof(buf_iram[0]))>>20);
ret = 0;
- ret |= test(buf_iram, BUF_SIZE, loop_repeat_iram, "IRAM", READ);
- ret |= test(buf_iram, BUF_SIZE, loop_repeat_iram, "IRAM", WRITE);
- ret |= test(buf_iram, BUF_SIZE, loop_repeat_iram, "IRAM", MEMSET);
- ret |= test(buf_iram, BUF_SIZE, loop_repeat_iram, "IRAM", MEMCPY);
- if (ret != 0) loop_repeat_iram += LOOP_REPEAT_IRAM;
+ ret |= test(buf_iram, BUF_SIZE, loop_repeat_iram, READ);
+ ret |= test(buf_iram, BUF_SIZE, loop_repeat_iram, WRITE);
+ ret |= test(buf_iram, BUF_SIZE, loop_repeat_iram, MEMSET);
+ ret |= test(buf_iram, BUF_SIZE, loop_repeat_iram, MEMCPY);
+ if (ret != 0) loop_repeat_iram *= 2;
#endif
rb->screens[0]->update();