diff options
author | Marcin Bukat <marcin.bukat@gmail.com> | 2010-05-18 10:14:15 +0000 |
---|---|---|
committer | Marcin Bukat <marcin.bukat@gmail.com> | 2010-05-18 10:14:15 +0000 |
commit | a5c90d4986c8ad28378bb5b39af1f5aaa12d7a83 (patch) | |
tree | ea2f41618fb374f2f2536348cad5ac7f2b00118a /apps/plugins/test_mem.c | |
parent | 0ea2753d867aba3607497229a3cd671673df4b78 (diff) |
Add memset/memcpy benches to test_mem plugin
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26135 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/test_mem.c')
-rw-r--r-- | apps/plugins/test_mem.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/apps/plugins/test_mem.c b/apps/plugins/test_mem.c index e8f54c3ba6..053d6a29ee 100644 --- a/apps/plugins/test_mem.c +++ b/apps/plugins/test_mem.c @@ -36,6 +36,42 @@ static volatile int buf_iram[BUF_SIZE] IBSS_ATTR; /* (Byte per loop * loops)>>20 * ticks per s * 10 / ticks = dMB per s */ #define dMB_PER_SEC(cnt, delta) ((((BUF_SIZE*sizeof(int)*cnt)>>20)*HZ*10)/delta) +void memset_test(volatile int *buf, int buf_size, int loop_cnt, + int line, char *ramtype) +{ + int delta, dMB, i; + int last_tick = *rb->current_tick; + + for(i=0; i < loop_cnt; i++) + memset((void *)buf, 0xff, buf_size); + + delta = *rb->current_tick - last_tick; + delta = delta>0 ? delta : delta+1; + dMB = dMB_PER_SEC(loop_cnt, delta); + rb->screens[0]->putsf(0, line, "%s st: %3d.%d MB/s (%2d ticks for %d MB)", + ramtype, dMB/10, dMB%10, delta, + (loop_cnt*BUF_SIZE*4)>>20); + +} + +void memcpy_test(volatile int *buf, int buf_size, int loop_cnt, + int line, char *ramtype) +{ + int delta, dMB, i; + int last_tick = *rb->current_tick; + + for(i=0; i < loop_cnt; i++) + memcpy((void *)buf+(buf_size/2), (void *)buf, buf_size/2); + + delta = *rb->current_tick - last_tick; + delta = delta>0 ? delta : delta+1; + dMB = dMB_PER_SEC(loop_cnt, delta); + rb->screens[0]->putsf(0, line, "%s cp: %3d.%d MB/s (%2d ticks for %d MB)", + ramtype, dMB/10, dMB%10, delta, + (loop_cnt*BUF_SIZE*4)>>21); + +} + void write_test(volatile int *buf, int buf_size, int loop_cnt, int line, char *ramtype) { @@ -155,9 +191,13 @@ enum plugin_status plugin_start(const void* parameter) read_test (buf_dram, BUF_SIZE, LOOP_REPEAT_DRAM, line++, "DRAM"); write_test(buf_dram, BUF_SIZE, LOOP_REPEAT_DRAM, line++, "DRAM"); + memset_test(buf_dram, BUF_SIZE, LOOP_REPEAT_DRAM, line++, "DRAM"); + memcpy_test(buf_dram, BUF_SIZE, LOOP_REPEAT_DRAM, line++, "DRAM"); #if defined(PLUGIN_USE_IRAM) read_test (buf_iram, BUF_SIZE, LOOP_REPEAT_IRAM, line++, "IRAM"); write_test(buf_iram, BUF_SIZE, LOOP_REPEAT_IRAM, line++, "IRAM"); + memset_test(buf_iram, BUF_SIZE, LOOP_REPEAT_DRAM, line++, "IRAM"); + memcpy_test(buf_iram, BUF_SIZE, LOOP_REPEAT_DRAM, line++, "IRAM"); #endif rb->screens[0]->update(); |