From: compudj@krystal.dyndns.org (Mathieu Desnoyers)
Subject: [ltt-dev] [PATCH] We now rely on the lib userspace rcu API for the trace_clock_read64 function that will now use get_cycles which is architecture _aware_
Date: Mon, 2 Aug 2010 15:55:29 -0400 [thread overview]
Message-ID: <20100802195529.GD3910@Krystal> (raw)
In-Reply-To: <1279816801-20502-1-git-send-email-david.goulet@polymtl.ca>
* David Goulet (david.goulet at polymtl.ca) wrote:
> ---
> include/ust/clock.h | 72 +++++----------------------------------------------
> 1 files changed, 7 insertions(+), 65 deletions(-)
>
> diff --git a/include/ust/clock.h b/include/ust/clock.h
> index cb8a663..27279b6 100644
> --- a/include/ust/clock.h
> +++ b/include/ust/clock.h
> @@ -18,8 +18,6 @@
> #ifndef UST_CLOCK_H
> #define UST_CLOCK_H
>
> -#include <time.h>
> -#include <sys/time.h>
> #include <ust/kcompat/kcompat.h>
>
> /* TRACE CLOCK */
> @@ -35,77 +33,21 @@
> For merging traces with the kernel, a time source compatible with that of
> the kernel is necessary.
>
> - Instead of gettimeofday(), we are now using clock_gettime for better
> - precision and monotonicity.
> -
> + We now use the lib userspace RCU API for clock read.
Hrm, have you checked if get_cycles() is still in the userspace RCU
library git master ? I think we removed it from the standard API.
Mathieu
> */
>
> -#define TRACE_CLOCK_GENERIC
> -#ifdef TRACE_CLOCK_GENERIC
> -
> -static __inline__ u64 trace_clock_read64(void)
> -{
> - struct timespec ts;
> - u64 retval;
> -
> - clock_gettime(CLOCK_MONOTONIC, &ts);
> - retval = ts.tv_sec;
> - retval *= 1000000000;
> - retval += ts.tv_nsec;
> -
> - return retval;
> -}
> -
> -#else
> -
> -#if __i386 || __x86_64
> -
> -/* WARNING: Make sure to set frequency and scaling functions that will not
> - * result in lttv timestamps (sec.nsec) with seconds greater than 2**32-1.
> +/*
> + * Generic trace_clock_read64 function
> */
> static __inline__ u64 trace_clock_read64(void)
> {
> - uint32_t low;
> - uint32_t high;
> - uint64_t retval;
> - __asm__ volatile ("rdtsc\n" : "=a" (low), "=d" (high));
> + cycles_t retval;
>
> - retval = high;
> - retval <<= 32;
> - return retval | low;
> + /* Lib urcu API for cycles count */
> + retval = get_cycles();
> + return (u64)retval;
> }
>
> -#endif /* __i386 || __x86_64 */
> -
> -#ifdef __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;
> -}
> -
> -#endif /* __PPC__ */
> -
> -#endif /* ! UST_TRACE_CLOCK_GENERIC */
> -
> static __inline__ u64 trace_clock_frequency(void)
> {
> return 1000000000LL;
> --
> 1.7.0.4
>
>
> _______________________________________________
> ltt-dev mailing list
> ltt-dev at lists.casi.polymtl.ca
> http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev
>
--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
parent reply other threads:[~2010-08-02 19:55 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <1279816801-20502-1-git-send-email-david.goulet@polymtl.ca>]
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=20100802195529.GD3910@Krystal \
--to=compudj@krystal.dyndns.org \
/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