
Untitled
By: a guest on
Apr 3rd, 2010 | syntax:
C | size: 2.00 KB | hits: 141 | expires: Never
Index: apps/plugins/test_mem.c
===================================================================
--- apps/plugins/test_mem.c (revision 25456)
+++ apps/plugins/test_mem.c (working copy)
@@ -24,7 +24,7 @@
PLUGIN_HEADER
#define BUF_SIZE ((PLUGIN_BUFFER_SIZE-(10<<10)) / (sizeof(int)))
-#define LOOP_REPEAT 8
+#define LOOP_REPEAT 128
static volatile int buf[BUF_SIZE];
#define KB_PER_SEC(delta) ((BUF_SIZE*sizeof(buf[0])*LOOP_REPEAT/delta) >> 10)
@@ -45,11 +45,14 @@
int x;
int delta;
last_tick = *rb->current_tick;
-
for(i = 0; i < LOOP_REPEAT; i++)
{
- for (j = 0; j < BUF_SIZE; j++)
+ for (j = 0; j < BUF_SIZE; j+=4) {
buf[j] = j;
+ buf[j+1] = j;
+ buf[j+2] = j;
+ buf[j+3] = j;
+ }
}
delta = *rb->current_tick - last_tick;
rb->screens[0]->clear_display();
@@ -59,11 +62,31 @@
rb->screens[0]->putsf(0, line++, "write ticks: %d (%d kB/s)", delta,
KB_PER_SEC(delta));
last_tick = *rb->current_tick;
- for(i = 0; i < LOOP_REPEAT; i++)
+
+#if 1
+ int *ptr;
+ for(i = 0; i < LOOP_REPEAT; i++)
{
- for(j = 0; j < BUF_SIZE; j++)
+ for(j = 0; j < BUF_SIZE; j+=4)
+ ptr=&buf[j];
+ asm (
+ "ldmdb %[ptr], {r0, r1, r2, r3};"
+ : [ptr] "+r" (ptr)
+ : : "r0", "r1", "r2", "r3");
+
+ }
+
+
+#else
+ for(i = 0; i < LOOP_REPEAT; i++)
+ {
+ for(j = 0; j < BUF_SIZE; j+=4)
x = buf[j];
+ x = buf[j+1];
+ x = buf[j+2];
+ x = buf[j+3];
}
+#endif
delta = *rb->current_tick - last_tick;
rb->screens[0]->putsf(0, line++, "read ticks: %d (%d kB/s)", delta,
KB_PER_SEC(delta));