Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: yannick.brosseau@gmail.com (Yannick Brosseau)
Subject: [ltt-dev] [PATCH] Remove PowerPC specific time reading function
Date: Wed,  9 Feb 2011 23:50:06 -0500	[thread overview]
Message-ID: <1297313406-23905-1-git-send-email-yannick.brosseau@gmail.com> (raw)

The PPC version of the trace_clock_read64 was using the TB register
which is not constant accross implementations. The currently
measured time base on PPC was not accurate.
So, for now, we rely on the CLOCK_MONOTONIC.

This patch remove a bunch of #ifdef for x86 and PPC, since we now rely on
the same base clock. It also fix the build on PPC that was currently broken

Signed-off-by: Yannick Brosseau <yannick.brosseau at gmail.com>
---
 include/ust/clock.h |   30 ++----------------------------
 1 files changed, 2 insertions(+), 28 deletions(-)

diff --git a/include/ust/clock.h b/include/ust/clock.h
index 04785fc..5e558f8 100644
--- a/include/ust/clock.h
+++ b/include/ust/clock.h
@@ -39,7 +39,6 @@
    precision and monotonicity.
 */
 
-#if __i386__ || __x86_64__
 /* Only available for x86 arch */
 #define CLOCK_TRACE_FREQ  14
 #define CLOCK_TRACE  15
@@ -47,36 +46,10 @@ union lttng_timespec {
 	struct timespec ts;
 	u64 lttng_ts;
 };
-#endif /* __i386__ || __x86_64__ */
 
 extern int ust_clock_source;
 
 /* Choosing correct trace clock */
-#if __PPC__
-static __inline__ u64 trace_clock_read64(void)
-{
-	unsigned long tb_l;
-	unsigned long tb_h;
-	unsigned long tb_h2;
-	u64 tb;
-
-	__asm__ (
-		"1:\n\t"
-		"mftbu %[rhigh]\n\t"
-		"mftb %[rlow]\n\t"
-		"mftbu %[rhigh2]\n\t"
-		"cmpw %[rhigh],%[rhigh2]\n\t"
-		"bne 1b\n\t"
-		: [rhigh] "=r" (tb_h), [rhigh2] "=r" (tb_h2), [rlow] "=r" (tb_l));
-
-	tb = tb_h;
-	tb <<= 32;
-	tb |= tb_l;
-
-	return tb;
-}
-
-#else	/* !__PPC__ */
 
 static __inline__ u64 trace_clock_read64(void)
 {
@@ -101,17 +74,18 @@ static __inline__ u64 trace_clock_read64(void)
 	return retval;
 }
 
-#endif /* __PPC__ */
 
 static __inline__ u64 trace_clock_frequency(void)
 {
 	struct timespec ts;
 	union lttng_timespec *lts = (union lttng_timespec *) &ts;
 
+#if __i386__ || __x86_64__
 	if (likely(ust_clock_source == CLOCK_TRACE)) {
 		clock_gettime(CLOCK_TRACE_FREQ, &ts);
 		return lts->lttng_ts;
 	}
+#endif
 	return 1000000000LL;
 }
 
-- 
1.7.2.3





             reply	other threads:[~2011-02-10  4:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-10  4:50 Yannick Brosseau [this message]
2011-02-10 16:01 ` Mathieu Desnoyers
     [not found] ` <20110210160120.GA961@Krystal>
2011-02-10 17:54   ` Mathieu Desnoyers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1297313406-23905-1-git-send-email-yannick.brosseau@gmail.com \
    --to=yannick.brosseau@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox