diff options
author | David Schleef <ds@schleef.org> | 2010-08-03 00:44:47 -0700 |
---|---|---|
committer | David Schleef <ds@schleef.org> | 2010-08-03 00:47:13 -0700 |
commit | 6a5d7c7d77b50c7749e84c378e46b20f5cde9974 (patch) | |
tree | 866da57e74674d5969d130053168e0ab33c996d4 /orc-test | |
parent | 204a11097d23eccfd0a58b211708884190b892d7 (diff) |
test: Add disabled code for Cortex-A8 benchmarking
Diffstat (limited to 'orc-test')
-rw-r--r-- | orc-test/orcprofile.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/orc-test/orcprofile.c b/orc-test/orcprofile.c index 48e0c3e..559b174 100644 --- a/orc-test/orcprofile.c +++ b/orc-test/orcprofile.c @@ -39,6 +39,9 @@ #include <string.h> #include <math.h> +/* not used because it requires a kernel patch */ +#undef USE_CORTEX_A8_COUNTER + /** * SECTION:orcprofile * @title:OrcProfile @@ -56,6 +59,18 @@ void orc_profile_init (OrcProfile *prof) { +#if defined(__GNUC__) && defined(HAVE_ARM) && defined(USE_CORTEX_A8_COUNTER) + unsigned int flags; + + __asm__ volatile ("mrc p15, 0, %0, c9, c12, 0" : "=r" (flags)); + flags |= 1; + __asm__ volatile ("mcr p15, 0, %0, c9, c12, 0" :: "r" (flags)); + + __asm__ volatile ("mcr p15, 0, %0, c9, c12, 2" :: "r"(1<<31)); + __asm__ __volatile__(" mcr p15, 0, %0, c9, c13, 0" :: "r" (0)); + + __asm__ volatile ("mcr p15, 0, %0, c9, c12, 1" :: "r"(1<<31)); +#endif memset(prof, 0, sizeof(OrcProfile)); prof->min = -1; @@ -156,6 +171,11 @@ oil_profile_stamp_default (void) unsigned long ts; __asm__ __volatile__("rdtsc\n" : "=a" (ts) : : "edx"); return ts; +#elif defined(__GNUC__) && defined(HAVE_ARM) && defined(USE_CORTEX_A8_COUNTER) + unsigned int ts; + //__asm__ __volatile__(" mrc p14, 0, %0, c1, c0, 0 \n" : "=r" (ts)); + __asm__ __volatile__(" mrc p15, 0, %0, c9, c13, 0 \n" : "=r" (ts)); + return ts; #elif defined(_MSC_VER) && defined(HAVE_I386) unsigned long ts; __asm push edx |