summaryrefslogtreecommitdiff
path: root/tests/icachetest/icache_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/icachetest/icache_main.c')
-rw-r--r--tests/icachetest/icache_main.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/icachetest/icache_main.c b/tests/icachetest/icache_main.c
new file mode 100644
index 00000000..93f36d47
--- /dev/null
+++ b/tests/icachetest/icache_main.c
@@ -0,0 +1,34 @@
+#include <stdio.h>
+#include <sys/time.h>
+
+extern void icache_test(long count, long step);
+extern void icache_test2(long count);
+
+int main()
+{
+ printf("[bytes]\t[us]\n");
+
+ struct timeval now, tm;
+ long long t;
+ long MBs;
+ long i;
+ long step = 32;
+ for (i=0 ; step<=2048 ; i++, step+=32)
+ {
+ long value;
+ gettimeofday(&now, 0);
+ icache_test(0x800000L, step);
+ gettimeofday(&tm, 0);
+ t = (tm.tv_sec*1000000LL+tm.tv_usec) - (now.tv_sec*1000000LL+now.tv_usec);
+ printf("%6ld\t%lld\n", step*32, t);
+ }
+
+ gettimeofday(&now, 0);
+ icache_test2(0x800000L / 2048);
+ gettimeofday(&tm, 0);
+ t = (tm.tv_sec*1000000LL+tm.tv_usec) - (now.tv_sec*1000000LL+now.tv_usec);
+ MBs = (8388608LL*32*1000000) / (t * (1024*1024));
+ printf("\n%6lld us\t%ld MB/s\n", t, MBs);
+
+ return 0;
+}