Re: [PATCH] add TSC definitions for ia64

Mathieu Desnoyers <[email protected]> Thu, 15 May 2008 08:05:47 -0400
Newsgroups gmane.linux.kernel.tracing
Message-ID <20080515120547.GA16312@Krystal>
* Lai Jiangshan ([email protected]) wrote:
> 	There is no TSC definitions for ia64 currently,
> this patch will add it.
> 
> Signed-off-by: Lai Jiangshan <[email protected]>
> 
> diff -Nur linux-2.6-lttng.org/include/asm-ia64/ltt.h linux-2.6-lttng/include/asm-ia64/ltt.h
> --- linux-2.6-lttng.org/include/asm-ia64/ltt.h	1970-01-01 08:00:00.000000000 +0800
> +++ linux-2.6-lttng/include/asm-ia64/ltt.h	2008-05-12 05:13:48.000000000 +0800
> @@ -0,0 +1,43 @@
> +#ifndef _ASM_IA64_LTT_H
> +#define _ASM_IA64_LTT_H
> +
> +/*
> + * Copyright (C) Lai Jiangshan <[email protected]>
> + *               Mathieu Desnoyers <[email protected]>
> + *
> + * IA64 definitions for tracing system
> + */
> +
> +#include <linux/time.h>
> +#include <asm/timex.h>
> +#include <asm/processor.h>
> +
> +#define LTT_HAS_TSC
> +
> +static inline u32 ltt_get_timestamp32(void)
> +{
> +	return get_cycles();
> +}
> +
> +static inline u64 ltt_get_timestamp64(void)
> +{
> +	return get_cycles();
> +}
> +
> +static inline void ltt_add_timestamp(unsigned long ticks)
> +{
> +}
> +
> +static inline unsigned int ltt_frequency(void)
> +{
> +	__u64 ret = (local_cpu_data->itc_freq + MSEC_PER_SEC/2) / MSEC_PER_SEC;
> +	return (unsigned int) ret;
> +}
> +
Hi Lai,

Hrm, I think you could declare ltt_frequency with the full 64 bits
precision :


+static inline unsigned long long ltt_frequency(void)
+{
+	 return local_cpu_data->itc_freq;
+}

and then :

+static inline u32 ltt_freq_scale(void)
+{
+	return 1;
+}

Because start_freq, in ltt_trace_struct, declared in
include/linux/ltt-tracer.h, is a u64.

It will give a more precise cycles to ns conversion in the viewer.

Thanks,

Mathieu


> +static inline u32 ltt_freq_scale(void)
> +{
> +	return MSEC_PER_SEC;
> +}
> +
> +#endif /* _ASM_IA64_LTT_H */
> +
> 
> 

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68