[cairo-commit] 3 commits - perf/cairo-perf-posix.c
Mathias Hasselmann
hasselmm at kemper.freedesktop.org
Mon Apr 16 14:06:57 PDT 2007
perf/cairo-perf-posix.c | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 deletions(-)
New commits:
diff-tree f7a2787685d640dd35ef7ef1314c4e754771c512 (from parents)
Merge: 2efaf3a7a47a281ca02009d371cd7a06a8a4f282 cab4d41cae4463841bca297a7e16c970633c8c21
Author: Mathias Hasselmann <mathias.hasselmann at gmx.de>
Date: Mon Apr 16 23:05:10 2007 +0200
Merge branch 'master' of git+ssh://hasselmm@git.freedesktop.org/git/cairo
diff-tree 2efaf3a7a47a281ca02009d371cd7a06a8a4f282 (from parents)
Merge: abac4d251dd02151dced296afa9d6e1b383868ee 25ddc0800490ca0222668e389412f92ccfdab91c
Author: Mathias Hasselmann <mathias.hasselmann at gmx.de>
Date: Sat Mar 24 00:29:04 2007 +0100
Merge branch 'master' of git+ssh://hasselmm@git.freedesktop.org/git/cairo
diff-tree abac4d251dd02151dced296afa9d6e1b383868ee (from 820341b4c503fbd5ca3b8f6c3e5ff6eca5562b98)
Author: Mathias Hasselmann <mathias.hasselmann at gmx.de>
Date: Fri Mar 23 23:36:15 2007 +0100
[cairo-perf] Use full 64 bit of the clock cycle counters to avoid overflows
diff --git a/perf/cairo-perf-posix.c b/perf/cairo-perf-posix.c
index 68637ef..b1b1a2a 100644
--- a/perf/cairo-perf-posix.c
+++ b/perf/cairo-perf-posix.c
@@ -65,11 +65,11 @@
/* timers */
#if defined(__i386__) || defined(__amd64__)
-static inline unsigned long
+static inline cairo_perf_ticks_t
oil_profile_stamp_rdtsc (void)
{
- unsigned long ts;
- __asm__ __volatile__("rdtsc\n" : "=a" (ts) : : "edx");
+ uint64_t ts;
+ __asm__ __volatile__("rdtsc\n" : "=A" (ts));
return ts;
}
#define OIL_STAMP oil_profile_stamp_rdtsc
@@ -79,8 +79,17 @@ oil_profile_stamp_rdtsc (void)
static inline cairo_perf_ticks_t
oil_profile_stamp_tb(void)
{
- unsigned long ts;
- __asm__ __volatile__("mftb %0\n" : "=r" (ts));
+ uint32_t junk;
+ uint64_t ts;
+
+ __asm__ __volatile__ (
+ "1: mftbu %1;"
+ " mftb %0+1;"
+ " mftbu %0;"
+ " cmpw %0,%1;"
+ " bne 1b" :
+ "=r" (ts), "=r" (junk));
+
return ts;
}
#define OIL_STAMP oil_profile_stamp_tb
@@ -158,9 +167,6 @@ cairo_perf_timer_elapsed (void) {
cairo_perf_ticks_t ticks;
#ifdef OIL_STAMP
- /* Handle 32-bit wraparound of timer value */
- if (timer.stop < timer.start)
- timer.stop += 0x100000000ll;
ticks = (timer.stop - timer.start);
#else
ticks = (timer.tv_stop.tv_sec - timer.tv_start.tv_sec) * 1000000;
More information about the cairo-commit
mailing list