summaryrefslogtreecommitdiff
path: root/liboil/liboilprofile.c
diff options
context:
space:
mode:
authorDavid Schleef <ds@schleef.org>2006-04-21 15:40:31 +0000
committerDavid Schleef <ds@schleef.org>2006-04-21 15:40:31 +0000
commit1f08019b6ecc19f6e1096c4a3910bdcd58029a4e (patch)
tree615e782e759b808438b65a0eeec21d3456d90361 /liboil/liboilprofile.c
parent3d5eeee9d9788e83663c7472cd0b50a79ce667d5 (diff)
downloadliboil-1f08019b6ecc19f6e1096c4a3910bdcd58029a4e.tar.gz
* Makefile.am:
* liboil/Makefile.am: dist various files * liboil/liboildebug.c: debug fix * liboil/liboilfunction.c: doc fix * liboil/liboilcpu.c: move timestamp code here, since it depends closely on the cpu detection code. * liboil/liboilprofile.c:
Diffstat (limited to 'liboil/liboilprofile.c')
-rw-r--r--liboil/liboilprofile.c166
1 files changed, 1 insertions, 165 deletions
diff --git a/liboil/liboilprofile.c b/liboil/liboilprofile.c
index 957a0bb..f84fcb2 100644
--- a/liboil/liboilprofile.c
+++ b/liboil/liboilprofile.c
@@ -146,105 +146,7 @@ oil_profile_get_ave_std (OilProfile *prof, double *ave_p, double *std_p)
if (std_p) *std_p = std;
}
-
-
-#if defined(__i386__) || defined(__amd64__)
-static unsigned long
-oil_profile_stamp_tsc(void)
-{
- unsigned long ts;
- __asm__ __volatile__("rdtsc\n" : "=a" (ts) : : "edx");
- return ts;
-}
-#endif
-
-#if defined(__powerpc__)
-static unsigned long
-oil_profile_stamp_tb(void)
-{
- unsigned long ts;
- __asm__ __volatile__("mftb %0\n" : "=r" (ts));
- return ts;
-}
-#endif
-
-#if defined(__alpha__)
-static unsigned long
-oil_profile_stamp_counter(void)
-{
- unsigned int ts;
- __asm__ __volatile__ ("rpcc %0\n" : "=r"(ts));
- return ts;
-}
-#endif
-
-#if defined(__ia64__)
-static unsigned long
-oil_profile_stamp_counter(void)
-{
- unsigned int ts;
- __asm__ __volatile__("mov %0=ar.itc\n" : "=r"(ts) :: "memory");
- return ts;
-}
-#endif
-
-#if defined(__s390__)
-static unsigned long
-oil_profile_stamp_counter(void)
-{
- uint64_t ts;
- __asm__ __volatile__ ("STCK %0\n" : : "m" (ts));
- return ts;
-}
-#endif
-
-#if defined(__mips__) && 0
-/* broken */
-static unsigned long
-oil_profile_stamp_mips(void)
-{
- unsigned int ts;
- __asm__ __volatile__ (
- " .set push \n"
- " .set reorder \n"
- " mfc0 %0,$9 \n"
- " .set pop \n"
- : "=m" (ts));
- return ts;
-}
-#endif
-
-#if defined(__arm__)
-/* untested */
-static unsigned long
-oil_profile_stamp_xscale255(void)
-{
- unsigned int ts;
- /* this only works for XScale 255 */
- __asm__ __volatile__ (
- " mrc p14, 0, %0, c0, c0, 0 \n"
- : "=r" (ts));
- return ts;
-}
-#endif
-
-#ifdef HAVE_GETTIMEOFDAY
-static unsigned long
-oil_profile_stamp_gtod (void)
-{
- struct timeval tv;
- gettimeofday(&tv,NULL);
- return 1000000*(unsigned long)tv.tv_sec + (unsigned long)tv.tv_usec;
-}
-#endif
-
-static unsigned long
-oil_profile_stamp_zero (void)
-{
- return 0;
-}
-
-static unsigned long (*_oil_profile_stamp)(void);
+unsigned long (*_oil_profile_stamp)(void);
/**
* oil_profile_stamp:
@@ -260,69 +162,3 @@ oil_profile_stamp (void)
return _oil_profile_stamp();
}
-void
-_oil_profile_init (void)
-{
- int gtod_warn = 1;
-
-#if defined(__i386__)
-#define have_tsc 1
- if (have_tsc) {
- _oil_profile_stamp = oil_profile_stamp_tsc;
- }
-#endif
-#if defined(__amd64__)
- _oil_profile_stamp = oil_profile_stamp_tsc;
-#endif
-#if defined(__powerpc__)
- _oil_profile_stamp = oil_profile_stamp_tb;
-#endif
-#if defined(__alpha__)
- _oil_profile_stamp = oil_profile_stamp_counter;
-#endif
-#if defined(__ia64__)
- _oil_profile_stamp = oil_profile_stamp_counter;
-#endif
-#if defined(__s390__)
- _oil_profile_stamp = oil_profile_stamp_counter;
-#endif
-#if defined(__mips__) && 0
- _oil_profile_stamp = oil_profile_stamp_mips;
-#endif
-#if defined(__arm__)
- {
- unsigned int id;
- __asm__ __volatile__ (
- " mrc p15, 0, %0, c0, c0, 0 \n"
- : "=r" (id));
- switch(id >> 24) {
- case 0x69: /* Intel */
- /* assume that all Intel chips support CP14 timestamp */
- _oil_profile_stamp = oil_profile_stamp_xscale255;
- break;
- case 0x41: /* ARM */
- /* ARM chips are known to not have timestamping available from
- * user space */
- gtod_warn = 0;
- break;
- default:
- break;
- }
- }
-#endif
-
-#ifdef HAVE_GETTIMEOFDAY
- if (_oil_profile_stamp == NULL) {
- _oil_profile_stamp = oil_profile_stamp_gtod;
- if (gtod_warn) {
- OIL_ERROR("Using gettimeofday() as a timestamp function. Please add a timestamp function for your platform.");
- }
- }
-#endif
-
- if (_oil_profile_stamp == NULL) {
- _oil_profile_stamp = oil_profile_stamp_zero;
- OIL_ERROR("No timestamping function. This is kinda bad.");
- }
-}
-