forked from len0rd/rockbox
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
This commit is contained in:
parent
0f274ac852
commit
1633d3f479
1 changed files with 25 additions and 20 deletions
|
|
@ -142,18 +142,18 @@ enum test_type {
|
||||||
MEMCPY,
|
MEMCPY,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char tests[][3] = {
|
static const char tests[][7] = {
|
||||||
[READ] = "rd",
|
[READ] = "read ",
|
||||||
[WRITE] = "wr",
|
[WRITE] = "write ",
|
||||||
[MEMSET] = "ms",
|
[MEMSET] = "memset",
|
||||||
[MEMCPY] = "mc",
|
[MEMCPY] = "memcpy",
|
||||||
};
|
};
|
||||||
|
|
||||||
static int line;
|
static int line;
|
||||||
#define TEST_MEM_PRINTF(...) rb->screens[0]->putsf(0, line++, __VA_ARGS__)
|
#define TEST_MEM_PRINTF(...) rb->screens[0]->putsf(0, line++, __VA_ARGS__)
|
||||||
|
|
||||||
static int test(volatile int *buf, int buf_size, int loop_cnt,
|
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 delta, dMB;
|
||||||
int last_tick = *rb->current_tick;
|
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)
|
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;
|
ret = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
delta = delta>0 ? delta : delta+1;
|
delta = delta>0 ? delta : delta+1;
|
||||||
dMB = dMB_PER_SEC(buf_size, loop_cnt, delta);
|
dMB = dMB_PER_SEC(buf_size, loop_cnt, delta);
|
||||||
TEST_MEM_PRINTF("%s %s: %3d.%d MB/s (%3d ticks for %d MB)",
|
TEST_MEM_PRINTF("%s: %3d.%d MB/s (%3d ms)",
|
||||||
ramtype, tests[type], dMB/10, dMB%10, delta,
|
tests[type], dMB/10, dMB%10, delta*10);
|
||||||
(loop_cnt*buf_size*sizeof(buf[0]))>>20);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
@ -212,19 +213,23 @@ enum plugin_status plugin_start(const void* parameter)
|
||||||
#endif
|
#endif
|
||||||
TEST_MEM_PRINTF("loop#: %d", ++count);
|
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 = 0;
|
||||||
ret |= test(buf_dram, BUF_SIZE, loop_repeat_dram, "DRAM", READ);
|
ret |= test(buf_dram, BUF_SIZE, loop_repeat_dram, READ);
|
||||||
ret |= test(buf_dram, BUF_SIZE, loop_repeat_dram, "DRAM", WRITE);
|
ret |= test(buf_dram, BUF_SIZE, loop_repeat_dram, WRITE);
|
||||||
ret |= test(buf_dram, BUF_SIZE, loop_repeat_dram, "DRAM", MEMSET);
|
ret |= test(buf_dram, BUF_SIZE, loop_repeat_dram, MEMSET);
|
||||||
ret |= test(buf_dram, BUF_SIZE, loop_repeat_dram, "DRAM", MEMCPY);
|
ret |= test(buf_dram, BUF_SIZE, loop_repeat_dram, MEMCPY);
|
||||||
if (ret != 0) loop_repeat_dram += LOOP_REPEAT_DRAM;
|
if (ret != 0) loop_repeat_dram *= 2;
|
||||||
#if defined(PLUGIN_USE_IRAM)
|
#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 = 0;
|
||||||
ret |= test(buf_iram, BUF_SIZE, loop_repeat_iram, "IRAM", READ);
|
ret |= test(buf_iram, BUF_SIZE, loop_repeat_iram, READ);
|
||||||
ret |= test(buf_iram, BUF_SIZE, loop_repeat_iram, "IRAM", WRITE);
|
ret |= test(buf_iram, BUF_SIZE, loop_repeat_iram, WRITE);
|
||||||
ret |= test(buf_iram, BUF_SIZE, loop_repeat_iram, "IRAM", MEMSET);
|
ret |= test(buf_iram, BUF_SIZE, loop_repeat_iram, MEMSET);
|
||||||
ret |= test(buf_iram, BUF_SIZE, loop_repeat_iram, "IRAM", MEMCPY);
|
ret |= test(buf_iram, BUF_SIZE, loop_repeat_iram, MEMCPY);
|
||||||
if (ret != 0) loop_repeat_iram += LOOP_REPEAT_IRAM;
|
if (ret != 0) loop_repeat_iram *= 2;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
rb->screens[0]->update();
|
rb->screens[0]->update();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue