Advertisement
Guest User

Untitled

a guest
Apr 3rd, 2010
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.00 KB | None | 0 0
  1. Index: apps/plugins/test_mem.c
  2. ===================================================================
  3. --- apps/plugins/test_mem.c     (revision 25456)
  4. +++ apps/plugins/test_mem.c     (working copy)
  5. @@ -24,7 +24,7 @@
  6.  PLUGIN_HEADER
  7.  
  8.  #define BUF_SIZE ((PLUGIN_BUFFER_SIZE-(10<<10)) / (sizeof(int)))
  9. -#define LOOP_REPEAT 8
  10. +#define LOOP_REPEAT 128
  11.  static volatile int buf[BUF_SIZE];
  12.  #define KB_PER_SEC(delta) ((BUF_SIZE*sizeof(buf[0])*LOOP_REPEAT/delta) >> 10)
  13.  
  14. @@ -45,11 +45,14 @@
  15.          int x;
  16.          int delta;
  17.          last_tick = *rb->current_tick;
  18. -
  19.          for(i = 0; i < LOOP_REPEAT; i++)
  20.          {
  21. -            for (j = 0; j < BUF_SIZE; j++)
  22. +            for (j = 0; j < BUF_SIZE; j+=4) {
  23.                  buf[j] = j;
  24. +                buf[j+1] = j;
  25. +                buf[j+2] = j;
  26. +                buf[j+3] = j;
  27. +            }
  28.          }
  29.          delta = *rb->current_tick - last_tick;
  30.          rb->screens[0]->clear_display();
  31. @@ -59,11 +62,31 @@
  32.          rb->screens[0]->putsf(0, line++, "write ticks: %d (%d kB/s)", delta,
  33.                                KB_PER_SEC(delta));
  34.          last_tick = *rb->current_tick;
  35. -        for(i = 0; i < LOOP_REPEAT; i++)
  36. +  
  37. +#if 1
  38. +    int *ptr;
  39. +    for(i = 0; i < LOOP_REPEAT; i++)
  40.          {
  41. -            for(j = 0; j < BUF_SIZE; j++)
  42. +            for(j = 0; j < BUF_SIZE; j+=4)
  43. +                ptr=&buf[j];
  44. +                  asm  (
  45. +                  "ldmdb %[ptr], {r0, r1, r2, r3};"
  46. +                  : [ptr] "+r" (ptr)
  47. +                  :  : "r0", "r1", "r2", "r3");
  48. +                  
  49. +        }
  50. +
  51. +
  52. +#else
  53. +    for(i = 0; i < LOOP_REPEAT; i++)
  54. +        {
  55. +            for(j = 0; j < BUF_SIZE; j+=4)
  56.                  x = buf[j];
  57. +                x = buf[j+1];
  58. +                x = buf[j+2];
  59. +                x = buf[j+3];
  60.          }
  61. +#endif        
  62.          delta = *rb->current_tick - last_tick;
  63.          rb->screens[0]->putsf(0, line++, "read ticks: %d (%d kB/s)", delta,
  64.                                KB_PER_SEC(delta));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement