diff options
Diffstat (limited to 'apps/plugins/test_mem.c')
-rw-r--r-- | apps/plugins/test_mem.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/apps/plugins/test_mem.c b/apps/plugins/test_mem.c index da89e13340..2ad0e04436 100644 --- a/apps/plugins/test_mem.c +++ b/apps/plugins/test_mem.c | |||
@@ -26,7 +26,9 @@ PLUGIN_HEADER | |||
26 | #define BUF_SIZE ((PLUGIN_BUFFER_SIZE-(10<<10)) / (sizeof(int))) | 26 | #define BUF_SIZE ((PLUGIN_BUFFER_SIZE-(10<<10)) / (sizeof(int))) |
27 | #define LOOP_REPEAT 8 | 27 | #define LOOP_REPEAT 8 |
28 | static volatile int buf[BUF_SIZE]; | 28 | static volatile int buf[BUF_SIZE]; |
29 | #define KB_PER_SEC(delta) ((BUF_SIZE*sizeof(buf[0])*LOOP_REPEAT/delta) >> 10) | 29 | |
30 | /* (Byte per loop * loops * 100 ticks per s / ticks)>>10 = KB per s */ | ||
31 | #define KB_PER_SEC(delta) (((BUF_SIZE*sizeof(buf[0])*LOOP_REPEAT*100)/delta) >> 10) | ||
30 | 32 | ||
31 | enum plugin_status plugin_start(const void* parameter) | 33 | enum plugin_status plugin_start(const void* parameter) |
32 | { | 34 | { |
@@ -42,30 +44,40 @@ enum plugin_status plugin_start(const void* parameter) | |||
42 | { | 44 | { |
43 | unsigned i, j; | 45 | unsigned i, j; |
44 | int line = 0; | 46 | int line = 0; |
45 | int x; | 47 | volatile int x; |
46 | int delta; | 48 | int delta; |
47 | last_tick = *rb->current_tick; | 49 | last_tick = *rb->current_tick; |
48 | 50 | ||
49 | for(i = 0; i < LOOP_REPEAT; i++) | 51 | for(i = 0; i < LOOP_REPEAT; i++) |
50 | { | 52 | { |
51 | for (j = 0; j < BUF_SIZE; j++) | 53 | for (j = 0; j < BUF_SIZE; j+=4) |
52 | buf[j] = j; | 54 | { |
55 | buf[j ] = j; | ||
56 | buf[j+1] = j+1; | ||
57 | buf[j+2] = j+2; | ||
58 | buf[j+3] = j+3; | ||
59 | } | ||
53 | } | 60 | } |
54 | delta = *rb->current_tick - last_tick; | 61 | delta = *rb->current_tick - last_tick; |
55 | rb->screens[0]->clear_display(); | 62 | rb->screens[0]->clear_display(); |
56 | rb->screens[0]->putsf(0, line++, "%s", boost?"boosted":"unboosted"); | 63 | rb->screens[0]->putsf(0, line++, "%s", boost?"boosted":"unboosted"); |
57 | rb->screens[0]->putsf(0, line++, "bufsize: %u", BUF_SIZE*sizeof(buf[0])); | 64 | rb->screens[0]->putsf(0, line++, "bufsize: %u", BUF_SIZE*sizeof(buf[0])); |
58 | rb->screens[0]->putsf(0, line++, "loop#: %d", ++count); | 65 | rb->screens[0]->putsf(0, line++, "loop#: %d", ++count); |
59 | rb->screens[0]->putsf(0, line++, "write ticks: %d (%d kB/s)", delta, | 66 | rb->screens[0]->putsf(0, line++, "write ticks: %2d (%5d KB/s)", delta, |
60 | KB_PER_SEC(delta)); | 67 | KB_PER_SEC(delta)); |
61 | last_tick = *rb->current_tick; | 68 | last_tick = *rb->current_tick; |
62 | for(i = 0; i < LOOP_REPEAT; i++) | 69 | for(i = 0; i < LOOP_REPEAT; i++) |
63 | { | 70 | { |
64 | for(j = 0; j < BUF_SIZE; j++) | 71 | for(j = 0; j < BUF_SIZE; j+=4) |
65 | x = buf[j]; | 72 | { |
73 | x = buf[j ]; | ||
74 | x = buf[j+2]; | ||
75 | x = buf[j+3]; | ||
76 | x = buf[j+4]; | ||
77 | } | ||
66 | } | 78 | } |
67 | delta = *rb->current_tick - last_tick; | 79 | delta = *rb->current_tick - last_tick; |
68 | rb->screens[0]->putsf(0, line++, "read ticks: %d (%d kB/s)", delta, | 80 | rb->screens[0]->putsf(0, line++, "read ticks : %2d (%5d KB/s)", delta, |
69 | KB_PER_SEC(delta)); | 81 | KB_PER_SEC(delta)); |
70 | rb->screens[0]->update(); | 82 | rb->screens[0]->update(); |
71 | 83 | ||