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) | |
download | rockbox-a5c90d4986c8ad28378bb5b39af1f5aaa12d7a83.tar.gz rockbox-a5c90d4986c8ad28378bb5b39af1f5aaa12d7a83.zip |
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; | |||
36 | /* (Byte per loop * loops)>>20 * ticks per s * 10 / ticks = dMB per s */ | 36 | /* (Byte per loop * loops)>>20 * ticks per s * 10 / ticks = dMB per s */ |
37 | #define dMB_PER_SEC(cnt, delta) ((((BUF_SIZE*sizeof(int)*cnt)>>20)*HZ*10)/delta) | 37 | #define dMB_PER_SEC(cnt, delta) ((((BUF_SIZE*sizeof(int)*cnt)>>20)*HZ*10)/delta) |
38 | 38 | ||
39 | void memset_test(volatile int *buf, int buf_size, int loop_cnt, | ||
40 | int line, char *ramtype) | ||
41 | { | ||
42 | int delta, dMB, i; | ||
43 | int last_tick = *rb->current_tick; | ||
44 | |||
45 | for(i=0; i < loop_cnt; i++) | ||
46 | memset((void *)buf, 0xff, buf_size); | ||
47 | |||
48 | delta = *rb->current_tick - last_tick; | ||
49 | delta = delta>0 ? delta : delta+1; | ||
50 | dMB = dMB_PER_SEC(loop_cnt, delta); | ||
51 | rb->screens[0]->putsf(0, line, "%s st: %3d.%d MB/s (%2d ticks for %d MB)", | ||
52 | ramtype, dMB/10, dMB%10, delta, | ||
53 | (loop_cnt*BUF_SIZE*4)>>20); | ||
54 | |||
55 | } | ||
56 | |||
57 | void memcpy_test(volatile int *buf, int buf_size, int loop_cnt, | ||
58 | int line, char *ramtype) | ||
59 | { | ||
60 | int delta, dMB, i; | ||
61 | int last_tick = *rb->current_tick; | ||
62 | |||
63 | for(i=0; i < loop_cnt; i++) | ||
64 | memcpy((void *)buf+(buf_size/2), (void *)buf, buf_size/2); | ||
65 | |||
66 | delta = *rb->current_tick - last_tick; | ||
67 | delta = delta>0 ? delta : delta+1; | ||
68 | dMB = dMB_PER_SEC(loop_cnt, delta); | ||
69 | rb->screens[0]->putsf(0, line, "%s cp: %3d.%d MB/s (%2d ticks for %d MB)", | ||
70 | ramtype, dMB/10, dMB%10, delta, | ||
71 | (loop_cnt*BUF_SIZE*4)>>21); | ||
72 | |||
73 | } | ||
74 | |||
39 | void write_test(volatile int *buf, int buf_size, int loop_cnt, | 75 | void write_test(volatile int *buf, int buf_size, int loop_cnt, |
40 | int line, char *ramtype) | 76 | int line, char *ramtype) |
41 | { | 77 | { |
@@ -155,9 +191,13 @@ enum plugin_status plugin_start(const void* parameter) | |||
155 | 191 | ||
156 | read_test (buf_dram, BUF_SIZE, LOOP_REPEAT_DRAM, line++, "DRAM"); | 192 | read_test (buf_dram, BUF_SIZE, LOOP_REPEAT_DRAM, line++, "DRAM"); |
157 | write_test(buf_dram, BUF_SIZE, LOOP_REPEAT_DRAM, line++, "DRAM"); | 193 | write_test(buf_dram, BUF_SIZE, LOOP_REPEAT_DRAM, line++, "DRAM"); |
194 | memset_test(buf_dram, BUF_SIZE, LOOP_REPEAT_DRAM, line++, "DRAM"); | ||
195 | memcpy_test(buf_dram, BUF_SIZE, LOOP_REPEAT_DRAM, line++, "DRAM"); | ||
158 | #if defined(PLUGIN_USE_IRAM) | 196 | #if defined(PLUGIN_USE_IRAM) |
159 | read_test (buf_iram, BUF_SIZE, LOOP_REPEAT_IRAM, line++, "IRAM"); | 197 | read_test (buf_iram, BUF_SIZE, LOOP_REPEAT_IRAM, line++, "IRAM"); |
160 | write_test(buf_iram, BUF_SIZE, LOOP_REPEAT_IRAM, line++, "IRAM"); | 198 | write_test(buf_iram, BUF_SIZE, LOOP_REPEAT_IRAM, line++, "IRAM"); |
199 | memset_test(buf_iram, BUF_SIZE, LOOP_REPEAT_DRAM, line++, "IRAM"); | ||
200 | memcpy_test(buf_iram, BUF_SIZE, LOOP_REPEAT_DRAM, line++, "IRAM"); | ||
161 | #endif | 201 | #endif |
162 | 202 | ||
163 | rb->screens[0]->update(); | 203 | rb->screens[0]->update(); |